Add context to performPolicyChecks

This commit is contained in:
Jeff Mitchell 2018-01-19 02:43:36 -05:00
parent 13fddcb193
commit 0f7e3bb79b
2 changed files with 5 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package vault
import (
"context"
"fmt"
"reflect"
"strings"
@ -396,7 +397,7 @@ CHECK:
ret.Allowed = true
return
}
func (c *Core) performPolicyChecks(acl *ACL, te *TokenEntry, req *logical.Request, inEntity *identity.Entity, opts *PolicyCheckOpts) (ret *AuthResults) {
func (c *Core) performPolicyChecks(ctx context.Context, acl *ACL, te *TokenEntry, req *logical.Request, inEntity *identity.Entity, opts *PolicyCheckOpts) (ret *AuthResults) {
ret = new(AuthResults)
// First, perform normal ACL checks if requested. The only time no ACL

View File

@ -841,7 +841,7 @@ func (c *Core) checkToken(ctx context.Context, req *logical.Request, unauth bool
// Check the standard non-root ACLs. Return the token entry if it's not
// allowed so we can decrement the use count.
authResults := c.performPolicyChecks(acl, te, req, entity, &PolicyCheckOpts{
authResults := c.performPolicyChecks(ctx, acl, te, req, entity, &PolicyCheckOpts{
Unauth: unauth,
RootPrivsRequired: rootPath,
})
@ -1350,7 +1350,7 @@ func (c *Core) sealInitCommon(ctx context.Context, req *logical.Request) (retErr
}
// Verify that this operation is allowed
authResults := c.performPolicyChecks(acl, te, req, entity, &PolicyCheckOpts{
authResults := c.performPolicyChecks(ctx, acl, te, req, entity, &PolicyCheckOpts{
RootPrivsRequired: true,
})
if authResults.Error.ErrorOrNil() != nil {
@ -1455,7 +1455,7 @@ func (c *Core) StepDown(req *logical.Request) (retErr error) {
}
// Verify that this operation is allowed
authResults := c.performPolicyChecks(acl, te, req, entity, &PolicyCheckOpts{
authResults := c.performPolicyChecks(ctx, acl, te, req, entity, &PolicyCheckOpts{
RootPrivsRequired: true,
})
if authResults.Error.ErrorOrNil() != nil {