summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-09-13 01:01:55 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:38:07 -0500
commit68974a1c7205a4b06045217ed01a2f75ea8bccdd (patch)
treefd7b2957ee5f732bc500b658eac0b673fc8407e8
parent957d361cd183a7f5fa9eedb1b205b3f872765884 (diff)
downloadsamba-68974a1c7205a4b06045217ed01a2f75ea8bccdd.tar.gz
samba-68974a1c7205a4b06045217ed01a2f75ea8bccdd.tar.bz2
samba-68974a1c7205a4b06045217ed01a2f75ea8bccdd.zip
r10192: r11631@blu: tridge | 2005-08-30 23:06:37 +1000
added a ldb.close() method in js. Useful for re-opening the db (This used to be commit 1f12364a0f23ba39fd3d29b510fdef2423685f0d)
-rw-r--r--source4/scripting/ejs/smbcalls_ldb.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c
index f536fbe547..8c66bde571 100644
--- a/source4/scripting/ejs/smbcalls_ldb.c
+++ b/source4/scripting/ejs/smbcalls_ldb.c
@@ -368,6 +368,31 @@ static int ejs_ldbConnect(MprVarHandle eid, int argc, char **argv)
/*
+ close a db connection
+*/
+static int ejs_ldbClose(MprVarHandle eid, int argc, struct MprVar **argv)
+{
+ struct ldb_context *ldb;
+
+ if (argc != 0) {
+ ejsSetErrorMsg(eid, "ldb.close invalid arguments");
+ return -1;
+ }
+
+ ldb = ejs_get_ldb_context(eid);
+ if (ldb == NULL) {
+ return -1;
+ }
+
+ talloc_free(ldb);
+
+ mprSetThisPtr(eid, "db", NULL);
+ mpr_Return(eid, mprCreateBoolVar(True));
+ return 0;
+}
+
+
+/*
initialise ldb ejs subsystem
*/
static int ejs_ldb_init(MprVarHandle eid, int argc, struct MprVar **argv)
@@ -383,6 +408,7 @@ static int ejs_ldb_init(MprVarHandle eid, int argc, struct MprVar **argv)
mprSetCFunction(ldb, "errstring", ejs_ldbErrstring);
mprSetCFunction(ldb, "encode", ejs_base64encode);
mprSetCFunction(ldb, "decode", ejs_base64decode);
+ mprSetCFunction(ldb, "close", ejs_ldbClose);
mprSetVar(ldb, "SCOPE_BASE", mprCreateNumberVar(LDB_SCOPE_BASE));
mprSetVar(ldb, "SCOPE_ONE", mprCreateNumberVar(LDB_SCOPE_ONELEVEL));
mprSetVar(ldb, "SCOPE_SUBTREE", mprCreateNumberVar(LDB_SCOPE_SUBTREE));