[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Wed Mar 10 22:13:41 MST 2010


The branch, master has been updated
       via  6441a5b... Explain why we don't use certain characters in the generated pw
       via  a6253a4... lib/util - Removed curly braces from generate_random_password().
       via  ade9375... s4:provision - Updated FDS schema mapping.
       via  0271231... s4:provision Improve the handling of provision errors
      from  5954527... Try and fix bug #7233 - print fails with jobs >4GB from Win7 clients.

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


- Log -----------------------------------------------------------------
commit 6441a5b0b97973b834ba025f1762abe2b5c3f3c9
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Mar 11 15:34:01 2010 +1100

    Explain why we don't use certain characters in the generated pw

commit a6253a45c0733e81a8d2200d1d8892383bc00c31
Author: Endi S. Dewata <edewata at redhat.com>
Date:   Wed Mar 10 20:34:01 2010 -0600

    lib/util - Removed curly braces from generate_random_password().

commit ade93755d51e80374e4e6bc6bc501e3230988799
Author: Endi S. Dewata <edewata at redhat.com>
Date:   Tue Mar 9 19:12:30 2010 -0600

    s4:provision - Updated FDS schema mapping.

commit 027123199e13cc02ae4edadd8f0dd0f0660e1193
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Mar 11 14:49:34 2010 +1100

    s4:provision Improve the handling of provision errors
    
    The backtraces were too confusing for our users, and didn't tell them
    what to do to fix the problem.  By printing the string (rather than a
    backtrace), and including in the error what to do, and what file to
    remove, we give them a chance.
    
    Andrew Bartlett

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

Summary of changes:
 lib/util/genrand.c                                 |    8 +++-
 source4/scripting/python/samba/provision.py        |   22 +++++-----
 .../scripting/python/samba/provisionexceptions.py  |    6 ++-
 source4/setup/provision                            |   43 +++++++++++--------
 source4/setup/schema-map-fedora-ds-1.0             |   10 ++---
 5 files changed, 53 insertions(+), 36 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/genrand.c b/lib/util/genrand.c
index 02b8d8b..7fe55f3 100644
--- a/lib/util/genrand.c
+++ b/lib/util/genrand.c
@@ -368,7 +368,13 @@ again:
 _PUBLIC_ char *generate_random_password(TALLOC_CTX *mem_ctx, size_t min, size_t max)
 {
 	char *retstr;
-	const char *c_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_-#.,@$%&!?:;<=>(){}[]~";
+	/* This list does not include { or } because they cause
+	 * problems for our provision (it can create a substring
+	 * ${...}, and for Fedora DS (which treats {...} at the start
+	 * of a stored password as special 
+	 *  -- Andrew Bartlett 2010-03-11
+	 */
+	const char *c_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_-#.,@$%&!?:;<=>()[]~";
 	size_t len = max;
 	size_t diff;
 
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index bac234c..0a24837 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -330,34 +330,36 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None,
     if dnsdomain is None:
         dnsdomain = lp.get("realm")
         if dnsdomain is None or dnsdomain == "":
-            raise ProvisioningError("guess_names: 'realm' not specified in supplied smb.conf!")
+            raise ProvisioningError("guess_names: 'realm' not specified in supplied %s!", lp.configfile)
 
     dnsdomain = dnsdomain.lower()
 
     if serverrole is None:
         serverrole = lp.get("server role")
         if serverrole is None:
-            raise ProvisioningError("guess_names: 'server role' not specified in supplied smb.conf!")
+            raise ProvisioningError("guess_names: 'server role' not specified in supplied %s!" % lp.configfile)
 
     serverrole = serverrole.lower()
 
     realm = dnsdomain.upper()
 
+    if lp.get("realm") == "":
+        raise ProvisioningError("guess_names: 'realm =' was not specified in supplied %s.  Please remove the smb.conf file and let provision generate it" % lp.configfile)
+
     if lp.get("realm").upper() != realm:
-        raise ProvisioningError("guess_names: Realm '%s' in smb.conf must match chosen realm '%s'!", lp.get("realm").upper(), realm)
+        raise ProvisioningError("guess_names: 'realm=%s' in %s must match chosen realm '%s'!  Please remove the smb.conf file and let provision generate it" % (lp.get("realm").upper(), realm, lp.configfile))
 
     if lp.get("server role").lower() != serverrole:
-        raise ProvisioningError("guess_names: server role '%s' in smb.conf must match chosen server role '%s'!", lp.get("server role").upper(), serverrole)
+        raise ProvisioningError("guess_names: 'server role=%s' in %s must match chosen server role '%s'!  Please remove the smb.conf file and let provision generate it" % (lp.get("server role").upper(), serverrole, lp.configfile))
 
     if serverrole == "domain controller":
         if domain is None:
+            # This will, for better or worse, default to 'WORKGROUP'
             domain = lp.get("workgroup")
-        if domain is None:
-            raise ProvisioningError("guess_names: 'workgroup' not specified in supplied smb.conf!")
         domain = domain.upper()
 
         if lp.get("workgroup").upper() != domain:
-            raise ProvisioningError("guess_names: Workgroup '%s' in smb.conf must match chosen domain '%s'!", lp.get("workgroup").upper(), domain)
+            raise ProvisioningError("guess_names: Workgroup '%s' in %s must match chosen domain '%s'!  Please remove the %s file and let provision generate it" % (lp.get("workgroup").upper(), domain, lp.configfile))
 
         if domaindn is None:
             domaindn = "DC=" + dnsdomain.replace(".", ",DC=")
@@ -370,11 +372,11 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None,
         raise InvalidNetbiosName(domain)
         
     if hostname.upper() == realm:
-        raise ProvisioningError("guess_names: Realm '%s' must not be equal to hostname '%s'!", realm, hostname)
+        raise ProvisioningError("guess_names: Realm '%s' must not be equal to hostname '%s'!" % (realm, hostname))
     if netbiosname == realm:
-        raise ProvisioningError("guess_names: Realm '%s' must not be equal to netbios hostname '%s'!", realm, netbiosname)
+        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)
+        raise ProvisioningError("guess_names: Realm '%s' must not be equal to short domain name '%s'!" % (realm, domain))
 
     if rootdn is None:
        rootdn = domaindn
diff --git a/source4/scripting/python/samba/provisionexceptions.py b/source4/scripting/python/samba/provisionexceptions.py
index 604853f..6159a02 100644
--- a/source4/scripting/python/samba/provisionexceptions.py
+++ b/source4/scripting/python/samba/provisionexceptions.py
@@ -25,8 +25,12 @@
 
 class ProvisioningError(Exception):
     """A generic provision error."""
+    def __init__(self, value):
+        self.value = value
+    def __str__(self):
+        return "ProvisioningError: " + self.value
 
-class InvalidNetbiosName(Exception):
+class InvalidNetbiosName(ProvisioningError):
     """A specified name was not a valid NetBIOS name."""
     def __init__(self, name):
         super(InvalidNetbiosName, self).__init__("The name '%r' is not a valid NetBIOS name" % name)
diff --git a/source4/setup/provision b/source4/setup/provision
index 2b31c4c..66aab7e 100755
--- a/source4/setup/provision
+++ b/source4/setup/provision
@@ -37,6 +37,7 @@ from samba.auth import system_session
 import samba.getopt as options
 from samba.provision import provision, FILL_FULL, FILL_NT4SYNC, FILL_DRS, find_setup_dir
 from samba import DS_DOMAIN_FUNCTION_2003, DS_DOMAIN_FUNCTION_2008, DS_DOMAIN_FUNCTION_2008_R2
+from samba.provisionexceptions import ProvisioningError
 
 # how do we make this case insensitive??
 
@@ -225,21 +226,27 @@ elif opts.use_xattrs == "auto":
 
 
 session = system_session()
-provision(setup_dir, message, 
-          session, creds, smbconf=smbconf, targetdir=opts.targetdir,
-          samdb_fill=samdb_fill, realm=opts.realm, domain=opts.domain,
-          domainguid=opts.domain_guid, domainsid=opts.domain_sid,
-          policyguid=opts.policy_guid, policyguid_dc=opts.policy_guid_dc,
-          hostname=opts.host_name,
-          hostip=opts.host_ip, hostip6=opts.host_ip6,
-          ntdsguid=opts.ntds_guid,
-          invocationid=opts.invocationid, adminpass=opts.adminpass,
-          krbtgtpass=opts.krbtgtpass, machinepass=opts.machinepass,
-          dnspass=opts.dnspass, root=opts.root, nobody=opts.nobody,
-          wheel=opts.wheel, users=opts.users,
-          serverrole=server_role, dom_for_fun_level=dom_for_fun_level,
-          ldap_backend_extra_port=opts.ldap_backend_extra_port, 
-          backend_type=opts.ldap_backend_type,
-          ldapadminpass=opts.ldapadminpass, ol_mmr_urls=opts.ol_mmr_urls,
-          slapd_path=opts.slapd_path, setup_ds_path=opts.setup_ds_path,
-          nosync=opts.nosync,ldap_dryrun_mode=opts.ldap_dryrun_mode,useeadb=eadb)
+try:
+	provision(setup_dir, message, 
+		  session, creds, smbconf=smbconf, targetdir=opts.targetdir,
+		  samdb_fill=samdb_fill, realm=opts.realm, domain=opts.domain,
+		  domainguid=opts.domain_guid, domainsid=opts.domain_sid,
+		  policyguid=opts.policy_guid, policyguid_dc=opts.policy_guid_dc,
+		  hostname=opts.host_name,
+		  hostip=opts.host_ip, hostip6=opts.host_ip6,
+		  ntdsguid=opts.ntds_guid,
+		  invocationid=opts.invocationid, adminpass=opts.adminpass,
+		  krbtgtpass=opts.krbtgtpass, machinepass=opts.machinepass,
+		  dnspass=opts.dnspass, root=opts.root, nobody=opts.nobody,
+		  wheel=opts.wheel, users=opts.users,
+		  serverrole=server_role, dom_for_fun_level=dom_for_fun_level,
+		  ldap_backend_extra_port=opts.ldap_backend_extra_port, 
+		  backend_type=opts.ldap_backend_type,
+		  ldapadminpass=opts.ldapadminpass, ol_mmr_urls=opts.ol_mmr_urls,
+		  slapd_path=opts.slapd_path, setup_ds_path=opts.setup_ds_path,
+		  nosync=opts.nosync,ldap_dryrun_mode=opts.ldap_dryrun_mode,useeadb=eadb)
+except ProvisioningError as e:
+	print str(e)
+	exit(1)
+
+	
diff --git a/source4/setup/schema-map-fedora-ds-1.0 b/source4/setup/schema-map-fedora-ds-1.0
index 34d48a0..7dd3050 100644
--- a/source4/setup/schema-map-fedora-ds-1.0
+++ b/source4/setup/schema-map-fedora-ds-1.0
@@ -41,19 +41,17 @@ sambaConfigOption
 #This large integer format is unimplemented in OpenLDAP 2.3
 1.2.840.113556.1.4.906:1.3.6.1.4.1.1466.115.121.1.27
 #This case insensitive string isn't available
-1.2.840.113556.1.4.905:1.3.6.1.4.1.1466.115.121.1.15
+1.2.840.113556.1.4.905:1.3.6.1.4.1.1466.115.121.1.44
 #Treat Security Descriptors as binary
 1.2.840.113556.1.4.907:1.3.6.1.4.1.1466.115.121.1.40
-#NumbericString is not supported in Fedora DS 1.0, map to a directory string
-1.3.6.1.4.1.1466.115.121.1.36:1.3.6.1.4.1.1466.115.121.1.15
 #Treat Object(DN-Binary) as a binary blob
 1.2.840.113556.1.4.903:1.3.6.1.4.1.1466.115.121.1.40
-#Printable String as IA5 String
-1.3.6.1.4.1.1466.115.121.1.44:1.3.6.1.4.1.1466.115.121.1.26
 #UTC Time as Generalized Time
 1.3.6.1.4.1.1466.115.121.1.53:1.3.6.1.4.1.1466.115.121.1.24
 #DN with String as Directory String
-1.2.840.113556.1.4.904:1.3.6.1.4.1.1466.115.121.1.15
+1.2.840.113556.1.4.904:1.3.6.1.4.1.1466.115.121.1.40
+#attribute names, declared at OIDs fail
+1.3.6.1.4.1.1466.115.121.1.38:1.3.6.1.4.1.1466.115.121.1.44
 #Presentation Address as Directory String
 1.3.6.1.4.1.1466.115.121.1.43:1.3.6.1.4.1.1466.115.121.1.15
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list