Skip to content

Commit

Permalink
stop ignoring ErrorResponse during GSS auth
Browse files Browse the repository at this point in the history
  • Loading branch information
otan authored and jackc committed May 25, 2022
1 parent 831fc21 commit 7ddbd74
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions krb5.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package pgconn

import (
"errors"
"fmt"

"github.com/jackc/pgproto3/v2"
)

Expand Down Expand Up @@ -85,10 +87,13 @@ func (c *PgConn) rxGSSContinue() (*pgproto3.AuthenticationGSSContinue, error) {
if err != nil {
return nil, err
}
gssContinue, ok := msg.(*pgproto3.AuthenticationGSSContinue)
if ok {
return gssContinue, nil

switch m := msg.(type) {
case *pgproto3.AuthenticationGSSContinue:
return m, nil
case *pgproto3.ErrorResponse:
return nil, ErrorResponseToPgError(m)
}

return nil, errors.New("expected AuthenticationGSSContinue message but received unexpected message")
return nil, fmt.Errorf("expected AuthenticationGSSContinue message but received unexpected message %T", msg)
}

0 comments on commit 7ddbd74

Please sign in to comment.