[SCM] Samba Shared Repository - branch v4-0-test updated - release-4-0-0alpha5-215-gcbac27e

Jelmer Vernooij jelmer at samba.org
Fri Aug 1 18:48:04 GMT 2008


The branch, v4-0-test has been updated
       via  cbac27e6faa99ebaa3e6d653017c968db836560a (commit)
       via  783412ecb27d646b171993da0ac2f11a821901d3 (commit)
      from  c87a8ba1fef1ba508ad6527d0bae4bcdd5b3cb69 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit cbac27e6faa99ebaa3e6d653017c968db836560a
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Aug 1 20:47:22 2008 +0200

    Move domain DN determination out of newuser function.

commit 783412ecb27d646b171993da0ac2f11a821901d3
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Fri Aug 1 20:47:03 2008 +0200

    Actually fix missing substitution variables.

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

Summary of changes:
 source/scripting/python/samba/provision.py |   14 ++++++++++----
 source/scripting/python/samba/samdb.py     |   15 +++++++++------
 2 files changed, 19 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/scripting/python/samba/provision.py b/source/scripting/python/samba/provision.py
index 6b1fd33..6dd9f3b 100644
--- a/source/scripting/python/samba/provision.py
+++ b/source/scripting/python/samba/provision.py
@@ -739,7 +739,8 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
         samdb.set_invocation_id(invocationid)
 
     load_schema(setup_path, samdb, names.schemadn, names.netbiosname, 
-                names.configdn, names.sitename)
+                names.configdn, names.sitename, names.serverdn,
+                names.hostname)
 
     samdb.transaction_start()
         
@@ -1423,7 +1424,8 @@ def create_krb5_conf(path, setup_path, dnsdomain, hostname, realm):
         })
 
 
-def load_schema(setup_path, samdb, schemadn, netbiosname, configdn, sitename):
+def load_schema(setup_path, samdb, schemadn, netbiosname, configdn, sitename,
+                serverdn, servername):
     """Load schema for the SamDB.
     
     :param samdb: Load a schema into a SamDB.
@@ -1431,6 +1433,8 @@ def load_schema(setup_path, samdb, schemadn, netbiosname, configdn, sitename):
     :param schemadn: DN of the schema
     :param netbiosname: NetBIOS name of the host.
     :param configdn: DN of the configuration
+    :param serverdn: DN of the server
+    :param servername: Host name of the server
     """
     schema_data = open(setup_path("schema.ldif"), 'r').read()
     schema_data += open(setup_path("schema_samba4.ldif"), 'r').read()
@@ -1444,8 +1448,10 @@ def load_schema(setup_path, samdb, schemadn, netbiosname, configdn, sitename):
                     "SCHEMADN": schemadn,
                     "NETBIOSNAME": netbiosname,
                     "CONFIGDN": configdn,
-                    "DEFAULTSITE":sitename,
-                    "PREFIXMAP_B64":prefixmap
+                    "DEFAULTSITE": sitename,
+                    "PREFIXMAP_B64": prefixmap,
+                    "SERVERDN": serverdn,
+                    "SERVERNAME": servername,
     })
     check_all_substituted(head_data)
     samdb.attach_schema_from_ldif(head_data, schema_data)
diff --git a/source/scripting/python/samba/samdb.py b/source/scripting/python/samba/samdb.py
index c47cf4a..c7d93d6 100644
--- a/source/scripting/python/samba/samdb.py
+++ b/source/scripting/python/samba/samdb.py
@@ -86,6 +86,14 @@ userAccountControl: %u
 """ % (user_dn, userAccountControl)
         self.modify_ldif(mod)
 
+    def domain_dn(self):
+        # find the DNs for the domain and the domain users group
+        res = self.search("", scope=ldb.SCOPE_BASE, 
+                          expression="(defaultNamingContext=*)", 
+                          attrs=["defaultNamingContext"])
+        assert(len(res) == 1 and res[0]["defaultNamingContext"] is not None)
+        return res[0]["defaultNamingContext"][0]
+
     def newuser(self, username, unixname, password):
         """add a new user record.
         
@@ -96,12 +104,7 @@ userAccountControl: %u
         # connect to the sam 
         self.transaction_start()
 
-        # find the DNs for the domain and the domain users group
-        res = self.search("", scope=ldb.SCOPE_BASE, 
-                          expression="(defaultNamingContext=*)", 
-                          attrs=["defaultNamingContext"])
-        assert(len(res) == 1 and res[0]["defaultNamingContext"] is not None)
-        domain_dn = res[0]["defaultNamingContext"][0]
+        domain_dn = self.domain_dn()
         assert(domain_dn is not None)
         user_dn = "CN=%s,CN=Users,%s" % (username, domain_dn)
 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list