From 2b31c6d9d0d853d6be0a7e4f42977029389fc5ce Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 8 Aug 2005 03:20:17 +0000 Subject: r9210: fixed support for a credentials element in a rpc object in ejs to not give lots of warnings of missing properties (This used to be commit 15737abd747cea561eca92103919f4adc22c6fcd) --- source4/scripting/ejs/mprutil.c | 9 +++++---- source4/scripting/ejs/smbcalls_rpc.c | 7 +++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/source4/scripting/ejs/mprutil.c b/source4/scripting/ejs/mprutil.c index 748f28c681..657078e7c7 100644 --- a/source4/scripting/ejs/mprutil.c +++ b/source4/scripting/ejs/mprutil.c @@ -357,14 +357,15 @@ void mprSetPtrChild(struct MprVar *v, const char *propname, const void *p) */ void *mprGetPtr(struct MprVar *v, const char *propname) { - NTSTATUS status = mprGetVar(&v, propname); - if (!NT_STATUS_IS_OK(status)) { + struct MprVar *val; + val = mprGetProperty(v, propname, NULL); + if (val == NULL) { return NULL; } - if (v->type != MPR_TYPE_PTR) { + if (val->type != MPR_TYPE_PTR) { return NULL; } - return v->ptr; + return val->ptr; } /* diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index f5b71b6715..cbb8d9dd9d 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -112,6 +112,7 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv) struct cli_credentials *creds; struct event_context *ev; struct MprVar *this = mprGetProperty(ejsGetLocalObject(eid), "this", 0); + struct MprVar *credentials; /* validate arguments */ if (argc < 1) { @@ -137,8 +138,10 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv) goto done; } - creds = mprGetPtr(this, "credentials.creds"); - if (creds == NULL) { + credentials = mprGetProperty(this, "credentials", NULL); + if (credentials) { + creds = mprGetPtr(credentials, "creds"); + } else { creds = cmdline_credentials; } if (creds == NULL) { -- cgit