mirror of
https://github.com/wneessen/go-mail.git
synced 2024-11-22 13:50:49 +01:00
Merge pull request #282 from lipangeng/main
Support lowercase username and password challenge
This commit is contained in:
commit
84b5ebcebc
1 changed files with 6 additions and 4 deletions
|
@ -20,13 +20,15 @@ const (
|
||||||
// extension.
|
// extension.
|
||||||
//
|
//
|
||||||
// See: https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-xlogin/.
|
// See: https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-xlogin/.
|
||||||
LoginXUsernameChallenge = "Username:"
|
LoginXUsernameChallenge = "Username:"
|
||||||
|
LoginXUsernameLowerChallenge = "username:"
|
||||||
|
|
||||||
// LoginXPasswordChallenge represents the Password Challenge response sent by the SMTP server per the AUTH LOGIN
|
// LoginXPasswordChallenge represents the Password Challenge response sent by the SMTP server per the AUTH LOGIN
|
||||||
// extension.
|
// extension.
|
||||||
//
|
//
|
||||||
// See: https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-xlogin/.
|
// See: https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-xlogin/.
|
||||||
LoginXPasswordChallenge = "Password:"
|
LoginXPasswordChallenge = "Password:"
|
||||||
|
LoginXPasswordLowerChallenge = "password:"
|
||||||
|
|
||||||
// LoginXDraftUsernameChallenge represents the Username Challenge response sent by the SMTP server per the IETF
|
// LoginXDraftUsernameChallenge represents the Username Challenge response sent by the SMTP server per the IETF
|
||||||
// draft AUTH LOGIN extension. It should be noted this extension is an expired draft which was never formally
|
// draft AUTH LOGIN extension. It should be noted this extension is an expired draft which was never formally
|
||||||
|
@ -76,9 +78,9 @@ func (a *loginAuth) Start(server *ServerInfo) (string, []byte, error) {
|
||||||
func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) {
|
func (a *loginAuth) Next(fromServer []byte, more bool) ([]byte, error) {
|
||||||
if more {
|
if more {
|
||||||
switch string(fromServer) {
|
switch string(fromServer) {
|
||||||
case LoginXUsernameChallenge, LoginXDraftUsernameChallenge:
|
case LoginXUsernameChallenge, LoginXUsernameLowerChallenge, LoginXDraftUsernameChallenge:
|
||||||
return []byte(a.username), nil
|
return []byte(a.username), nil
|
||||||
case LoginXPasswordChallenge, LoginXDraftPasswordChallenge:
|
case LoginXPasswordChallenge, LoginXPasswordLowerChallenge, LoginXDraftPasswordChallenge:
|
||||||
return []byte(a.password), nil
|
return []byte(a.password), nil
|
||||||
default:
|
default:
|
||||||
return nil, fmt.Errorf("unexpected server response: %s", string(fromServer))
|
return nil, fmt.Errorf("unexpected server response: %s", string(fromServer))
|
||||||
|
|
Loading…
Reference in a new issue