mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 11:08:10 +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) {
|
switch s := raw.(type) {
|
||||||
case *logical.Auth:
|
case *logical.Auth:
|
||||||
|
if s == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if s.ClientToken != "" {
|
if s.ClientToken != "" {
|
||||||
token, err := fn(s.ClientToken)
|
token, err := fn(s.ClientToken)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -31,6 +34,9 @@ func Hash(raw interface{}) error {
|
|||||||
s.ClientToken = token
|
s.ClientToken = token
|
||||||
}
|
}
|
||||||
case *logical.Request:
|
case *logical.Request:
|
||||||
|
if s == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if s.Auth != nil {
|
if s.Auth != nil {
|
||||||
if err := Hash(s.Auth); err != nil {
|
if err := Hash(s.Auth); err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -44,6 +50,9 @@ func Hash(raw interface{}) error {
|
|||||||
|
|
||||||
s.Data = data.(map[string]interface{})
|
s.Data = data.(map[string]interface{})
|
||||||
case *logical.Response:
|
case *logical.Response:
|
||||||
|
if s == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if s.Auth != nil {
|
if s.Auth != nil {
|
||||||
if err := Hash(s.Auth); err != nil {
|
if err := Hash(s.Auth); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user