[mod] introduce regex for SHA512

This commit is contained in:
Laurent Peuch 2017-09-18 21:29:01 +02:00
parent 0fc80b256b
commit 622bed1169

View file

@ -63,11 +63,17 @@ class IPRouteLine(object):
for k, v in self.m.groupdict().items():
setattr(self, k, v)
RE_DYNDNS_PRIVATE_KEY = re.compile(
RE_DYNDNS_PRIVATE_KEY_MD5 = re.compile(
r'.*/K(?P<domain>[^\s\+]+)\.\+157.+\.private$'
)
RE_DYNDNS_PRIVATE_KEY_SHA512 = re.compile(
r'.*/K(?P<domain>[^\s\+]+)\.\+163.+\.private$'
)
def dyndns_subscribe(subscribe_host="dyndns.yunohost.org", domain=None, key=None):
"""
Subscribe to a DynDNS service
@ -176,7 +182,7 @@ def dyndns_update(dyn_host="dyndns.yunohost.org", domain=None, key=None,
if domain is None:
# Retrieve the first registered domain
for path in glob.iglob('/etc/yunohost/dyndns/K*.private'):
match = RE_DYNDNS_PRIVATE_KEY.match(path)
match = RE_DYNDNS_PRIVATE_KEY_MD5.match(path)
if not match:
continue
_domain = match.group('domain')