Fixed PLAIN authentication
This commit is contained in:
parent
1d59d94f4e
commit
faa9a603a2
2
auth.go
2
auth.go
|
@ -41,7 +41,7 @@ func (a *plainAuth) Start(server *smtp.ServerInfo) (string, []byte, error) {
|
|||
return "LOGIN", nil, nil
|
||||
}
|
||||
|
||||
return "PLAIN", []byte(a.username + "\x00" + a.password), nil
|
||||
return "PLAIN", []byte("\x00" + a.username + "\x00" + a.password), nil
|
||||
}
|
||||
|
||||
func (a *plainAuth) Next(fromServer []byte, more bool) ([]byte, error) {
|
||||
|
|
10
auth_test.go
10
auth_test.go
|
@ -42,7 +42,7 @@ func TestNoAdvertisementTLS(t *testing.T) {
|
|||
challenges: []string{"Username:", "Password:"},
|
||||
tls: true,
|
||||
wantProto: "PLAIN",
|
||||
wantData: []string{testUser + "\x00" + testPwd},
|
||||
wantData: []string{"\x00" + testUser + "\x00" + testPwd},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ func TestPlain(t *testing.T) {
|
|||
challenges: []string{"Username:", "Password:"},
|
||||
tls: false,
|
||||
wantProto: "PLAIN",
|
||||
wantData: []string{testUser + "\x00" + testPwd},
|
||||
wantData: []string{"\x00" + testUser + "\x00" + testPwd},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ func TestPlainTLS(t *testing.T) {
|
|||
challenges: []string{"Username:", "Password:"},
|
||||
tls: true,
|
||||
wantProto: "PLAIN",
|
||||
wantData: []string{testUser + "\x00" + testPwd},
|
||||
wantData: []string{"\x00" + testUser + "\x00" + testPwd},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ func TestPlainAndLogin(t *testing.T) {
|
|||
challenges: []string{"Username:", "Password:"},
|
||||
tls: false,
|
||||
wantProto: "PLAIN",
|
||||
wantData: []string{testUser + "\x00" + testPwd},
|
||||
wantData: []string{"\x00" + testUser + "\x00" + testPwd},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ func TestPlainAndLoginTLS(t *testing.T) {
|
|||
challenges: []string{"Username:", "Password:"},
|
||||
tls: true,
|
||||
wantProto: "PLAIN",
|
||||
wantData: []string{testUser + "\x00" + testPwd},
|
||||
wantData: []string{"\x00" + testUser + "\x00" + testPwd},
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue