diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-06-04 06:19:01 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-06-04 06:19:01 +0000 |
commit | 4f56f1bf2248bb17da8b269b4191218d85ce6587 (patch) | |
tree | 00e4c90f29024c89477bc7cee708f8020ff4a49a /pkg/sentry/socket/control | |
parent | fcaa9421355cf770cf47c792388e25700b802e05 (diff) | |
parent | f520d0d585e159da902b2880c5e115abeaacf9cb (diff) |
Merge f520d0d5 (automated)
Diffstat (limited to 'pkg/sentry/socket/control')
-rw-r--r-- | pkg/sentry/socket/control/control.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg/sentry/socket/control/control.go b/pkg/sentry/socket/control/control.go index c0238691d..434d7ca2e 100644 --- a/pkg/sentry/socket/control/control.go +++ b/pkg/sentry/socket/control/control.go @@ -406,12 +406,20 @@ func makeCreds(t *kernel.Task, socketOrEndpoint interface{}) SCMCredentials { return nil } if cr, ok := socketOrEndpoint.(transport.Credentialer); ok && (cr.Passcred() || cr.ConnectedPasscred()) { - tcred := t.Credentials() - return &scmCredentials{t, tcred.EffectiveKUID, tcred.EffectiveKGID} + return MakeCreds(t) } return nil } +// MakeCreds creates default SCMCredentials. +func MakeCreds(t *kernel.Task) SCMCredentials { + if t == nil { + return nil + } + tcred := t.Credentials() + return &scmCredentials{t, tcred.EffectiveKUID, tcred.EffectiveKGID} +} + // New creates default control messages if needed. func New(t *kernel.Task, socketOrEndpoint interface{}, rights SCMRights) transport.ControlMessages { return transport.ControlMessages{ |