mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 09:42:25 +00:00
audit: Guard against a few nil pointer cases
This commit is contained in:
committed by
Mitchell Hashimoto
parent
cee1d20015
commit
139a8db461
@@ -22,6 +22,9 @@ func Hash(raw interface{}) error {
|
||||
|
||||
switch s := raw.(type) {
|
||||
case *logical.Auth:
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
if s.ClientToken != "" {
|
||||
token, err := fn(s.ClientToken)
|
||||
if err != nil {
|
||||
@@ -31,6 +34,9 @@ func Hash(raw interface{}) error {
|
||||
s.ClientToken = token
|
||||
}
|
||||
case *logical.Request:
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
if s.Auth != nil {
|
||||
if err := Hash(s.Auth); err != nil {
|
||||
return err
|
||||
@@ -44,6 +50,9 @@ func Hash(raw interface{}) error {
|
||||
|
||||
s.Data = data.(map[string]interface{})
|
||||
case *logical.Response:
|
||||
if s == nil {
|
||||
return nil
|
||||
}
|
||||
if s.Auth != nil {
|
||||
if err := Hash(s.Auth); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user