Admin e-mail validator currently requires an email to be in
a second-level domain (hostmas...@example.com). This is too
restrictive. Top level domain e-mails (hostmaster@testrelm)
should also be allowed.

This patch also fixes default zonemgr value in help texts and man
pages.

https://fedorahosted.org/freeipa/ticket/2272

>From 9cbea8af4291b10887e67caf358cb96d9b13fff0 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Fri, 20 Jan 2012 11:43:53 +0100
Subject: [PATCH] Ease zonemgr restrictions

Admin e-mail validator currently requires an email to be in
a second-level domain (hostmas...@example.com). This is too
restrictive. Top level domain e-mails (hostmaster@testrelm)
should also be allowed.

This patch also fixes default zonemgr value in help texts and man
pages.

https://fedorahosted.org/freeipa/ticket/2272
---
 install/tools/ipa-dns-install          |    2 +-
 install/tools/ipa-server-install       |    2 +-
 install/tools/man/ipa-dns-install.1    |    2 +-
 install/tools/man/ipa-server-install.1 |    2 +-
 ipalib/util.py                         |    9 +++------
 5 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/install/tools/ipa-dns-install b/install/tools/ipa-dns-install
index 5c02c20c05dd74cf8a4134e510114a54b5259031..fa08ae9521061ca0bf3f6e37bfd8e448bd8b3a8c 100755
--- a/install/tools/ipa-dns-install
+++ b/install/tools/ipa-dns-install
@@ -51,7 +51,7 @@ def parse_options():
                       default=False, help="Do not create reverse DNS zone")
     parser.add_option("--zonemgr", action="callback", callback=bindinstance.zonemgr_callback,
                       type="string",
-                      help="DNS zone manager e-mail address. Defaults to root")
+                      help="DNS zone manager e-mail address. Defaults to hostmaster@DOMAIN")
     parser.add_option("--zone-notif", dest="zone_notif",
                       action="store_true", default=False,
                       help="Let name server receive notification when a new zone is added." \
diff --git a/install/tools/ipa-server-install b/install/tools/ipa-server-install
index b91343850c016428b059faefa1d36de1ff10fe51..cc66e6ccf06b52c9926fde2e27eac9530b73529c 100755
--- a/install/tools/ipa-server-install
+++ b/install/tools/ipa-server-install
@@ -187,7 +187,7 @@ def parse_options():
                       default=False, help="Do not create reverse DNS zone")
     dns_group.add_option("--zonemgr", action="callback", callback=bindinstance.zonemgr_callback,
                       type="string",
-                      help="DNS zone manager e-mail address. Defaults to root")
+                      help="DNS zone manager e-mail address. Defaults to hostmaster@DOMAIN")
     dns_group.add_option("--zone-notif", dest="zone_notif",
                       action="store_true", default=False,
                       help="Let name server receive notification when a new zone is added." \
diff --git a/install/tools/man/ipa-dns-install.1 b/install/tools/man/ipa-dns-install.1
index adcab95e0dca9711cb6f3a8f45f62b3bdc26b58c..62042783e9e91ff2ad665823f9444b6fec8f610d 100644
--- a/install/tools/man/ipa-dns-install.1
+++ b/install/tools/man/ipa-dns-install.1
@@ -47,7 +47,7 @@ The reverse DNS zone to use
 Do not create reverse DNS zone
 .TP
 \fB\-\-zonemgr\fR
-The e\-mail address of the DNS zone manager. Defaults too root@host.domain
+The e\-mail address of the DNS zone manager. Defaults to hostmaster@DOMAIN
 .TP
 \fB\-\-zone\-notif\fR
 Let name server receive notifications when a new zone is added. New zone is then immediately loaded by the name server. This feature uses an LDAP Persistent Search mechanism to receive the data. Zone refresh is turned off when zone notifications are enabled.
diff --git a/install/tools/man/ipa-server-install.1 b/install/tools/man/ipa-server-install.1
index 6f1e59e75dfd016361dd5865ae99407b10b99a54..03685e2128ac136f40768f781998af01e4e7a7d9 100644
--- a/install/tools/man/ipa-server-install.1
+++ b/install/tools/man/ipa-server-install.1
@@ -137,7 +137,7 @@ The reverse DNS zone to use
 Do not create reverse DNS zone
 .TP
 \fB\-\-zonemgr\fR
-The e\-mail address of the DNS zone manager. Defaults to root@host.domain
+The e\-mail address of the DNS zone manager. Defaults to hostmaster@DOMAIN
 .TP
 \fB\-\-zone\-notif\fR
 Let name server receive notifications when a new zone is added. New zone is then immediately loaded by the name server. This feature uses an LDAP Persistent Search mechanism to receive the data. Zone refresh is turned off when zone notifications are enabled.
diff --git a/ipalib/util.py b/ipalib/util.py
index da933a86a45400ec95ca522e300e346045c281fa..c407751bd7c47a54b2567763f657a000302e8f0b 100644
--- a/ipalib/util.py
+++ b/ipalib/util.py
@@ -230,6 +230,8 @@ def validate_zonemgr(zonemgr):
         local_part, dot, domain = zonemgr.partition('@')
         if not regex_local_part.match(local_part):
             raise ValueError(local_part_errmsg)
+        if not domain:
+            raise ValueError(_('missing address domain'))
     elif zonemgr.count('@') > 1:
         raise ValueError(_('too many \'@\' characters'))
     else:
@@ -237,8 +239,7 @@ def validate_zonemgr(zonemgr):
         if last_fake_sep != -1: # there is a 'fake' local-part/domain separator
             sep = zonemgr.find('.', last_fake_sep+2)
             if sep == -1:
-                raise ValueError(_('address domain is not fully qualified ' \
-                          '("example.com" instead of just "example")'))
+                raise ValueError(_('missing address domain'))
             local_part = zonemgr[:sep]
             domain = zonemgr[sep+1:]
 
@@ -250,10 +251,6 @@ def validate_zonemgr(zonemgr):
             if not regex_local_part.match(local_part):
                 raise ValueError(local_part_errmsg)
 
-    if '.' not in domain:
-        raise ValueError(_('address domain is not fully qualified ' \
-                          '("example.com" instead of just "example")'))
-
     if not all(regex_domain.match(part) for part in domain.split(".")):
         raise ValueError(_('domain name may only include letters, numbers, and -'))
 
-- 
1.7.7.5

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to