1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-16 00:23:52 +03:00

r9210: fixed support for a credentials element in a rpc object in ejs to not

give lots of warnings of missing properties
This commit is contained in:
Andrew Tridgell
2005-08-08 03:20:17 +00:00
committed by Gerald (Jerry) Carter
parent 8c3f57f791
commit 15737abd74
2 changed files with 10 additions and 6 deletions

View File

@@ -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;
}
/*

View File

@@ -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) {