mirror of
https://github.com/samba-team/samba.git
synced 2025-08-04 08:22:08 +03:00
r9171: - support putting a credentials object in a rpc pipe object to allow authentication
with other than the command line credentials in a rpc pipe
(This used to be commit aae05ebc9c
)
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
232704793e
commit
2ed26253c1
@ -357,15 +357,14 @@ void mprSetPtrChild(struct MprVar *v, const char *propname, const void *p)
|
|||||||
*/
|
*/
|
||||||
void *mprGetPtr(struct MprVar *v, const char *propname)
|
void *mprGetPtr(struct MprVar *v, const char *propname)
|
||||||
{
|
{
|
||||||
struct MprVar *val;
|
NTSTATUS status = mprGetVar(&v, propname);
|
||||||
val = mprGetProperty(v, propname, NULL);
|
if (!NT_STATUS_IS_OK(status)) {
|
||||||
if (val == NULL) {
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (val->type != MPR_TYPE_PTR) {
|
if (v->type != MPR_TYPE_PTR) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return val->ptr;
|
return v->ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -109,7 +109,7 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv)
|
|||||||
const struct dcerpc_interface_table *iface;
|
const struct dcerpc_interface_table *iface;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
struct dcerpc_pipe *p;
|
struct dcerpc_pipe *p;
|
||||||
struct cli_credentials *creds = cmdline_credentials;
|
struct cli_credentials *creds;
|
||||||
struct event_context *ev;
|
struct event_context *ev;
|
||||||
struct MprVar *this = mprGetProperty(ejsGetLocalObject(eid), "this", 0);
|
struct MprVar *this = mprGetProperty(ejsGetLocalObject(eid), "this", 0);
|
||||||
|
|
||||||
@ -137,11 +137,14 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
creds = mprGetPtr(this, "credentials.creds");
|
||||||
|
if (creds == NULL) {
|
||||||
|
creds = cmdline_credentials;
|
||||||
|
}
|
||||||
if (creds == NULL) {
|
if (creds == NULL) {
|
||||||
creds = cli_credentials_init(mprMemCtx());
|
creds = cli_credentials_init(mprMemCtx());
|
||||||
cli_credentials_guess(creds);
|
cli_credentials_guess(creds);
|
||||||
cli_credentials_set_username(creds, "", CRED_GUESSED);
|
cli_credentials_set_anonymous(creds);
|
||||||
cli_credentials_set_password(creds, "", CRED_GUESSED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ev = talloc_find_parent_bytype(mprMemCtx(), struct event_context);
|
ev = talloc_find_parent_bytype(mprMemCtx(), struct event_context);
|
||||||
@ -157,7 +160,6 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv)
|
|||||||
/* by making the pipe a child of the connection variable, it will
|
/* by making the pipe a child of the connection variable, it will
|
||||||
auto close when it goes out of scope in the script */
|
auto close when it goes out of scope in the script */
|
||||||
mprSetPtrChild(this, "pipe", p);
|
mprSetPtrChild(this, "pipe", p);
|
||||||
mprSetPtr(this, "iface", iface);
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
mpr_Return(eid, mprNTSTATUS(status));
|
mpr_Return(eid, mprNTSTATUS(status));
|
||||||
@ -353,7 +355,6 @@ done:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* a list of registered ejs rpc modules */
|
/* a list of registered ejs rpc modules */
|
||||||
static struct ejs_register {
|
static struct ejs_register {
|
||||||
struct ejs_register *next, *prev;
|
struct ejs_register *next, *prev;
|
||||||
|
Reference in New Issue
Block a user