diff --git a/cmd/certspotter/main.go b/cmd/certspotter/main.go index 4055d0f..d0cf51f 100644 --- a/cmd/certspotter/main.go +++ b/cmd/certspotter/main.go @@ -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 { diff --git a/helpers.go b/helpers.go index 964018b..b1cf70e 100644 --- a/helpers.go +++ b/helpers.go @@ -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:]