mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-04-22 19:13:37 +08:00
add schema for subdomain name checks (supported subdomain name lengths are longer than normal names (in total)
This commit is contained in:
@@ -59,6 +59,7 @@ OP_ZONEFILE_HASH_PATTERN = r'^([0-9a-fA-F]{{{}}})$'.format(LENGTH_VALUE_HASH * 2
|
||||
OP_NAME_PATTERN = r'^([a-z0-9\-_.+]{{{},{}}})$'.format(3, LENGTH_MAX_NAME)
|
||||
OP_NAMESPACE_PATTERN = r'^([a-z0-9\-_+]{{{},{}}})$'.format(1, LENGTH_MAX_NAMESPACE_ID)
|
||||
OP_NAMESPACE_HASH_PATTERN = r'^([0-9a-fA-F]{16})$'
|
||||
OP_SUBDOMAIN_NAME_PATTERN = r'^([a-z0-9\-_.+]{{{},{}}})$'.format(5, LENGTH_MAX_NAME * 2)
|
||||
OP_BASE64_PATTERN_SECTION = r'(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})'
|
||||
OP_BASE64_PATTERN = r'^({})$'.format(OP_BASE64_PATTERN_SECTION)
|
||||
OP_URLENCODED_NOSLASH_PATTERN = r'^([a-zA-Z0-9\-_.~%]+)$' # intentionally left out /
|
||||
|
||||
@@ -381,11 +381,13 @@ def is_address_subdomain(fqa):
|
||||
If it isn't, returns False.
|
||||
If it is, returns True and a tuple (subdomain_name, domain)
|
||||
"""
|
||||
if re.match(schemas.OP_NAME_PATTERN, fqa) == None:
|
||||
if re.match(schemas.OP_SUBDOMAIN_NAME_PATTERN, fqa) == None:
|
||||
return False
|
||||
pieces = fqa.split(".")
|
||||
if len(pieces) == 3:
|
||||
subd_name = pieces[0]
|
||||
if len(subd_name) < 1:
|
||||
return False
|
||||
domain = fqa[len(subd_name) + 1:]
|
||||
error = safety.check_valid_name(domain)
|
||||
if error:
|
||||
@@ -414,7 +416,7 @@ def _build_subdomain_db(domain_fqas, zonefiles, subdomain_db = None, txids = Non
|
||||
assert "zonefile" not in zf
|
||||
zf_json = zf
|
||||
else:
|
||||
assert isinstance(zf, (str, unicode))
|
||||
assert isinstance(zf, (str, unicode))
|
||||
zf_json = bs_zonefile.decode_name_zonefile(domain_fqa, zf)
|
||||
assert "zonefile" not in zf_json
|
||||
|
||||
@@ -550,7 +552,7 @@ def get_subdomains_owned_by_address(address):
|
||||
# redeem script portion and sigs, verify with OPCHECKMULTISIG
|
||||
# verify redeem script matches owner address.
|
||||
# single-sig: parse b64 signature blob as a scriptSig, parse out the
|
||||
# pubkey and sig, verify like OPCHECKSIG.
|
||||
# pubkey and sig, verify like OPCHECKSIG.
|
||||
# verify pubkey matches owner address.
|
||||
##
|
||||
|
||||
|
||||
Reference in New Issue
Block a user