Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: net/base/transport_security_state_static_generate.go

Issue 10411075: net: add certificate pins for tor2web.org (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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")
}
« net/base/transport_security_state_static.h ('K') | « net/base/transport_security_state_static.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698