summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/scripting/ejs/smbcalls_ldb.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c
index 4151eaedab..b56a3da7a1 100644
--- a/source4/scripting/ejs/smbcalls_ldb.c
+++ b/source4/scripting/ejs/smbcalls_ldb.c
@@ -216,6 +216,24 @@ static int ejs_ldbRename(MprVarHandle eid, int argc, struct MprVar **argv)
}
/*
+ get last error message
+ usage:
+ ok = ldb.errstring();
+*/
+static int ejs_ldbErrstring(MprVarHandle eid, int argc, struct MprVar **argv)
+{
+ struct ldb_context *ldb;
+
+ ldb = ejs_get_ldb_context(eid);
+ if (ldb == NULL) {
+ return -1;
+ }
+
+ mpr_Return(eid, mprString(ldb_errstring(ldb)));
+ return 0;
+}
+
+/*
perform an ldb modify
syntax:
@@ -281,6 +299,7 @@ static int ejs_ldb_init(MprVarHandle eid, int argc, struct MprVar **argv)
mprSetCFunction(ldb, "modify", ejs_ldbModify);
mprSetCFunction(ldb, "delete", ejs_ldbDelete);
mprSetCFunction(ldb, "rename", ejs_ldbRename);
+ mprSetCFunction(ldb, "errstring", ejs_ldbErrstring);
mprSetVar(ldb, "SCOPE_BASE", mprCreateNumberVar(LDB_SCOPE_BASE));
mprSetVar(ldb, "SCOPE_ONE", mprCreateNumberVar(LDB_SCOPE_ONELEVEL));
mprSetVar(ldb, "SCOPE_SUBTREE", mprCreateNumberVar(LDB_SCOPE_SUBTREE));