summaryrefslogtreecommitdiff
path: root/source4/scripting/ejs
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-07-10 06:51:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:19:31 -0500
commit0871be3f351e80de8b97717f7975d98702112376 (patch)
treeecbc5887a8ea0982133689f9975b535a2393441b /source4/scripting/ejs
parentf3c6f290f0c2ba84d8dbbae8d6d2bb50330a27c1 (diff)
downloadsamba-0871be3f351e80de8b97717f7975d98702112376.tar.gz
samba-0871be3f351e80de8b97717f7975d98702112376.tar.bz2
samba-0871be3f351e80de8b97717f7975d98702112376.zip
r8281: pass the callnum and rpc interface table directly from the generated
code in pidl for ejs calls. This means that ejs_rpc_call() doesn't need to scan the rpc tables for the right interface, and doesn't need to scan for the call name (This used to be commit 1c6b1102e5c2529206b917e7c6b279c4f63d0e9a)
Diffstat (limited to 'source4/scripting/ejs')
-rw-r--r--source4/scripting/ejs/ejsrpc.h3
-rw-r--r--source4/scripting/ejs/smbcalls_rpc.c42
2 files changed, 26 insertions, 19 deletions
diff --git a/source4/scripting/ejs/ejsrpc.h b/source4/scripting/ejs/ejsrpc.h
index e410535b6c..e4b623750d 100644
--- a/source4/scripting/ejs/ejsrpc.h
+++ b/source4/scripting/ejs/ejsrpc.h
@@ -43,7 +43,8 @@ NTSTATUS smbcalls_register_ejs(const char *name,
ejs_setup_t setup,
ejs_constants_t constants);
-int ejs_rpc_call(int eid, int argc, struct MprVar **argv, const char *callname,
+int ejs_rpc_call(int eid, int argc, struct MprVar **argv,
+ const struct dcerpc_interface_table *iface, int callnum,
ejs_pull_function_t ejs_pull, ejs_push_function_t ejs_push);
NTSTATUS ejs_pull_struct_start(struct ejs_rpc *ejs, struct MprVar **v, const char *name);
diff --git a/source4/scripting/ejs/smbcalls_rpc.c b/source4/scripting/ejs/smbcalls_rpc.c
index 857d590aa1..735383df08 100644
--- a/source4/scripting/ejs/smbcalls_rpc.c
+++ b/source4/scripting/ejs/smbcalls_rpc.c
@@ -164,23 +164,31 @@ done:
/*
- make an rpc call
- example:
- status = rpc_call(conn, "echo_AddOne", io);
+ make an irpc call - called via the same interface as rpc
+*/
+static int ejs_irpc_call(int eid, struct MprVar *conn, struct MprVar *io,
+ const struct dcerpc_interface_table *iface, int callnum,
+ ejs_pull_function_t ejs_pull, ejs_push_function_t ejs_push)
+{
+ return 0;
+}
+
+
+/*
+ backend code for making an rpc call - this is called from the pidl generated ejs
+ code
*/
int ejs_rpc_call(int eid, int argc, struct MprVar **argv,
- const char *callname,
+ const struct dcerpc_interface_table *iface, int callnum,
ejs_pull_function_t ejs_pull, ejs_push_function_t ejs_push)
{
struct MprVar *conn, *io;
- const struct dcerpc_interface_table *iface;
struct dcerpc_pipe *p;
- const struct dcerpc_interface_call *call;
NTSTATUS status;
void *ptr;
struct rpc_request *req;
- int callnum;
struct ejs_rpc *ejs;
+ const struct dcerpc_interface_call *call;
if (argc != 2 ||
argv[0]->type != MPR_TYPE_OBJECT ||
@@ -192,30 +200,28 @@ done:
conn = argv[0];
io = argv[1];
+ if (mprGetPtr(conn, "irpc")) {
+ /* its an irpc call */
+ return ejs_irpc_call(eid, conn, io, iface, callnum, ejs_pull, ejs_push);
+ }
+
/* get the pipe info */
p = mprGetPtr(conn, "pipe");
- iface = mprGetPtr(conn, "iface");
- if (p == NULL || iface == NULL) {
+ if (p == NULL) {
ejsSetErrorMsg(eid, "rpc_call invalid pipe");
return -1;
}
- /* find the call by name */
- call = dcerpc_iface_find_call(iface, callname);
- if (call == NULL) {
- status = NT_STATUS_OBJECT_NAME_INVALID;
- goto done;
- }
- callnum = call - iface->calls;
-
ejs = talloc(mprMemCtx(), struct ejs_rpc);
if (ejs == NULL) {
status = NT_STATUS_NO_MEMORY;
goto done;
}
+ call = &iface->calls[callnum];
+
ejs->eid = eid;
- ejs->callname = callname;
+ ejs->callname = call->name;
/* allocate the C structure */
ptr = talloc_zero_size(ejs, call->struct_size);