As we reevaluate how to best support and maintain Staging Ref in the future, we encourage development teams using this environment to highlight their use cases in the following issue: https://gitlab.com/gitlab-com/gl-infra/software-delivery/framework/software-delivery-framework-issue-tracker/-/issues/36.

Skip to content
Snippets Groups Projects
Commit 04c38c97 authored by Patrick Bajao's avatar Patrick Bajao
Browse files

Merge branch 'id-gssapi-race-condition' into 'main'

Fix race conditions in GSSAPI calls

See merge request https://gitlab.com/gitlab-org/gitlab-shell/-/merge_requests/875



Merged-by: default avatarPatrick Bajao <ebajao@gitlab.com>
Approved-by: default avatarAsh McKenzie <amckenzie@gitlab.com>
Approved-by: default avatarPatrick Bajao <ebajao@gitlab.com>
Approved-by: default avatarStan Hu <stanhu@gmail.com>
Co-authored-by: default avatarIgor Drozdov <idrozdov@gitlab.com>
parents fad20dc2 f45fb8de
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -4,6 +4,7 @@ package sshd
import (
"fmt"
"sync"
"github.com/openshift/gssapi"
Loading
Loading
@@ -41,6 +42,7 @@ type OSGSSAPIServer struct {
Keytab string
ServicePrincipalName string
mutex sync.RWMutex
contextId *gssapi.CtxId
}
Loading
Loading
@@ -62,6 +64,9 @@ func (server *OSGSSAPIServer) AcceptSecContext(
needContinue bool,
err error,
) {
server.mutex.Lock()
defer server.mutex.Unlock()
tokenBuffer, err := lib.MakeBufferBytes(token)
if err != nil {
return
Loading
Loading
@@ -111,6 +116,9 @@ func (server *OSGSSAPIServer) VerifyMIC(
micField []byte,
micToken []byte,
) error {
server.mutex.Lock()
defer server.mutex.Unlock()
if server.contextId == nil {
return fmt.Errorf("gssapi: uninitialized contextId")
}
Loading
Loading
@@ -132,6 +140,9 @@ func (server *OSGSSAPIServer) VerifyMIC(
}
func (server *OSGSSAPIServer) DeleteSecContext() error {
server.mutex.Lock()
defer server.mutex.Unlock()
if server.contextId == nil {
return nil
}
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment