Skip to content

Commit 7147340

Browse files
authored
Switch to strings.EqualFold (hashicorp#5284)
1 parent ea6ec0a commit 7147340

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

builtin/audit/file/backend.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ func Factory(ctx context.Context, conf *audit.BackendConfig) (audit.Backend, err
3333
}
3434

3535
// normalize path if configured for stdout
36-
if strings.ToLower(path) == "stdout" {
36+
if strings.EqualFold(path, "stdout") {
3737
path = "stdout"
3838
}
39-
if strings.ToLower(path) == "discard" {
39+
if strings.EqualFold(path, "discard") {
4040
path = "discard"
4141
}
4242

builtin/credential/aws/path_login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,7 +1394,7 @@ func parseIamArn(iamArn string) (*iamEntity, error) {
13941394
func validateVaultHeaderValue(headers http.Header, requestUrl *url.URL, requiredHeaderValue string) error {
13951395
providedValue := ""
13961396
for k, v := range headers {
1397-
if strings.ToLower(iamServerIdHeader) == strings.ToLower(k) {
1397+
if strings.EqualFold(iamServerIdHeader, k) {
13981398
providedValue = strings.Join(v, ",")
13991399
break
14001400
}

builtin/credential/github/path_login.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ func (b *backend) verifyCredentials(ctx context.Context, req *logical.Request, t
196196
}
197197

198198
for _, o := range allOrgs {
199-
if strings.ToLower(*o.Login) == strings.ToLower(config.Organization) {
199+
if strings.EqualFold(*o.Login, config.Organization) {
200200
org = o
201201
break
202202
}

builtin/credential/okta/path_groups.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (b *backend) Group(ctx context.Context, s logical.Storage, n string) (*Grou
6262
return nil, "", err
6363
}
6464
for _, groupName := range entries {
65-
if strings.ToLower(groupName) == strings.ToLower(n) {
65+
if strings.EqualFold(groupName, n) {
6666
entry, err = s.Get(ctx, "group/"+groupName)
6767
if err != nil {
6868
return nil, "", err

builtin/logical/pki/cert_util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ func parseOtherSANs(others []string) (map[string][]string, error) {
501501
if len(splitType) != 2 {
502502
return nil, fmt.Errorf("expected a colon in other SAN %q", other)
503503
}
504-
if strings.ToLower(splitType[0]) != "utf8" {
504+
if !strings.EqualFold(splitType[0], "utf8") {
505505
return nil, fmt.Errorf("only utf8 other SANs are supported; found non-supported type in other SAN %q", other)
506506
}
507507
result[splitOther[0]] = append(result[splitOther[0]], splitType[1])

0 commit comments

Comments
 (0)