Skip to content

Commit c48332a

Browse files
committed
auth/sasl: Add missing usernameForAuth call
1 parent 06fd524 commit c48332a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

internal/auth/sasl.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,12 @@ func (s *SASLAuth) CreateSASL(mech string, remoteAddr net.Addr, successCb func(i
139139
return ErrInvalidAuthCred
140140
}
141141

142-
err := s.AuthPlain(username, password)
142+
username, err := s.usernameForAuth(context.Background(), username)
143+
if err != nil {
144+
return err
145+
}
146+
147+
err = s.AuthPlain(username, password)
143148
if err != nil {
144149
s.Log.Error("authentication failed", err, "username", username, "src_ip", remoteAddr)
145150
return ErrInvalidAuthCred
@@ -156,6 +161,11 @@ func (s *SASLAuth) CreateSASL(mech string, remoteAddr net.Addr, successCb func(i
156161
}
157162

158163
return sasllogin.NewLoginServer(func(username, password string) error {
164+
username, err := s.usernameForAuth(context.Background(), username)
165+
if err != nil {
166+
return err
167+
}
168+
159169
err := s.AuthPlain(username, password)
160170
if err != nil {
161171
s.Log.Error("authentication failed", err, "username", username, "src_ip", remoteAddr)

0 commit comments

Comments
 (0)