diff options
Diffstat (limited to 'libgo/go/net/smtp/auth.go')
-rw-r--r-- | libgo/go/net/smtp/auth.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libgo/go/net/smtp/auth.go b/libgo/go/net/smtp/auth.go index d401e3c21fd..3f1339ebc56 100644 --- a/libgo/go/net/smtp/auth.go +++ b/libgo/go/net/smtp/auth.go @@ -54,7 +54,16 @@ func PlainAuth(identity, username, password, host string) Auth { func (a *plainAuth) Start(server *ServerInfo) (string, []byte, error) { if !server.TLS { - return "", nil, errors.New("unencrypted connection") + advertised := false + for _, mechanism := range server.Auth { + if mechanism == "PLAIN" { + advertised = true + break + } + } + if !advertised { + return "", nil, errors.New("unencrypted connection") + } } if server.Name != a.host { return "", nil, errors.New("wrong host name") |