[SCM] Samba Shared Repository - branch master updated - release-4-0-0alpha8-1039-ge349316

Andrew Bartlett abartlet at samba.org
Sun Aug 16 19:49:16 MDT 2009


The branch, master has been updated
       via  e349316550fefcb7d991adfe66d5118baac24a01 (commit)
       via  5f917d5f177401edbe0c11fd98f2e9203136de32 (commit)
       via  148290a8099153cfb8572c2ce3acec614f3fbf25 (commit)
      from  f890dba084062b1fc52f4eae249b5fb6c16e69eb (commit)

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


- Log -----------------------------------------------------------------
commit e349316550fefcb7d991adfe66d5118baac24a01
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Aug 17 11:41:58 2009 +1000

    s4:provision Add comments to the provision script
    
    Hopefully this will explain a bit more whey things are done the way
    that they are done.
    
    Andrew Bartlett

commit 5f917d5f177401edbe0c11fd98f2e9203136de32
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Aug 17 11:33:25 2009 +1000

    s4:provision Avoid one more call to ltdb_reindex
    
    The Samba4 schema code (called via
    samdb.set_schema_from_ldb(schema.ldb)) manages the @ATTRIBUTES and
    @INDEXLIST records, so don't wipe them early.  The chances are that we
    will not change them anyway.
    
    Andrew Bartlett

commit 148290a8099153cfb8572c2ce3acec614f3fbf25
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Aug 17 11:20:29 2009 +1000

    s4:ldb Remove obsolete comment about ldb_tdb's sequence num

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

Summary of changes:
 source4/lib/ldb/ldb_tdb/ldb_tdb.h           |    2 --
 source4/scripting/python/samba/__init__.py  |   19 ++++++++++++++++---
 source4/scripting/python/samba/provision.py |   17 +++++++++++++----
 3 files changed, 29 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.h b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
index 370cd07..75034dc 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.h
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.h
@@ -8,8 +8,6 @@ struct ltdb_private {
 	TDB_CONTEXT *tdb;
 	unsigned int connect_flags;
 	
-	/* a double is used for portability and ease of string
-	   handling. It has plenty of digits of precision */
 	unsigned long long sequence_number;
 
 	/* the low level tdb seqnum - used to avoid loading BASEINFO when
diff --git a/source4/scripting/python/samba/__init__.py b/source4/scripting/python/samba/__init__.py
index 097d96a..ad75f5f 100644
--- a/source4/scripting/python/samba/__init__.py
+++ b/source4/scripting/python/samba/__init__.py
@@ -119,8 +119,8 @@ class Ldb(ldb.Ldb):
         assert len(values) == 1
         return self.schema_format_value(attribute, values.pop())
 
-    def erase(self):
-        """Erase this ldb, removing all records."""
+    def erase_except_schema_controlled(self):
+        """Erase this ldb, removing all records, except those that are controlled by Samba4's schema."""
         basedn = ""
         # Delete the 'visible' records
         for msg in self.search(basedn, ldb.SCOPE_SUBTREE, 
@@ -136,7 +136,7 @@ class Ldb(ldb.Ldb):
         assert len(res) == 0
 
         # delete the specials
-        for attr in ["@INDEXLIST", "@ATTRIBUTES", "@SUBCLASSES", "@MODULES", 
+        for attr in ["@SUBCLASSES", "@MODULES", 
                      "@OPTIONS", "@PARTITION", "@KLUDGEACL"]:
             try:
                 self.delete(attr)
@@ -144,6 +144,19 @@ class Ldb(ldb.Ldb):
                 # Ignore missing dn errors
                 pass
 
+    def erase(self):
+        """Erase this ldb, removing all records."""
+        
+        self.erase_except_schema_controlled()
+
+        # delete the specials
+        for attr in ["@INDEXLIST", "@ATTRIBUTES"]:
+            try:
+                self.delete(attr)
+            except ldb.LdbError, (ldb.ERR_NO_SUCH_OBJECT, _):
+                # Ignore missing dn errors
+                pass
+
     def erase_partitions(self):
         """Erase an ldb, removing all records."""
 
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index da1625f..c029bea 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -3,7 +3,7 @@
 # backend code for provisioning a Samba4 server
 
 # Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2007-2008
-# Copyright (C) Andrew Bartlett <abartlet at samba.org> 2008
+# Copyright (C) Andrew Bartlett <abartlet at samba.org> 2008-2009
 # Copyright (C) Oliver Liebel <oliver at itc.li> 2008-2009
 #
 # Based on the original in EJS:
@@ -525,13 +525,13 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
         samdb = Ldb(url=samdb_path, session_info=session_info, 
                       credentials=credentials, lp=lp, options=["modules:"])
         # Wipes the database
-        samdb.erase()
+        samdb.erase_except_schema_controlled()
     except LdbError:
         os.unlink(samdb_path)
         samdb = Ldb(url=samdb_path, session_info=session_info, 
                       credentials=credentials, lp=lp, options=["modules:"])
          # Wipes the database
-        samdb.erase()
+        samdb.erase_except_schema_controlled()
         
 
     #Add modules to the list to activate them by default
@@ -835,10 +835,18 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
     samdb.transaction_start()
     try:
         message("Erasing data from partitions")
-        # Load the schema (again).  This time it will force a reindex, to make the below computationally sane
+        # Load the schema (again).  This time it will force a reindex,
+        # and will therefore make the erase_partitions() below
+        # computationally sane
         samdb.set_schema_from_ldb(schema.ldb)
         samdb.erase_partitions()
     
+        # Set the domain functionality levels onto the database.
+        # Various module (the password_hash module in particular) need
+        # to know what level of AD we are emulating.
+
+        # These will be fixed into the database via the database
+        # modifictions below, but we need them set from the start.
         samdb.set_opaque_integer("domainFunctionality", domainFunctionality)
         samdb.set_opaque_integer("forestFunctionality", forestFunctionality)
         samdb.set_opaque_integer("domainControllerFunctionality", domainControllerFunctionality)
@@ -888,6 +896,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
             "SCHEMADN": names.schemadn,
             })
 
+        # The LDIF here was created when the Schema object was constructed
         message("Setting up sam.ldb schema")
         samdb.add_ldif(schema.schema_dn_add)
         samdb.modify_ldif(schema.schema_dn_modify)


-- 
Samba Shared Repository


More information about the samba-cvs mailing list