1
0
mirror of https://github.com/samba-team/samba.git synced 2025-07-23 20:59:10 +03:00

r19258: 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
(This used to be commit 962219df7d)
This commit is contained in:
Andrew Bartlett
2006-10-13 01:35:52 +00:00
committed by Gerald (Jerry) Carter
parent 6c4bc15f3b
commit d70fbdbefa
3 changed files with 22 additions and 33 deletions

View File

@ -157,25 +157,8 @@ function ldb_delete(ldb)
*/
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 @@ function provision(subobj, message, blank, paths, session_info, credentials)
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 @@ function provision(subobj, message, blank, paths, session_info, credentials)
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");