diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/librpc/idl/lsa.idl | 2 | ||||
-rw-r--r-- | source4/scripting/ejs/ejsrpc.c | 21 | ||||
-rw-r--r-- | source4/scripting/ejs/ejsrpc.h | 1 | ||||
-rw-r--r-- | source4/scripting/ejs/mprutil.c | 1 | ||||
-rw-r--r-- | source4/scripting/ejs/smbcalls_rpc.c | 13 |
5 files changed, 35 insertions, 3 deletions
diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl index 3939826693..0b5d4e959c 100644 --- a/source4/librpc/idl/lsa.idl +++ b/source4/librpc/idl/lsa.idl @@ -13,7 +13,7 @@ depends(security) ] interface lsarpc { - typedef [public] struct { + typedef [public,noejs] struct { [value(2*strlen_m(string))] uint16 length; [value(2*strlen_m(string))] uint16 size; unistr_noterm *string; diff --git a/source4/scripting/ejs/ejsrpc.c b/source4/scripting/ejs/ejsrpc.c index 992defe8bb..32728ebfe4 100644 --- a/source4/scripting/ejs/ejsrpc.c +++ b/source4/scripting/ejs/ejsrpc.c @@ -22,8 +22,9 @@ #include "includes.h" #include "lib/ejs/ejs.h" -#include "scripting/ejs/ejsrpc.h" #include "librpc/gen_ndr/ndr_security.h" +#include "librpc/gen_ndr/ndr_lsa.h" +#include "scripting/ejs/ejsrpc.h" NTSTATUS ejs_pull_rpc(int eid, const char *callname, struct MprVar *v, void *ptr, ejs_pull_function_t ejs_pull) @@ -423,3 +424,21 @@ BOOL ejs_pull_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name) } return False; } + +/* + pull a lsa_String +*/ +NTSTATUS ejs_pull_lsa_String(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, struct lsa_String *r) +{ + return ejs_pull_string(ejs, v, name, &r->string); +} + +/* + push a lsa_String +*/ +NTSTATUS ejs_push_lsa_String(struct ejs_rpc *ejs, + struct MprVar *v, const char *name, const struct lsa_String *r) +{ + return ejs_push_string(ejs, v, name, r->string); +} diff --git a/source4/scripting/ejs/ejsrpc.h b/source4/scripting/ejs/ejsrpc.h index d86c4eb71f..c45b66d385 100644 --- a/source4/scripting/ejs/ejsrpc.h +++ b/source4/scripting/ejs/ejsrpc.h @@ -90,6 +90,7 @@ NTSTATUS ejs_push_dom_sid(struct ejs_rpc *ejs, NTSTATUS ejs_push_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name); BOOL ejs_pull_null(struct ejs_rpc *ejs, struct MprVar *v, const char *name); + #define EJS_ALLOC_SIZE(ejs, s, size) do { \ (s) = talloc_size(ejs, size); \ if (!(s)) return ejs_panic(ejs, "out of memory"); \ diff --git a/source4/scripting/ejs/mprutil.c b/source4/scripting/ejs/mprutil.c index 1c640a5d5e..7b64d042f5 100644 --- a/source4/scripting/ejs/mprutil.c +++ b/source4/scripting/ejs/mprutil.c @@ -119,6 +119,7 @@ struct MprVar mprLdbArray(struct ldb_message **msg, int count, const char *name) for (i=0;i<count;i++) { mprAddArray(&res, i, mprLdbMessage(msg[i])); } + mprSetPropertyValue(&res, "length", mprCreateIntegerVar(i)); return res; } 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 */ |