diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-03 02:17:34 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-12-03 02:17:34 +0000 |
commit | 2fd401c8f190f1fe43e51a7f726f6ed6119a1f96 (patch) | |
tree | 7f76eff391f37fe6467ff4ffbc0c582c9959ea30 /libgo/go/smtp/auth.go | |
parent | 02e9018f1616b23f1276151797216717b3564202 (diff) | |
download | gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.zip gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.gz gcc-2fd401c8f190f1fe43e51a7f726f6ed6119a1f96.tar.bz2 |
libgo: Update to weekly.2011-11-02.
From-SVN: r181964
Diffstat (limited to 'libgo/go/smtp/auth.go')
-rw-r--r-- | libgo/go/smtp/auth.go | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/libgo/go/smtp/auth.go b/libgo/go/smtp/auth.go index dd27f8e..10a757f 100644 --- a/libgo/go/smtp/auth.go +++ b/libgo/go/smtp/auth.go @@ -4,9 +4,7 @@ package smtp -import ( - "os" -) +import "errors" // Auth is implemented by an SMTP authentication mechanism. type Auth interface { @@ -15,17 +13,17 @@ type Auth interface { // and optionally data to include in the initial AUTH message // sent to the server. It can return proto == "" to indicate // that the authentication should be skipped. - // If it returns a non-nil os.Error, the SMTP client aborts + // If it returns a non-nil error, the SMTP client aborts // the authentication attempt and closes the connection. - Start(server *ServerInfo) (proto string, toServer []byte, err os.Error) + Start(server *ServerInfo) (proto string, toServer []byte, err error) // Next continues the authentication. The server has just sent // the fromServer data. If more is true, the server expects a // response, which Next should return as toServer; otherwise // Next should return toServer == nil. - // If Next returns a non-nil os.Error, the SMTP client aborts + // If Next returns a non-nil error, the SMTP client aborts // the authentication attempt and closes the connection. - Next(fromServer []byte, more bool) (toServer []byte, err os.Error) + Next(fromServer []byte, more bool) (toServer []byte, err error) } // ServerInfo records information about an SMTP server. @@ -49,21 +47,21 @@ func PlainAuth(identity, username, password, host string) Auth { return &plainAuth{identity, username, password, host} } -func (a *plainAuth) Start(server *ServerInfo) (string, []byte, os.Error) { +func (a *plainAuth) Start(server *ServerInfo) (string, []byte, error) { if !server.TLS { - return "", nil, os.NewError("unencrypted connection") + return "", nil, errors.New("unencrypted connection") } if server.Name != a.host { - return "", nil, os.NewError("wrong host name") + return "", nil, errors.New("wrong host name") } resp := []byte(a.identity + "\x00" + a.username + "\x00" + a.password) return "PLAIN", resp, nil } -func (a *plainAuth) Next(fromServer []byte, more bool) ([]byte, os.Error) { +func (a *plainAuth) Next(fromServer []byte, more bool) ([]byte, error) { if more { // We've already sent everything. - return nil, os.NewError("unexpected server challenge") + return nil, errors.New("unexpected server challenge") } return nil, nil } |