Author: abartlet
Date: 2006-10-13 01:35:52 +0000 (Fri, 13 Oct 2006)
New Revision: 19258

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19258

Log:
Don't delete the contents of the partitions twice, and in particular
don't delete their contents until we have specified the new partition
locations.

However, preserve the important part of tridge's change, that is to
ensure that no database index is present when the mass delete occours.
In my testing, it is best to leave the index until the provision is
compleated.

Andrew Bartlett

Added:
   branches/SAMBA_4_0/source/setup/provision_index.ldif
Modified:
   branches/SAMBA_4_0/source/scripting/libjs/provision.js
   branches/SAMBA_4_0/source/setup/provision_init.ldif


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/libjs/provision.js
===================================================================
--- branches/SAMBA_4_0/source/scripting/libjs/provision.js      2006-10-12 
21:03:28 UTC (rev 19257)
+++ branches/SAMBA_4_0/source/scripting/libjs/provision.js      2006-10-13 
01:35:52 UTC (rev 19258)
@@ -157,25 +157,8 @@
 */
 function ldb_erase(ldb)
 {
-       var attrs = new Array("namingContexts");
        var res;
 
-       /* delete within each naming context - this copes with existing 
partitions */
-       res = ldb.search("objectClass=*", "", ldb.SCOPE_BASE, attrs);
-       if (typeof(res) != "undefined") {
-               if (res.length > 0) {
-                       var names = res[0].namingContexts;
-                       for (i=0;i<names.length;i++) {
-                               attrs = new Array("dn");
-                               res = ldb.search("(objectclass=*)", names[i], 
ldb.SCOPE_SUBTREE, attrs);
-                               var j;
-                               for (j=0;j<res.length;j++) {
-                                       ldb.del(res[j].dn);
-                               }
-                       }
-               }
-       }
-
        /* delete the specials */
        ldb.del("@INDEXLIST");
        ldb.del("@ATTRIBUTES");
@@ -528,6 +511,9 @@
        setup_add_ldif("provision.ldif", info, samdb, false);
 
        if (blank != false) {
+               message("Setting up sam.ldb index\n");
+               setup_add_ldif("provision_index.ldif", info, samdb, false);
+
                var commit_ok = samdb.transaction_commit();
                if (!commit_ok) {
                        info.message("ldb commit failed: " + samdb.errstring() 
+ "\n");
@@ -543,6 +529,9 @@
                return false;
        }
 
+       message("Setting up sam.ldb index\n");
+       setup_add_ldif("provision_index.ldif", info, samdb, false);
+
        var commit_ok = samdb.transaction_commit();
        if (!commit_ok) {
                info.message("samdb commit failed: " + samdb.errstring() + 
"\n");

Added: branches/SAMBA_4_0/source/setup/provision_index.ldif
===================================================================
--- branches/SAMBA_4_0/source/setup/provision_index.ldif        2006-10-12 
21:03:28 UTC (rev 19257)
+++ branches/SAMBA_4_0/source/setup/provision_index.ldif        2006-10-13 
01:35:52 UTC (rev 19258)
@@ -0,0 +1,16 @@
+dn: @INDEXLIST
[EMAIL PROTECTED]: name
[EMAIL PROTECTED]: sAMAccountName
[EMAIL PROTECTED]: objectSid
[EMAIL PROTECTED]: objectCategory
[EMAIL PROTECTED]: member
[EMAIL PROTECTED]: uidNumber
[EMAIL PROTECTED]: gidNumber
[EMAIL PROTECTED]: unixName
[EMAIL PROTECTED]: privilege
[EMAIL PROTECTED]: nCName
[EMAIL PROTECTED]: lDAPDisplayName
[EMAIL PROTECTED]: subClassOf
[EMAIL PROTECTED]: dnsRoot
[EMAIL PROTECTED]: nETBIOSName
+

Modified: branches/SAMBA_4_0/source/setup/provision_init.ldif
===================================================================
--- branches/SAMBA_4_0/source/setup/provision_init.ldif 2006-10-12 21:03:28 UTC 
(rev 19257)
+++ branches/SAMBA_4_0/source/setup/provision_init.ldif 2006-10-13 01:35:52 UTC 
(rev 19258)
@@ -1,19 +1,3 @@
-dn: @INDEXLIST
[EMAIL PROTECTED]: name
[EMAIL PROTECTED]: sAMAccountName
[EMAIL PROTECTED]: objectSid
[EMAIL PROTECTED]: objectCategory
[EMAIL PROTECTED]: member
[EMAIL PROTECTED]: uidNumber
[EMAIL PROTECTED]: gidNumber
[EMAIL PROTECTED]: unixName
[EMAIL PROTECTED]: privilege
[EMAIL PROTECTED]: nCName
[EMAIL PROTECTED]: lDAPDisplayName
[EMAIL PROTECTED]: subClassOf
[EMAIL PROTECTED]: dnsRoot
[EMAIL PROTECTED]: nETBIOSName
-
 dn: @ATTRIBUTES
 userPrincipalName: CASE_INSENSITIVE
 servicePrincipalName: CASE_INSENSITIVE

Reply via email to