Conversation
|
I'm good adding this, and this is from gomail which is MIT licensed so it should be fine. All I'd ask is that we please change error messages to appropriately identify this library. |
| if !server.TLS { | ||
| advertised := false | ||
| for _, mechanism := range server.Auth { | ||
| if mechanism == "LOGIN" { | ||
| advertised = true | ||
| break | ||
| } | ||
| } | ||
| if !advertised { | ||
| return "", nil, errors.New("gomail: unencrypted connection") | ||
| } | ||
| } | ||
| if server.Name != a.host { | ||
| return "", nil, errors.New("gomail: wrong host name") | ||
| } |
There was a problem hiding this comment.
I feel I've seen this implementation before (perhaps when perusing gomail when I've needed to implement this myself) but it does not make sense to me. I'd expect something more like:
| if !server.TLS { | |
| advertised := false | |
| for _, mechanism := range server.Auth { | |
| if mechanism == "LOGIN" { | |
| advertised = true | |
| break | |
| } | |
| } | |
| if !advertised { | |
| return "", nil, errors.New("gomail: unencrypted connection") | |
| } | |
| } | |
| if server.Name != a.host { | |
| return "", nil, errors.New("gomail: wrong host name") | |
| } | |
| if !server.TLS { | |
| return "", nil, errors.New("unencrypted connection") | |
| } | |
| if server.Name != a.Host { | |
| return "", nil, errors.New("wrong host name") | |
| } | |
| advertised := false | |
| for _, mechanism := range server.Auth { | |
| if mechanism == "LOGIN" { | |
| advertised = true | |
| break | |
| } | |
| } | |
| if !advertised { | |
| return "", nil, errors.New("login auth not supported") | |
| } |
I don't see how whether it advertises LOGIN has anything to do with an unencrypted connection. In a comment in the net/smtp source it even mentions:
Note: If TLS is not true, then we can't trust ANYTHING in ServerInfo.
And they use something similar to what I propose above for the smtp.PlainAuth implementation.
Unless I'm missing something?
|
Is there anything further that needs to be done for this to be merged? Just poking through PRs after starting to utilize the package and came across this, which seems complete. |
|
Well, this project last commit is 1 yo, and author hasn't committed since last march. I guess nothing will happen on the project ? |
fix: #104