[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Tue Dec 7 21:20:01 MST 2010


The branch, master has been updated
       via  d7cd2ad s4-provision Always run slaptest to convert the config file
       via  87e2d68 s4-provision Add an invalid names check for 'domain == netbiosname'
      from  994bcf3 build: fix hpux build pb

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit d7cd2ad4383ea6eff73e9cb2135ca5e3eda70a6d
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Dec 4 13:47:05 2010 +1100

    s4-provision Always run slaptest to convert the config file
    
    If the directory exists, it does not mean that it is configured - we
    may be on a re-run of the provision.
    
    Andrew Bartlett
    
    Autobuild-User: Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date: Wed Dec  8 05:19:12 CET 2010 on sn-devel-104

commit 87e2d68305570ab024f801d0c063e07f076cc46f
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Dec 4 12:34:44 2010 +1100

    s4-provision Add an invalid names check for 'domain == netbiosname'
    
    (This is also invalid)
    
    Andrew Bartlett

-----------------------------------------------------------------------

Summary of changes:
 .../scripting/python/samba/provision/__init__.py   |    5 +++-
 .../scripting/python/samba/provision/backend.py    |   26 ++++++++++----------
 2 files changed, 17 insertions(+), 14 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/scripting/python/samba/provision/__init__.py b/source4/scripting/python/samba/provision/__init__.py
index 7f19699..3e402b2 100644
--- a/source4/scripting/python/samba/provision/__init__.py
+++ b/source4/scripting/python/samba/provision/__init__.py
@@ -515,6 +515,9 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None,
 
         if domaindn is None:
             domaindn = "DC=" + dnsdomain.replace(".", ",DC=")
+
+        if domain == netbiosname:
+            raise ProvisioningError("guess_names: Domain '%s' must not be equal to short host name '%s'!" % (domain, netbiosname))
     else:
         domain = netbiosname
         if domaindn is None:
@@ -525,7 +528,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None,
 
     if hostname.upper() == realm:
         raise ProvisioningError("guess_names: Realm '%s' must not be equal to hostname '%s'!" % (realm, hostname))
-    if netbiosname == realm:
+    if netbiosname.upper() == realm:
         raise ProvisioningError("guess_names: Realm '%s' must not be equal to netbios hostname '%s'!" % (realm, netbiosname))
     if domain == realm:
         raise ProvisioningError("guess_names: Realm '%s' must not be equal to short domain name '%s'!" % (realm, domain))
diff --git a/source4/scripting/python/samba/provision/backend.py b/source4/scripting/python/samba/provision/backend.py
index 809dd4f..34f64e3 100644
--- a/source4/scripting/python/samba/provision/backend.py
+++ b/source4/scripting/python/samba/provision/backend.py
@@ -540,29 +540,29 @@ class OpenLDAPBackend(LDAPBackend):
         # DN and simple bind
         self.credentials.set_username("samba-admin")
 
+        # Wipe the old sam.ldb databases away
+        shutil.rmtree(self.olcdir, True)
+        os.makedirs(self.olcdir, 0770)
+
         # If we were just looking for crashes up to this point, it's a
         # good time to exit before we realise we don't have OpenLDAP on
         # this system
         if self.ldap_dryrun_mode:
             sys.exit(0)
 
-        # Finally, convert the configuration into cn=config style!
-        if not os.path.isdir(self.olcdir):
-            os.makedirs(self.olcdir, 0770)
-
-            slapd_cmd = [self.slapd_path, "-Ttest", "-n", "0", "-f",
+        slapd_cmd = [self.slapd_path, "-Ttest", "-n", "0", "-f",
                          self.slapdconf, "-F", self.olcdir]
-            retcode = subprocess.call(slapd_cmd, close_fds=True, shell=False)
+        retcode = subprocess.call(slapd_cmd, close_fds=True, shell=False)
 
-            if retcode != 0:
-                self.logger.error("conversion from slapd.conf to cn=config failed slapd started with: %s" %  "\'" + "\' \'".join(slapd_cmd) + "\'")
-                raise ProvisioningError("conversion from slapd.conf to cn=config failed")
+        if retcode != 0:
+            self.logger.error("conversion from slapd.conf to cn=config failed slapd started with: %s" %  "\'" + "\' \'".join(slapd_cmd) + "\'")
+            raise ProvisioningError("conversion from slapd.conf to cn=config failed")
 
-            if not os.path.exists(os.path.join(self.olcdir, "cn=config.ldif")):
-                raise ProvisioningError("conversion from slapd.conf to cn=config failed")
+        if not os.path.exists(os.path.join(self.olcdir, "cn=config.ldif")):
+            raise ProvisioningError("conversion from slapd.conf to cn=config failed")
 
-            # Don't confuse the admin by leaving the slapd.conf around
-            os.remove(self.slapdconf)
+        # Don't confuse the admin by leaving the slapd.conf around
+        os.remove(self.slapdconf)
 
 
 class FDSBackend(LDAPBackend):


-- 
Samba Shared Repository


More information about the samba-cvs mailing list