From 08f630be8230ce061badd84bef952d5753afdff0 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 1 Sep 2005 20:28:03 +0000 Subject: r9915: Some more mappings. Fix weird sAMAccountName values. (This used to be commit 8ff1358f401e0086b941f4ff73af5d4c38a1f8bf) --- source4/scripting/ejs/smbcalls_ldb.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'source4/scripting/ejs') 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 { -- cgit