Allowing Unwrap w/ Newline files (#13044)

This commit is contained in:
AnPucel
2021-11-24 10:13:45 -08:00
committed by GitHub
parent f8cb3dcc63
commit f5d9697003
2 changed files with 7 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import (
"net/http"
"net/url"
"os"
"strings"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/vault/sdk/helper/jsonutil"
@@ -235,12 +236,13 @@ func (c *Logical) DeleteWithData(path string, data map[string][]string) (*Secret
func (c *Logical) Unwrap(wrappingToken string) (*Secret, error) {
var data map[string]interface{}
wt := strings.TrimSpace(wrappingToken)
if wrappingToken != "" {
if c.c.Token() == "" {
c.c.SetToken(wrappingToken)
c.c.SetToken(wt)
} else if wrappingToken != c.c.Token() {
data = map[string]interface{}{
"token": wrappingToken,
"token": wt,
}
}
}