summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2005-09-01 20:28:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:36:21 -0500
commit08f630be8230ce061badd84bef952d5753afdff0 (patch)
tree8dd8cfa1dc17f7b2ca35cdac92c12414e9d8d5bc /source4/scripting/ejs
parent4f4dae05f03c76b81cbc71ee80f7f1a34644936f (diff)
downloadsamba-08f630be8230ce061badd84bef952d5753afdff0.tar.gz
samba-08f630be8230ce061badd84bef952d5753afdff0.tar.bz2
samba-08f630be8230ce061badd84bef952d5753afdff0.zip
r9915: Some more mappings. Fix weird sAMAccountName values.
(This used to be commit 8ff1358f401e0086b941f4ff73af5d4c38a1f8bf)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r--source4/scripting/ejs/smbcalls_ldb.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/source4/scripting/ejs/smbcalls_ldb.c b/source4/scripting/ejs/smbcalls_ldb.c
index 855dd157f7..f536fbe547 100644
--- a/source4/scripting/ejs/smbcalls_ldb.c
+++ b/source4/scripting/ejs/smbcalls_ldb.c
@@ -256,17 +256,23 @@ static int ejs_ldbErrstring(MprVarHandle eid, int argc, struct MprVar **argv)
static int ejs_base64encode(MprVarHandle eid, int argc, struct MprVar **argv)
{
char *ret;
- DATA_BLOB *blob;
if (argc != 1) {
ejsSetErrorMsg(eid, "ldb.base64encode invalid argument count");
return -1;
}
- blob = mprToDataBlob(argv[0]);
- mprAssert(blob);
- ret = ldb_base64_encode(mprMemCtx(), (char *)blob->data, blob->length);
+ if (argv[0]->type == MPR_TYPE_STRING) {
+ const char *orig = mprToString(argv[0]);
+ ret = ldb_base64_encode(mprMemCtx(), orig, strlen(orig));
+ } else {
+ DATA_BLOB *blob;
+ blob = mprToDataBlob(argv[0]);
+ mprAssert(blob);
+ ret = ldb_base64_encode(mprMemCtx(), (char *)blob->data, blob->length);
+ }
+
if (!ret) {
mpr_Return(eid, mprCreateUndefinedVar());
} else {