Chromium Code Reviews| Index: net/base/transport_security_state_static_generate.go |
| diff --git a/net/base/transport_security_state_static_generate.go b/net/base/transport_security_state_static_generate.go |
| index 03694f9318fdf7b81c9fe66505403fb1d2dea7b7..36992dfd796b805b142da6f3edbe66cbe408f818 100644 |
| --- a/net/base/transport_security_state_static_generate.go |
| +++ b/net/base/transport_security_state_static_generate.go |
| @@ -283,13 +283,21 @@ func matchNames(name, v string) error { |
| if strings.HasSuffix(firstWord, ",") { |
| firstWord = firstWord[:len(firstWord)-1] |
| } |
| + if strings.HasPrefix(firstWord, "*.") { |
| + firstWord = firstWord[2:] |
| + } |
| if pos := strings.Index(firstWord, "."); pos != -1 { |
| firstWord = firstWord[:pos] |
| } |
| if pos := strings.Index(firstWord, "-"); pos != -1 { |
| firstWord = firstWord[:pos] |
| } |
| - if !strings.HasPrefix(v, firstWord) { |
| + if len(firstWord) == 0 { |
|
palmer
2012/05/22 19:24:46
Looks like inconsistent whitespace here.
agl
2012/05/23 19:29:25
That's just how codereview is showing it. I've run
|
| + return errors.New("first word of certificate name is empty") |
| + } |
| + firstWord = strings.ToLower(firstWord) |
| + lowerV := strings.ToLower(v) |
| + if !strings.HasPrefix(lowerV, firstWord) { |
| return errors.New("the first word of the certificate name isn't a prefix of the variable name") |
| } |