mirror of
https://github.com/joohoi/acme-dns.git
synced 2025-07-13 01:07:38 +07:00
relax subdomain validation from UUID to actual subdomain (#243)
This commit is contained in:
@ -5,6 +5,8 @@ import (
|
||||
|
||||
"github.com/google/uuid"
|
||||
"golang.org/x/crypto/bcrypt"
|
||||
|
||||
"regexp"
|
||||
)
|
||||
|
||||
func getValidUsername(u string) (uuid.UUID, error) {
|
||||
@ -25,13 +27,12 @@ func validKey(k string) bool {
|
||||
}
|
||||
|
||||
func validSubdomain(s string) bool {
|
||||
_, err := uuid.Parse(s)
|
||||
if err == nil {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
// URL safe base64 alphabet without padding as defined in ACME
|
||||
RegExp := regexp.MustCompile("^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?$")
|
||||
return RegExp.MatchString(s)
|
||||
}
|
||||
|
||||
|
||||
func validTXT(s string) bool {
|
||||
sn := sanitizeString(s)
|
||||
if utf8.RuneCountInString(s) == 43 && utf8.RuneCountInString(sn) == 43 {
|
||||
|
Reference in New Issue
Block a user