Skip to content

Commit 3fb0da5

Browse files
url encoding ca name
1 parent 31b9647 commit 3fb0da5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cert_util.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io/ioutil"
99
"net/http"
10+
"net/url"
1011
"strings"
1112
"time"
1213

@@ -69,7 +70,7 @@ func fetchCAInfo(ctx context.Context, req *logical.Request, b *backend) (respons
6970
return resp, nil
7071
}
7172

72-
// if not we search certs for 'CA -eq "keyfactor-KFTRAIN-CA" AND CertState -eq "6"'
73+
// if not we search certs for 'CA -eq "<ca_name>" AND CertState -eq "6"'
7374
//
7475

7576
caId, err := getCAId(ctx, req, b)
@@ -176,6 +177,8 @@ func getCAId(ctx context.Context, req *logical.Request, b *backend) (string, err
176177
b.Logger().Debug("Closing idle connections")
177178
http.DefaultClient.CloseIdleConnections()
178179

180+
ca_name = url.QueryEscape(ca_name)
181+
179182
// Build request
180183
url := config["protocol"] + "://" + host + "/KeyfactorAPI/Certificates?pq.queryString=CA%20-eq%20%22" + ca_name + "%22%20AND%20CertState%20-eq%20%226%22" // CertState 6 = cert
181184
b.Logger().Debug("url: " + url)

0 commit comments

Comments
 (0)