Skip to content

Commit 7fe8462

Browse files
committed
ssp: fix panic in validate creds
1 parent a499eaf commit 7fe8462

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ssp/gssapi/context.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,11 @@ func InitSecurityContext(ctx context.Context, tok *Token, opts ...Option) (*Toke
220220
cc.Credential = GetCredential(ctx, cfg.TargetName, f.Type(), InitiateOnly)
221221

222222
// optionally validate credential.
223-
if validator, ok := (any)(cc.Credential.Value()).(interface{ Validate() error }); ok {
224-
if err = validator.Validate(); err != nil {
225-
return nil, ContextError(ctx, Failure, err)
223+
if cc.Credential != nil {
224+
if validator, ok := (any)(cc.Credential.Value()).(interface{ Validate() error }); ok {
225+
if err = validator.Validate(); err != nil {
226+
return nil, ContextError(ctx, Failure, err)
227+
}
226228
}
227229
}
228230

0 commit comments

Comments
 (0)