diff options
author | Martin Kosek <mkosek@redhat.com> | 2011-11-23 16:03:51 +0100 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-11-29 17:14:28 +0100 |
commit | 3f0eb1417ca0162861a05e3ced6a532b3cfba2ab (patch) | |
tree | 5aad0cfa7025aea4c526f61390567a2ede6cd292 /ipalib/plugins/dns.py | |
parent | 1039653a1b51f095175eeee3380a59e7303585f6 (diff) | |
download | freeipa.git-3f0eb1417ca0162861a05e3ced6a532b3cfba2ab.tar.gz freeipa.git-3f0eb1417ca0162861a05e3ced6a532b3cfba2ab.tar.xz freeipa.git-3f0eb1417ca0162861a05e3ced6a532b3cfba2ab.zip |
Improve zonemgr validator and normalizer
The validator has been improved to support better both SOA format
(e-mail address in a domain name format, without '@') and standard
e-mail format. Allow '\.' character in a SOA format encoding the
standard '.' in the local-part of an e-mail. Normalization code
has been moved to one common function.
https://fedorahosted.org/freeipa/ticket/2053
Diffstat (limited to 'ipalib/plugins/dns.py')
-rw-r--r-- | ipalib/plugins/dns.py | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py index bfc8090c..e3522c90 100644 --- a/ipalib/plugins/dns.py +++ b/ipalib/plugins/dns.py @@ -27,7 +27,7 @@ from ipalib import Command from ipalib import Flag, Bool, Int, List, Str, StrEnum from ipalib.plugins.baseldap import * from ipalib import _, ngettext -from ipalib.util import validate_zonemgr, validate_hostname +from ipalib.util import validate_zonemgr, normalize_zonemgr, validate_hostname from ipapython import dnsclient from ipapython.ipautil import valid_ip from ldap import explode_dn @@ -152,13 +152,6 @@ def _rname_validator(ugettext, zonemgr): return unicode(e) return None -# normalizer for admin email -def _rname_normalizer(value): - value = value.replace('@', '.') - if not value.endswith('.'): - value += '.' - return value - def _create_zone_serial(**kwargs): """Generate serial number for zones.""" return int('%s01' % time.strftime('%Y%d%m')) @@ -678,7 +671,7 @@ class dnszone(LDAPObject): label=_('Administrator e-mail address'), doc=_('Administrator e-mail address'), default_from=lambda idnsname: 'root.%s' % idnsname, - normalizer=_rname_normalizer, + normalizer=normalize_zonemgr, ), Int('idnssoaserial?', cli_name='serial', |