Skip to content

Commit f5def9c

Browse files
committed
Merge branch '0.6-fixes'
2 parents 60c2530 + 9f58cb6 commit f5def9c

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

internal/auth/sasl.go

+3
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ func (s *SASLAuth) CreateSASL(mech string, remoteAddr net.Addr, successCb func(i
122122
if identity == "" {
123123
identity = username
124124
}
125+
if identity != username {
126+
return ErrInvalidAuthCred
127+
}
125128

126129
err := s.AuthPlain(username, password)
127130
if err != nil {

internal/auth/sasl_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ func TestCreateSASL(t *testing.T) {
7575

7676
t.Run("PLAIN with authorization identity", func(t *testing.T) {
7777
srv := a.CreateSASL("PLAIN", &net.TCPAddr{}, func(id string) error {
78-
if id != "user1a" {
78+
if id != "user1" {
7979
t.Fatal("Wrong authorization identity passed:", id)
8080
}
8181
return nil
8282
})
8383

84-
_, _, err := srv.Next([]byte("user1a\x00user1\x00aa"))
84+
_, _, err := srv.Next([]byte("user1\x00user1\x00aa"))
8585
if err != nil {
8686
t.Error("Unexpected error:", err)
8787
}

0 commit comments

Comments
 (0)