summaryrefslogtreecommitdiff
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
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)
-rw-r--r--source3/include/proto.h5
-rw-r--r--source3/librpc/gen_ndr/srv_dfs.c2
-rw-r--r--source3/librpc/gen_ndr/srv_dssetup.c2
-rw-r--r--source3/librpc/gen_ndr/srv_echo.c2
-rw-r--r--source3/librpc/gen_ndr/srv_epmapper.c2
-rw-r--r--source3/librpc/gen_ndr/srv_eventlog.c2
-rw-r--r--source3/librpc/gen_ndr/srv_initshutdown.c2
-rw-r--r--source3/librpc/gen_ndr/srv_lsa.c2
-rw-r--r--source3/librpc/gen_ndr/srv_netlogon.c2
-rw-r--r--source3/librpc/gen_ndr/srv_ntsvcs.c2
-rw-r--r--source3/librpc/gen_ndr/srv_samr.c2
-rw-r--r--source3/librpc/gen_ndr/srv_srvsvc.c2
-rw-r--r--source3/librpc/gen_ndr/srv_svcctl.c2
-rw-r--r--source3/librpc/gen_ndr/srv_winreg.c2
-rw-r--r--source3/librpc/gen_ndr/srv_wkssvc.c2
-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
20 files changed, 53 insertions, 22 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 246a3b75be..03d203b96e 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -8809,7 +8809,10 @@ bool setup_fault_pdu(pipes_struct *p, NTSTATUS status);
bool setup_cancel_ack_reply(pipes_struct *p, prs_struct *rpc_in_p);
bool check_bind_req(struct pipes_struct *p, RPC_IFACE* abstract,
RPC_IFACE* transfer, uint32 context_id);
-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);
bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p);
bool api_pipe_alter_context(pipes_struct *p, prs_struct *rpc_in_p);
bool api_pipe_ntlmssp_auth_process(pipes_struct *p, prs_struct *rpc_in,
diff --git a/source3/librpc/gen_ndr/srv_dfs.c b/source3/librpc/gen_ndr/srv_dfs.c
index 1ecd687e3a..54b2184829 100644
--- a/source3/librpc/gen_ndr/srv_dfs.c
+++ b/source3/librpc/gen_ndr/srv_dfs.c
@@ -1750,5 +1750,5 @@ void netdfs_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_netdfs_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "netdfs", "netdfs", api_netdfs_cmds, sizeof(api_netdfs_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "netdfs", "netdfs", &ndr_table_netdfs.syntax_id, api_netdfs_cmds, sizeof(api_netdfs_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_dssetup.c b/source3/librpc/gen_ndr/srv_dssetup.c
index 7a1cae9b5a..79bde30d06 100644
--- a/source3/librpc/gen_ndr/srv_dssetup.c
+++ b/source3/librpc/gen_ndr/srv_dssetup.c
@@ -841,5 +841,5 @@ void dssetup_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_dssetup_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "dssetup", "dssetup", api_dssetup_cmds, sizeof(api_dssetup_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "dssetup", "dssetup", &ndr_table_dssetup.syntax_id, api_dssetup_cmds, sizeof(api_dssetup_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_echo.c b/source3/librpc/gen_ndr/srv_echo.c
index 3f725049cd..b8b38dad13 100644
--- a/source3/librpc/gen_ndr/srv_echo.c
+++ b/source3/librpc/gen_ndr/srv_echo.c
@@ -801,5 +801,5 @@ void rpcecho_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_rpcecho_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", api_rpcecho_cmds, sizeof(api_rpcecho_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "rpcecho", "rpcecho", &ndr_table_rpcecho.syntax_id, api_rpcecho_cmds, sizeof(api_rpcecho_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_epmapper.c b/source3/librpc/gen_ndr/srv_epmapper.c
index e6c89a553f..f42598abd4 100644
--- a/source3/librpc/gen_ndr/srv_epmapper.c
+++ b/source3/librpc/gen_ndr/srv_epmapper.c
@@ -642,5 +642,5 @@ void epmapper_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_epmapper_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "epmapper", "epmapper", api_epmapper_cmds, sizeof(api_epmapper_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "epmapper", "epmapper", &ndr_table_epmapper.syntax_id, api_epmapper_cmds, sizeof(api_epmapper_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_eventlog.c b/source3/librpc/gen_ndr/srv_eventlog.c
index 4d0722bdd7..eb3fb1fe6d 100644
--- a/source3/librpc/gen_ndr/srv_eventlog.c
+++ b/source3/librpc/gen_ndr/srv_eventlog.c
@@ -1838,5 +1838,5 @@ void eventlog_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_eventlog_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "eventlog", "eventlog", api_eventlog_cmds, sizeof(api_eventlog_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "eventlog", "eventlog", &ndr_table_eventlog.syntax_id, api_eventlog_cmds, sizeof(api_eventlog_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_initshutdown.c b/source3/librpc/gen_ndr/srv_initshutdown.c
index f24530c1c1..00a89661b5 100644
--- a/source3/librpc/gen_ndr/srv_initshutdown.c
+++ b/source3/librpc/gen_ndr/srv_initshutdown.c
@@ -242,5 +242,5 @@ void initshutdown_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_initshutdown_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "initshutdown", "initshutdown", api_initshutdown_cmds, sizeof(api_initshutdown_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "initshutdown", "initshutdown", &ndr_table_initshutdown.syntax_id, api_initshutdown_cmds, sizeof(api_initshutdown_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_lsa.c b/source3/librpc/gen_ndr/srv_lsa.c
index 249bdc04bb..41d1c9716c 100644
--- a/source3/librpc/gen_ndr/srv_lsa.c
+++ b/source3/librpc/gen_ndr/srv_lsa.c
@@ -6371,5 +6371,5 @@ void lsarpc_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_lsarpc_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "lsarpc", "lsarpc", api_lsarpc_cmds, sizeof(api_lsarpc_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "lsarpc", "lsarpc", &ndr_table_lsarpc.syntax_id, api_lsarpc_cmds, sizeof(api_lsarpc_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_netlogon.c b/source3/librpc/gen_ndr/srv_netlogon.c
index 67876f11ef..154ef71d40 100644
--- a/source3/librpc/gen_ndr/srv_netlogon.c
+++ b/source3/librpc/gen_ndr/srv_netlogon.c
@@ -3862,5 +3862,5 @@ void netlogon_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_netlogon_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "netlogon", "netlogon", api_netlogon_cmds, sizeof(api_netlogon_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "netlogon", "netlogon", &ndr_table_netlogon.syntax_id, api_netlogon_cmds, sizeof(api_netlogon_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_ntsvcs.c b/source3/librpc/gen_ndr/srv_ntsvcs.c
index 523b4d8c91..d21e86db6e 100644
--- a/source3/librpc/gen_ndr/srv_ntsvcs.c
+++ b/source3/librpc/gen_ndr/srv_ntsvcs.c
@@ -4865,5 +4865,5 @@ void ntsvcs_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_ntsvcs_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "ntsvcs", "ntsvcs", api_ntsvcs_cmds, sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct));
+ 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/librpc/gen_ndr/srv_samr.c b/source3/librpc/gen_ndr/srv_samr.c
index 3994587981..1eaa19eaf7 100644
--- a/source3/librpc/gen_ndr/srv_samr.c
+++ b/source3/librpc/gen_ndr/srv_samr.c
@@ -5478,5 +5478,5 @@ void samr_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_samr_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "samr", api_samr_cmds, sizeof(api_samr_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "samr", &ndr_table_samr.syntax_id, api_samr_cmds, sizeof(api_samr_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_srvsvc.c b/source3/librpc/gen_ndr/srv_srvsvc.c
index 9f4055c35a..66faaaaf7e 100644
--- a/source3/librpc/gen_ndr/srv_srvsvc.c
+++ b/source3/librpc/gen_ndr/srv_srvsvc.c
@@ -4195,5 +4195,5 @@ void srvsvc_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_srvsvc_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "srvsvc", "srvsvc", api_srvsvc_cmds, sizeof(api_srvsvc_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "srvsvc", "srvsvc", &ndr_table_srvsvc.syntax_id, api_srvsvc_cmds, sizeof(api_srvsvc_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_svcctl.c b/source3/librpc/gen_ndr/srv_svcctl.c
index 264dea3474..32317ad8fe 100644
--- a/source3/librpc/gen_ndr/srv_svcctl.c
+++ b/source3/librpc/gen_ndr/srv_svcctl.c
@@ -3617,5 +3617,5 @@ void svcctl_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_svcctl_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "svcctl", "svcctl", api_svcctl_cmds, sizeof(api_svcctl_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "svcctl", "svcctl", &ndr_table_svcctl.syntax_id, api_svcctl_cmds, sizeof(api_svcctl_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_winreg.c b/source3/librpc/gen_ndr/srv_winreg.c
index 4672944ad0..c697f44d2a 100644
--- a/source3/librpc/gen_ndr/srv_winreg.c
+++ b/source3/librpc/gen_ndr/srv_winreg.c
@@ -2768,5 +2768,5 @@ void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_winreg_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "winreg", "winreg", api_winreg_cmds, sizeof(api_winreg_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "winreg", "winreg", &ndr_table_winreg.syntax_id, api_winreg_cmds, sizeof(api_winreg_cmds) / sizeof(struct api_struct));
}
diff --git a/source3/librpc/gen_ndr/srv_wkssvc.c b/source3/librpc/gen_ndr/srv_wkssvc.c
index 90e6f482f4..227e4c1a48 100644
--- a/source3/librpc/gen_ndr/srv_wkssvc.c
+++ b/source3/librpc/gen_ndr/srv_wkssvc.c
@@ -2408,5 +2408,5 @@ void wkssvc_get_pipe_fns(struct api_struct **fns, int *n_fns)
NTSTATUS rpc_wkssvc_init(void)
{
- return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "wkssvc", "wkssvc", api_wkssvc_cmds, sizeof(api_wkssvc_cmds) / sizeof(struct api_struct));
+ return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "wkssvc", "wkssvc", &ndr_table_wkssvc.syntax_id, api_wkssvc_cmds, sizeof(api_wkssvc_cmds) / sizeof(struct api_struct));
}
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));
}