svn commit: samba r10192 - in branches/SAMBA_4_0: . source/scripting/ejs

tridge at samba.org tridge at samba.org
Tue Sep 13 01:01:56 GMT 2005


Author: tridge
Date: 2005-09-13 01:01:55 +0000 (Tue, 13 Sep 2005)
New Revision: 10192

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

Log:
 r11631 at blu:  tridge | 2005-08-30 23:06:37 +1000
 added a ldb.close() method in js. Useful for re-opening the db
 

Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/scripting/ejs/smbcalls_ldb.c


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: svk:merge
   - 3a72dc49-98ff-0310-ab52-9b7ed7945d91:/local/samba4:9495
a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11627
   + 3a72dc49-98ff-0310-ab52-9b7ed7945d91:/local/samba4:9495
a953eb74-4aff-0310-a63c-855d20285ebb:/local/samba4:11631

Modified: branches/SAMBA_4_0/source/scripting/ejs/smbcalls_ldb.c
===================================================================
--- branches/SAMBA_4_0/source/scripting/ejs/smbcalls_ldb.c	2005-09-13 00:01:24 UTC (rev 10191)
+++ branches/SAMBA_4_0/source/scripting/ejs/smbcalls_ldb.c	2005-09-13 01:01:55 UTC (rev 10192)
@@ -368,6 +368,31 @@
 
 
 /*
+  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 @@
 	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));



More information about the samba-cvs mailing list