Skip to content

Commit

Permalink
Merge branch '0.6-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
foxcpp committed Mar 13, 2023
2 parents 60c2530 + 9f58cb6 commit f5def9c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions internal/auth/sasl.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ func (s *SASLAuth) CreateSASL(mech string, remoteAddr net.Addr, successCb func(i
if identity == "" {
identity = username
}
if identity != username {
return ErrInvalidAuthCred
}

err := s.AuthPlain(username, password)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/auth/sasl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ func TestCreateSASL(t *testing.T) {

t.Run("PLAIN with authorization identity", func(t *testing.T) {
srv := a.CreateSASL("PLAIN", &net.TCPAddr{}, func(id string) error {
if id != "user1a" {
if id != "user1" {
t.Fatal("Wrong authorization identity passed:", id)
}
return nil
})

_, _, err := srv.Next([]byte("user1a\x00user1\x00aa"))
_, _, err := srv.Next([]byte("user1\x00user1\x00aa"))
if err != nil {
t.Error("Unexpected error:", err)
}
Expand Down

0 comments on commit f5def9c

Please # to comment.