diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-07-19 02:10:08 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:29:39 -0500 |
commit | 1bc4bd4c14e01788bdb4ed09b12eaf0abacab2c1 (patch) | |
tree | 31a64a0b506c681a5534f5d0da55da9e6520adce /source4 | |
parent | 09708a2012330419db82f2fb45fdccc52cbd2b01 (diff) | |
download | samba-1bc4bd4c14e01788bdb4ed09b12eaf0abacab2c1.tar.gz samba-1bc4bd4c14e01788bdb4ed09b12eaf0abacab2c1.tar.bz2 samba-1bc4bd4c14e01788bdb4ed09b12eaf0abacab2c1.zip |
r8570: delete all records in the old db when provisioning, rather than using
sys.unlink(). This allows smbd to see the new db without restarting.
(This used to be commit 71004aa165e88f5f448dc7d90ad11dea7143f0df)
Diffstat (limited to 'source4')
-rw-r--r-- | source4/scripting/libjs/provision.js | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index 7133e50b4c..5ce9c8886f 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -111,6 +111,30 @@ function hostname() /* + erase an ldb, removing all records +*/ +function ldb_erase(ldb) +{ + var attrs = new Array("dn"); + + /* delete the specials */ + ldb.del("@INDEXLIST"); + ldb.del("@ATTRIBUTES"); + ldb.del("@SUBCLASSES"); + ldb.del("@MODULES"); + + /* and the rest */ + var res = ldb.search("(|(objectclass=*)(dn=*))", attrs); + var i; + for (i=0;i<res.length;i++) { + ldb.del(res[i].dn); + } + res = ldb.search("(objectclass=*)", attrs); + assert(res.length == 0); +} + + +/* setup a ldb in the private dir */ function setup_ldb(ldif, dbname, subobj) @@ -125,8 +149,6 @@ function setup_ldb(ldif, dbname, subobj) var dbfile = lpGet("private dir") + "/" + dbname; var src = lpGet("setup directory") + "/" + ldif; - sys.unlink(dbfile); - var data = sys.file_load(src); data = data + extra; data = substitute_var(data, subobj); @@ -134,6 +156,8 @@ function setup_ldb(ldif, dbname, subobj) var ok = ldb.connect(dbfile); assert(ok); + ldb_erase(ldb); + ok = ldb.add(data); assert(ok); } |