mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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>
This commit is contained in:
parent
96003a45a1
commit
2af96d1c0b
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user