2
0

stop ignoring ErrorResponse during GSS auth

This commit is contained in:
Oliver Tan
2022-05-24 10:39:13 -07:00
committed by Jack Christensen
parent 831fc211bc
commit 7ddbd74d5e
+9 -4
View File
@@ -2,6 +2,8 @@ package pgconn
import (
"errors"
"fmt"
"github.com/jackc/pgproto3/v2"
)
@@ -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)
}