mirror of
https://github.com/hashicorp/vault.git
synced 2026-05-28 04:10:44 -04:00
audit: fixing panic caused by tls connection state. Fixes #322
This commit is contained in:
parent
4776825e20
commit
b49683a40b
2 changed files with 40 additions and 0 deletions
|
|
@ -53,6 +53,16 @@ func (b *Backend) LogRequest(auth *logical.Auth, req *logical.Request, outerErr
|
|||
return err
|
||||
}
|
||||
if !b.LogRaw {
|
||||
// Before we copy the structure we must nil out some data
|
||||
// otherwise we will cause reflection to panic and die
|
||||
if req.Connection != nil && req.Connection.ConnState != nil {
|
||||
origState := req.Connection.ConnState
|
||||
req.Connection.ConnState = nil
|
||||
defer func() {
|
||||
req.Connection.ConnState = origState
|
||||
}()
|
||||
}
|
||||
|
||||
// Copy the structures
|
||||
cp, err := copystructure.Copy(auth)
|
||||
if err != nil {
|
||||
|
|
@ -88,6 +98,16 @@ func (b *Backend) LogResponse(
|
|||
return err
|
||||
}
|
||||
if !b.LogRaw {
|
||||
// Before we copy the structure we must nil out some data
|
||||
// otherwise we will cause reflection to panic and die
|
||||
if req.Connection != nil && req.Connection.ConnState != nil {
|
||||
origState := req.Connection.ConnState
|
||||
req.Connection.ConnState = nil
|
||||
defer func() {
|
||||
req.Connection.ConnState = origState
|
||||
}()
|
||||
}
|
||||
|
||||
// Copy the structure
|
||||
cp, err := copystructure.Copy(auth)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,16 @@ type Backend struct {
|
|||
|
||||
func (b *Backend) LogRequest(auth *logical.Auth, req *logical.Request, outerErr error) error {
|
||||
if !b.logRaw {
|
||||
// Before we copy the structure we must nil out some data
|
||||
// otherwise we will cause reflection to panic and die
|
||||
if req.Connection != nil && req.Connection.ConnState != nil {
|
||||
origState := req.Connection.ConnState
|
||||
req.Connection.ConnState = nil
|
||||
defer func() {
|
||||
req.Connection.ConnState = origState
|
||||
}()
|
||||
}
|
||||
|
||||
// Copy the structures
|
||||
cp, err := copystructure.Copy(auth)
|
||||
if err != nil {
|
||||
|
|
@ -91,6 +101,16 @@ func (b *Backend) LogRequest(auth *logical.Auth, req *logical.Request, outerErr
|
|||
func (b *Backend) LogResponse(auth *logical.Auth, req *logical.Request,
|
||||
resp *logical.Response, err error) error {
|
||||
if !b.logRaw {
|
||||
// Before we copy the structure we must nil out some data
|
||||
// otherwise we will cause reflection to panic and die
|
||||
if req.Connection != nil && req.Connection.ConnState != nil {
|
||||
origState := req.Connection.ConnState
|
||||
req.Connection.ConnState = nil
|
||||
defer func() {
|
||||
req.Connection.ConnState = origState
|
||||
}()
|
||||
}
|
||||
|
||||
// Copy the structure
|
||||
cp, err := copystructure.Copy(auth)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Reference in a new issue