From 7efeb8f451345b54ce125bcbb601ba2475ef9e59 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 9 Jul 2005 05:28:42 +0000 Subject: r8256: - allow rpc calls from non-command line ejs contexts by creating a set of null credentials to use if cmdline_credentials is not setup - hide the length and size elements of a lsa_String from js scripts, so you can use a lsa_String just as an ordinary string without knowing its a structure. We won't do this with all structures, just a few core ones that are used often enough to warrant it. - make sure returned ldb arrays have a length property (This used to be commit 12d2092dd8668de41776132ccbcd634790c371a9) --- source4/scripting/ejs/smbcalls_rpc.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'source4/scripting/ejs/smbcalls_rpc.c') diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c index e1d9c93be6..3c3b8515f1 100644 --- a/source4/scripting/ejs/smbcalls_rpc.c +++ b/source4/scripting/ejs/smbcalls_rpc.c @@ -39,6 +39,8 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, struct MprVar **argv) NTSTATUS status; struct dcerpc_pipe *p; struct MprVar *conn; + struct cli_credentials *creds = cmdline_credentials; + struct event_context *ev; /* validate arguments */ if (argc != 3 || @@ -59,9 +61,18 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, struct MprVar **argv) goto done; } + if (creds == NULL) { + creds = cli_credentials_init(mprMemCtx()); + cli_credentials_guess(creds); + cli_credentials_set_username(creds, "", CRED_GUESSED); + cli_credentials_set_password(creds, "", CRED_GUESSED); + } + + ev = talloc_find_parent_bytype(mprMemCtx(), struct event_context); + status = dcerpc_pipe_connect(mprMemCtx(), &p, binding, iface->uuid, iface->if_version, - cmdline_credentials, NULL); + creds, ev); if (!NT_STATUS_IS_OK(status)) goto done; /* callers don't allocate ref vars in the ejs interface */ -- cgit