summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-18 23:57:37 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:29:37 -0500
commit0752efe05554de05eea1812a4dd721692ca8bf95 (patch)
tree9f15eb4761e88e27b0c9b22545e49ae0e189414d /source4
parent7ef904e9e1de31129f12cb4c8dee0a06a93b9dc4 (diff)
downloadsamba-0752efe05554de05eea1812a4dd721692ca8bf95.tar.gz
samba-0752efe05554de05eea1812a4dd721692ca8bf95.tar.bz2
samba-0752efe05554de05eea1812a4dd721692ca8bf95.zip
r8557: expose ldb_errstring() in ldb ejs code
(This used to be commit 21ca972d06bbf4694569855f39a1649d799c05c7)
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));