diff options
author | Petr Spacek <pspacek@redhat.com> | 2014-02-17 14:37:28 +0100 |
---|---|---|
committer | Petr Viktorin <pviktori@redhat.com> | 2014-02-18 15:51:11 +0100 |
commit | 2af96d1c0bd3b39dd9ab4ab2b35b924eed5c5d69 (patch) | |
tree | c191ee54527335cd97112f2f8edde15380b757f6 /ipalib/plugins/dns.py | |
parent | 96003a45a148706346771a6cf5174b751fe79edd (diff) | |
download | freeipa-2af96d1c0bd3b39dd9ab4ab2b35b924eed5c5d69.tar.gz freeipa-2af96d1c0bd3b39dd9ab4ab2b35b924eed5c5d69.tar.xz freeipa-2af96d1c0bd3b39dd9ab4ab2b35b924eed5c5d69.zip |
Fix regular expression for LOC records in DNS.
- Fractional parts of integers are not mandatory.
- Expressions containing only size or only size + horizontal precision
are allowed.
- N/S/W/E handling was fixed.
See RFC 1876 section 3 for details.
Reviewed-By: Petr Viktorin <pviktori@redhat.com>
Diffstat (limited to 'ipalib/plugins/dns.py')
-rw-r--r-- | ipalib/plugins/dns.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index caaeaf167..e7301a9f7 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -1136,14 +1136,19 @@ class LOCRecord(DNSRecord): See RFC 1876 for details""") def _get_part_values(self, value): - regex = re.compile(\ - r'(?P<d1>\d{1,2}\s+)(?P<m1>\d{1,2}\s+)?(?P<s1>\d{1,2}\.?\d{1,3}?\s+)?'\ - r'(?P<dir1>[N|S])\s+'\ - r'(?P<d2>\d{1,3}\s+)(?P<m2>\d{1,2}\s+)?(?P<s2>\d{1,2}\.?\d{1,3}?\s+)?'\ - r'(?P<dir2>[W|E])\s+'\ - r'(?P<alt>-?\d{1,8}\.?\d{1,2}?)m?\s*'\ - r'(?P<siz>\d{1,8}\.?\d{1,2}?)?m?\s*'\ - r'(?P<hp>\d{1,8}\.?\d{1,2}?)?m?\s*(?P<vp>\d{1,8}\.?\d{1,2}?)?m?\s*$') + regex = re.compile( + r'(?P<d1>\d{1,2}\s+)' + r'(?:(?P<m1>\d{1,2}\s+)' + r'(?P<s1>\d{1,2}(?:\.\d{1,3})?\s+)?)?' + r'(?P<dir1>[NS])\s+' + r'(?P<d2>\d{1,3}\s+)' + r'(?:(?P<m2>\d{1,2}\s+)' + r'(?P<s2>\d{1,2}(?:\.\d{1,3})?\s+)?)?' + r'(?P<dir2>[WE])\s+' + r'(?P<alt>-?\d{1,8}(?:\.\d{1,2})?)m?' + r'(?:\s+(?P<siz>\d{1,8}(?:\.\d{1,2})?)m?' + r'(?:\s+(?P<hp>\d{1,8}(?:\.\d{1,2})?)m?' + r'(?:\s+(?P<vp>\d{1,8}(?:\.\d{1,2})?)m?\s*)?)?)?$') m = regex.match(value) |