s4:provision Prevent some invalid combinations of realm and domain
authorAndrew Bartlett <abartlet@samba.org>
Tue, 15 Sep 2009 05:37:11 +0000 (22:37 -0700)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 15 Sep 2009 05:41:09 +0000 (22:41 -0700)
We don't do well (even just trying to create duplicate
servicePrincipalName values) with some of these combinations, so kill
it off early before the administrator thinks it's going to work.

Andrew Bartlett

source4/scripting/python/samba/provision.py

index e21a3cbee17e26730fd1ddc491c18aa89c297994..8f7859c2159482148c725fb5916cdb89ec5b115e 100644 (file)
@@ -421,6 +421,15 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None,
     if not valid_netbios_name(domain):
         raise InvalidNetbiosName(domain)
         
+    if netbiosname.upper() == realm.upper():
+        raise Exception("realm %s must not be equal to netbios domain name %s", realm, netbiosname)
+        
+    if hostname.upper() == realm.upper():
+        raise Exception("realm %s must not be equal to hostname %s", realm, hostname)
+        
+    if domain.upper() == realm.upper():
+        raise Exception("realm %s must not be equal to domain name %s", realm, domain)
+
     if rootdn is None:
        rootdn = domaindn