diff options
author | Andrew Tridgell <tridge@samba.org> | 2006-10-12 08:32:58 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:20:58 -0500 |
commit | 151e30e18aea131291bc53f167378192165bb89c (patch) | |
tree | 0102acd91654a404a9dec6d253ba0c55fedd7ab5 /source4/scripting/libjs | |
parent | 49eb5dc142d4958f373692657b1affe4ae419735 (diff) | |
download | samba-151e30e18aea131291bc53f167378192165bb89c.tar.gz samba-151e30e18aea131291bc53f167378192165bb89c.tar.bz2 samba-151e30e18aea131291bc53f167378192165bb89c.zip |
r19252: - fixed 'erase' argument to setup_ldb()
- when wiping a ldb, wipe within each naming context first. By not
wiping the naming contexts we didn't wipe the partitions, which
caused a massive slowdown in re-provisioning due to re-indexing of
the schema.
(This used to be commit b62437214cf7c98c81598c4f37c91ab284928dbb)
Diffstat (limited to 'source4/scripting/libjs')
-rw-r--r-- | source4/scripting/libjs/provision.js | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index c20453a74d..e020cc41bd 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -157,7 +157,24 @@ function ldb_delete(ldb) */ function ldb_erase(ldb) { - var attrs = new Array("dn"); + 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"); @@ -168,6 +185,7 @@ function ldb_erase(ldb) ldb.del("@KLUDGEACL"); /* and the rest */ + attrs = new Array("dn"); var basedn = ""; var res = ldb.search("(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs); var i; @@ -179,6 +197,7 @@ function ldb_erase(ldb) ldb.del(res[i].dn); } + var res = ldb.search("(&(|(objectclass=*)(dn=*))(!(dn=@BASEINFO)))", basedn, ldb.SCOPE_SUBTREE, attrs); if (res.length != 0) { ldb_delete(ldb); @@ -292,7 +311,7 @@ function setup_ldb(ldif, info, dbname) failok = arguments[4]; } var ldb = open_ldb(info, dbname, erase); - if (setup_add_ldif(ldif, info, ldb, erase, failok)) { + if (setup_add_ldif(ldif, info, ldb, failok)) { var commit_ok = ldb.transaction_commit(); if (!commit_ok) { info.message("ldb commit failed: " + ldb.errstring() + "\n"); |