Skip checking the validity of an empty client token

This commit is contained in:
vishalnayak 2017-05-02 16:53:41 -04:00
parent 60add30b9d
commit 68635e8a1c
1 changed files with 5 additions and 1 deletions

View File

@ -153,13 +153,16 @@ func (m *ExpirationManager) Tidy() error {
return
}
var isValid bool
var ok bool
revokeLease := false
if le.ClientToken == "" {
m.logger.Debug("expiration: lease has an empty token", "lease_id", leaseID)
revokeLease = true
goto REVOKE_CHECK
}
isValid, ok := tokenCache[le.ClientToken]
isValid, ok = tokenCache[le.ClientToken]
if !ok {
saltedID := m.tokenStore.SaltID(le.ClientToken)
lock := locksutil.LockForKey(m.tokenStore.tokenLocks, le.ClientToken)
@ -188,6 +191,7 @@ func (m *ExpirationManager) Tidy() error {
}
}
REVOKE_CHECK:
if revokeLease {
m.logger.Debug("expiration: invalid lease is being revoked", "lease_id", leaseID)
// Force the revocation and skip going through the token store