Implement WrapInfo audit logging

This commit is contained in:
Jeff Mitchell 2016-05-07 20:03:56 -04:00
parent bcbcd22657
commit 31e1ed2417
2 changed files with 23 additions and 2 deletions

View file

@ -67,12 +67,25 @@ func Hash(salter *salt.Salt, raw interface{}) error {
}
}
if s.WrapInfo != nil {
if err := Hash(salter, s.WrapInfo); err != nil {
return err
}
}
data, err := HashStructure(s.Data, fn)
if err != nil {
return err
}
s.Data = data.(map[string]interface{})
case *logical.WrapInfo:
if s == nil {
return nil
}
s.Token = fn(s.Token)
}
return nil

View file

@ -87,7 +87,7 @@ func init() {
if input.Auth != nil {
retAuth, err := copystructure.Copy(input.Auth)
if err != nil {
return nil, fmt.Errorf("error copying Secret: %v", err)
return nil, fmt.Errorf("error copying Auth: %v", err)
}
ret.Auth = retAuth.(*Auth)
}
@ -95,7 +95,7 @@ func init() {
if input.Data != nil {
retData, err := copystructure.Copy(&input.Data)
if err != nil {
return nil, fmt.Errorf("error copying Secret: %v", err)
return nil, fmt.Errorf("error copying Data: %v", err)
}
ret.Data = retData.(map[string]interface{})
}
@ -106,6 +106,14 @@ func init() {
}
}
if input.WrapInfo != nil {
retWrapInfo, err := copystructure.Copy(input.WrapInfo)
if err != nil {
return nil, fmt.Errorf("error copying WrapInfo: %v", err)
}
ret.WrapInfo = retWrapInfo.(*WrapInfo)
}
return &ret, nil
}
}