Merge pull request #38 from jsha/more-policy-tests

Restore some dropped tests cases for PA.
This commit is contained in:
Peter Eckersley 2015-03-20 12:46:44 -07:00
commit 8b39294849
2 changed files with 30 additions and 2 deletions

View File

@ -102,7 +102,7 @@ func (pa PolicyAuthorityImpl) WillingToIssue(id core.AcmeIdentifier) error {
}
labels := strings.Split(domain, ".")
if len(labels) > maxLabels {
if len(labels) > maxLabels || len(labels) < 2 {
return SyntaxError
}
for _, label := range labels {

View File

@ -26,12 +26,40 @@ func TestWillingToIssue(t *testing.T) {
`www.-ombo.com`, // Label starts with '-'
`www.xn--hmr.net`, // Punycode (disallowed for now)
}
`xn--.net`, // No punycode for now.
`0`,
`1`,
`*`,
`**`,
`*.*`,
`zombo*com`,
`*.com`,
`*.zombo.com`,
`.`,
`..`,
`a..`,
`..a`,
`.a.`,
`.....`,
`www.zombo_com.com`,
`\uFEFF`, // Byte order mark
`\uFEFFwww.zombo.com`,
`www.zom\u202Ebo.com`, // Right-to-Left Override
`\u202Ewww.zombo.com`,
`www.zom\u200Fbo.com`, // Right-to-Left Mark
`\u200Fwww.zombo.com`,
// Underscores are technically disallowed in DNS. Some DNS
// implementations accept them but we will be conservative.
`www.zom_bo.com`,
`zombocom`,
}
shouldBeNonPublic := []string{
`co.uk`,
`example.acting`,
`example.internal`,
// All-numeric final label not okay.
`www.zombo.163`,
}
shouldBeBlacklisted := []string{