summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2008-07-12 23:17:23 +0200
committerVolker Lendecke <vl@samba.org>2008-07-16 23:19:48 +0200
commite0f3ea2cbeb61cb02be85d2b315948985bac27a8 (patch)
tree8d6806f82cd2a72db4cea879a9f0309dbf650d32 /source3/rpc_server
parente65ea7471e2447ed150ade9a2c4f0a67663fb8d2 (diff)
downloadsamba-e0f3ea2cbeb61cb02be85d2b315948985bac27a8.tar.gz
samba-e0f3ea2cbeb61cb02be85d2b315948985bac27a8.tar.bz2
samba-e0f3ea2cbeb61cb02be85d2b315948985bac27a8.zip
In api_pipe_bind_req(), check for the iface id, not the pipe name
This requires to store the rpc_interface in "struct rpc_table" (This used to be commit 654f8de8497aff29f9b1f1822b6a8e734ff329e0)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_eventlog.c3
-rw-r--r--source3/rpc_server/srv_ntsvcs.c5
-rw-r--r--source3/rpc_server/srv_pipe.c17
-rw-r--r--source3/rpc_server/srv_spoolss.c13
-rw-r--r--source3/rpc_server/srv_svcctl.c4
5 files changed, 35 insertions, 7 deletions
diff --git a/source3/rpc_server/srv_eventlog.c b/source3/rpc_server/srv_eventlog.c
index 5679a6acb6..da761c905e 100644
--- a/source3/rpc_server/srv_eventlog.c
+++ b/source3/rpc_server/srv_eventlog.c
@@ -106,7 +106,8 @@ struct api_struct api_eventlog_cmds[] =
NTSTATUS rpc_eventlog2_init(void)
{
return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
- "eventlog", "eventlog", api_eventlog_cmds,
+ "eventlog", "eventlog", &ndr_table_eventlog.syntax_id,
+ api_eventlog_cmds,
sizeof(api_eventlog_cmds)/sizeof(struct api_struct));
}
diff --git a/source3/rpc_server/srv_ntsvcs.c b/source3/rpc_server/srv_ntsvcs.c
index 12fffc3e96..100d577010 100644
--- a/source3/rpc_server/srv_ntsvcs.c
+++ b/source3/rpc_server/srv_ntsvcs.c
@@ -155,6 +155,9 @@ void ntsvcs2_get_pipe_fns( struct api_struct **fns, int *n_fns )
NTSTATUS rpc_ntsvcs2_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "ntsvcs", "ntsvcs", api_ntsvcs_cmds,
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
+ "ntsvcs", "ntsvcs",
+ &ndr_table_ntsvcs.syntax_id,
+ api_ntsvcs_cmds,
sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index f8ec4bfc91..48e6646c75 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -718,6 +718,7 @@ struct rpc_table {
const char *clnt;
const char *srv;
} pipe;
+ struct ndr_syntax_id rpc_interface;
const struct api_struct *cmds;
int n_cmds;
};
@@ -1039,7 +1040,10 @@ bool check_bind_req(struct pipes_struct *p, RPC_IFACE* abstract,
Register commands to an RPC pipe
*******************************************************************/
-NTSTATUS rpc_pipe_register_commands(int version, const char *clnt, const char *srv, const struct api_struct *cmds, int size)
+NTSTATUS rpc_pipe_register_commands(int version, const char *clnt,
+ const char *srv,
+ const struct ndr_syntax_id *interface,
+ const struct api_struct *cmds, int size)
{
struct rpc_table *rpc_entry;
@@ -1079,6 +1083,7 @@ NTSTATUS rpc_pipe_register_commands(int version, const char *clnt, const char *s
ZERO_STRUCTP(rpc_entry);
rpc_entry->pipe.clnt = SMB_STRDUP(clnt);
rpc_entry->pipe.srv = SMB_STRDUP(srv);
+ rpc_entry->rpc_interface = *interface;
rpc_entry->cmds = cmds;
rpc_entry->n_cmds = size;
@@ -1575,16 +1580,22 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
goto err_exit;
}
+ if (hdr_rb.num_contexts == 0) {
+ DEBUG(0, ("api_pipe_bind_req: no rpc contexts around\n"));
+ goto err_exit;
+ }
+
/*
* Try and find the correct pipe name to ensure
* that this is a pipe name we support.
*/
-
for (i = 0; i < rpc_lookup_size; i++) {
- if (strequal(rpc_lookup[i].pipe.clnt, p->name)) {
+ if (ndr_syntax_id_equal(&rpc_lookup[i].rpc_interface,
+ &hdr_rb.rpc_context[0].abstract)) {
DEBUG(3, ("api_pipe_bind_req: \\PIPE\\%s -> \\PIPE\\%s\n",
rpc_lookup[i].pipe.clnt, rpc_lookup[i].pipe.srv));
+ fstrcpy(p->name, rpc_lookup[i].pipe.clnt);
fstrcpy(p->pipe_srv_name, rpc_lookup[i].pipe.srv);
break;
}
diff --git a/source3/rpc_server/srv_spoolss.c b/source3/rpc_server/srv_spoolss.c
index 7802fe447e..4744b90263 100644
--- a/source3/rpc_server/srv_spoolss.c
+++ b/source3/rpc_server/srv_spoolss.c
@@ -1630,8 +1630,19 @@ void spoolss_get_pipe_fns( struct api_struct **fns, int *n_fns )
*n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
}
+static const struct ndr_syntax_id syntax_spoolss = {
+ {
+ 0x12345678, 0x1234, 0xabcd,
+ { 0xef, 0x00 },
+ { 0x01, 0x23,
+ 0x45, 0x67, 0x89, 0xab }
+ }, 0x01
+};
+
NTSTATUS rpc_spoolss_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", api_spoolss_cmds,
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
+ "spoolss", "spoolss", &syntax_spoolss,
+ api_spoolss_cmds,
sizeof(api_spoolss_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/rpc_server/srv_svcctl.c b/source3/rpc_server/srv_svcctl.c
index e3ff2cc8a0..483fb8e1e9 100644
--- a/source3/rpc_server/srv_svcctl.c
+++ b/source3/rpc_server/srv_svcctl.c
@@ -266,6 +266,8 @@ void svcctl2_get_pipe_fns( struct api_struct **fns, int *n_fns )
NTSTATUS rpc_svcctl2_init(void)
{
return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
- "svcctl", "ntsvcs", api_svcctl_cmds,
+ "svcctl", "ntsvcs",
+ &ndr_table_svcctl.syntax_id,
+ api_svcctl_cmds,
sizeof(api_svcctl_cmds) / sizeof(struct api_struct));
}