diff options
-rw-r--r-- | source4/scripting/ejs/smbcalls.c | 9 | ||||
-rw-r--r-- | testprogs/ejs/resolveName.js | 11 |
2 files changed, 13 insertions, 7 deletions
diff --git a/source4/scripting/ejs/smbcalls.c b/source4/scripting/ejs/smbcalls.c index 5d4c61b04b..93496bd9c9 100644 --- a/source4/scripting/ejs/smbcalls.c +++ b/source4/scripting/ejs/smbcalls.c @@ -271,6 +271,11 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv) goto done; } + if (argv[0]->type != MPR_TYPE_OBJECT) { + ejsSetErrorMsg(eid, "resolvename invalid arguments"); + goto done; + } + if (argv[1]->type != MPR_TYPE_STRING) { ejsSetErrorMsg(eid, "resolveName invalid arguments"); goto done; @@ -291,8 +296,8 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv) nt_status = resolve_name(&name, tmp_ctx, &reply_addr); if (NT_STATUS_IS_OK(nt_status)) { - mprDestroyAllVars(argv[0]); - *argv[0] = mprCreateStringVar(reply_addr, True); + mprSetPropertyValue(argv[0], "value", + mprCreateStringVar(reply_addr, 1)); } ejsSetReturnValue(eid, mprNTSTATUS(nt_status)); diff --git a/testprogs/ejs/resolveName.js b/testprogs/ejs/resolveName.js index c2d06b5c74..1619b69d69 100644 --- a/testprogs/ejs/resolveName.js +++ b/testprogs/ejs/resolveName.js @@ -2,11 +2,12 @@ Demonstrate use of resolveName() js function */ -var result; -res = resolveName(result, "frogurt"); +var result = new Object(); -if (!res.is_ok) { - println(res.errstr); +res = resolveName(result, ARGV[0]); + +if (res.is_ok) { + println(result.value); } else { - println(result); + println(res.errstr); } |