Reverse order of certspotter.MatchesWildcard arguments

This commit is contained in:
Andrew Ayer 2016-05-10 14:29:04 -07:00
parent 92fbdcb947
commit f9432ae4b9
2 changed files with 3 additions and 3 deletions

View File

@ -67,7 +67,7 @@ func dnsLabelMatches (certLabel string, watchLabel string) bool {
return certLabel == "*" ||
certLabel == "?" ||
certLabel == certspotter.UnparsableDNSLabelPlaceholder ||
certspotter.MatchWildcard(certLabel, watchLabel)
certspotter.MatchesWildcard(watchLabel, certLabel)
}
func dnsNameMatches (dnsName []string, watchDomain []string) bool {

View File

@ -400,10 +400,10 @@ func WriteCertRepository (repoPath string, isPrecert bool, certs [][]byte) (bool
return false, path, nil
}
func MatchWildcard (pattern string, dnsName string) bool {
func MatchesWildcard (dnsName string, pattern string) bool {
for len(pattern) > 0 {
if pattern[0] == '*' {
if len(dnsName) > 0 && dnsName[0] != '.' && MatchWildcard(pattern, dnsName[1:]) {
if len(dnsName) > 0 && dnsName[0] != '.' && MatchesWildcard(dnsName[1:], pattern) {
return true
}
pattern = pattern[1:]