summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-08-04 09:59:01 +0200
committerMartin Kosek <mkosek@redhat.com>2011-08-08 17:48:25 +0200
commit31e4801f30f3ede1c713c35d8d2672b1a9bc4d2c (patch)
tree023c09d1827afd3e9cbab6b9c08d632dc447d7c1 /ipalib/plugins
parent08905eb9a9039b38c032275a87b4f5602e5a63dd (diff)
downloadfreeipa-31e4801f30f3ede1c713c35d8d2672b1a9bc4d2c.zip
freeipa-31e4801f30f3ede1c713c35d8d2672b1a9bc4d2c.tar.gz
freeipa-31e4801f30f3ede1c713c35d8d2672b1a9bc4d2c.tar.xz
Improve dnszone-add error message
Check that NS address passed in dnszone-add is a domain name and not an IP address. Make this clear also the parameter help. https://fedorahosted.org/freeipa/ticket/1567
Diffstat (limited to 'ipalib/plugins')
-rw-r--r--ipalib/plugins/dns.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/ipalib/plugins/dns.py b/ipalib/plugins/dns.py
index d50a9f6..105678b 100644
--- a/ipalib/plugins/dns.py
+++ b/ipalib/plugins/dns.py
@@ -109,6 +109,7 @@ from ipalib import Flag, Int, List, Str, StrEnum
from ipalib.plugins.baseldap import *
from ipalib import _, ngettext
from ipapython import dnsclient
+from ipapython.ipautil import valid_ip
from ldap import explode_dn
# supported resource record types
@@ -318,7 +319,7 @@ class dnszone(LDAPObject):
Str('idnssoamname',
cli_name='name_server',
label=_('Authoritative nameserver'),
- doc=_('Authoritative nameserver.'),
+ doc=_('Authoritative nameserver domain name'),
),
Str('idnssoarname',
cli_name='admin_email',
@@ -431,6 +432,11 @@ class dnszone_add(LDAPCreate):
# Check nameserver has a forward record
nameserver = entry_attrs['idnssoamname']
+ # NS record must contain domain name
+ if valid_ip(nameserver):
+ raise errors.ValidationError(name='name-server',
+ error=unicode(_("Nameserver address is not a fully qualified domain name")))
+
if not 'ip_address' in options and not options['force']:
is_ns_rec_resolvable(nameserver)