[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-3265-g654f8de

Volker Lendecke vlendec at samba.org
Wed Jul 16 21:20:53 GMT 2008


The branch, v3-3-test has been updated
       via  654f8de8497aff29f9b1f1822b6a8e734ff329e0 (commit)
       via  5fc90908deb417130af122941e084542304a2543 (commit)
       via  8be41382ed9bb4fb44a1846fff2c7652388e4f28 (commit)
      from  9e6760cfeaf77e80df3b84004090d934f3c2d574 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit 654f8de8497aff29f9b1f1822b6a8e734ff329e0
Author: Volker Lendecke <vl at samba.org>
Date:   Sat Jul 12 23:17:23 2008 +0200

    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"

commit 5fc90908deb417130af122941e084542304a2543
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jul 16 22:18:43 2008 +0200

    Add ndr_syntax_id_equal()

commit 8be41382ed9bb4fb44a1846fff2c7652388e4f28
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Jul 16 22:08:59 2008 +0200

    In api_pipe_bind_req(), decode the bind request before checking the pipe

-----------------------------------------------------------------------

Summary of changes:
 source/include/proto.h                   |    8 ++++++-
 source/lib/util_uuid.c                   |   10 +++++++-
 source/librpc/gen_ndr/srv_dfs.c          |    2 +-
 source/librpc/gen_ndr/srv_dssetup.c      |    2 +-
 source/librpc/gen_ndr/srv_echo.c         |    2 +-
 source/librpc/gen_ndr/srv_epmapper.c     |    2 +-
 source/librpc/gen_ndr/srv_eventlog.c     |    2 +-
 source/librpc/gen_ndr/srv_initshutdown.c |    2 +-
 source/librpc/gen_ndr/srv_lsa.c          |    2 +-
 source/librpc/gen_ndr/srv_netlogon.c     |    2 +-
 source/librpc/gen_ndr/srv_ntsvcs.c       |    2 +-
 source/librpc/gen_ndr/srv_samr.c         |    2 +-
 source/librpc/gen_ndr/srv_srvsvc.c       |    2 +-
 source/librpc/gen_ndr/srv_svcctl.c       |    2 +-
 source/librpc/gen_ndr/srv_winreg.c       |    2 +-
 source/librpc/gen_ndr/srv_wkssvc.c       |    2 +-
 source/librpc/ndr/ndr_misc.c             |    7 ++++++
 source/rpc_server/srv_eventlog.c         |    3 +-
 source/rpc_server/srv_ntsvcs.c           |    5 +++-
 source/rpc_server/srv_pipe.c             |   35 ++++++++++++++++++++---------
 source/rpc_server/srv_spoolss.c          |   13 ++++++++++-
 source/rpc_server/srv_svcctl.c           |    4 ++-
 22 files changed, 82 insertions(+), 31 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/proto.h b/source/include/proto.h
index f7f0836..03d203b 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -1815,6 +1815,7 @@ void smb_uuid_generate_random(struct GUID *uu);
 const char *smb_uuid_string(TALLOC_CTX *mem_ctx, const struct GUID uu);
 bool smb_string_to_uuid(const char *in, struct GUID* uu);
 char *guid_binstring(const struct GUID *guid);
+bool guid_equal(const struct GUID *g1, const struct GUID *g2);
 
 /* The following definitions come from lib/version.c  */
 
@@ -4101,6 +4102,8 @@ void ndr_print_PAC_BUFFER(struct ndr_print *ndr, const char *name, const struct
 
 bool all_zero(const uint8_t *ptr, size_t size);
 void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
+bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1,
+			 const struct ndr_syntax_id *i2);
 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r);
 enum ndr_err_code ndr_pull_server_id(struct ndr_pull *ndr, int ndr_flags, struct server_id *r);
 void ndr_print_server_id(struct ndr_print *ndr, const char *name, const struct server_id *r);
@@ -8806,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/source/lib/util_uuid.c b/source/lib/util_uuid.c
index 36c04e9..0d788ac 100644
--- a/source/lib/util_uuid.c
+++ b/source/lib/util_uuid.c
@@ -130,4 +130,12 @@ char *guid_binstring(const struct GUID *guid)
 	return binary_string_rfc2254((char *)guid_flat.info, UUID_FLAT_SIZE);
 }
 
-
+bool guid_equal(const struct GUID *g1, const struct GUID *g2)
+{
+	return ((g1->time_low == g2->time_low)
+		&& (g1->time_mid == g2->time_mid)
+		&& (g1->time_hi_and_version == g2->time_hi_and_version)
+		&& (memcmp(g1->clock_seq, g2->clock_seq,
+			   sizeof(g1->clock_seq)) == 0)
+		&& (memcmp(g1->node, g2->node, sizeof(g1->node)) == 0));
+}
diff --git a/source/librpc/gen_ndr/srv_dfs.c b/source/librpc/gen_ndr/srv_dfs.c
index 1ecd687..54b2184 100644
--- a/source/librpc/gen_ndr/srv_dfs.c
+++ b/source/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/source/librpc/gen_ndr/srv_dssetup.c b/source/librpc/gen_ndr/srv_dssetup.c
index 7a1cae9..79bde30 100644
--- a/source/librpc/gen_ndr/srv_dssetup.c
+++ b/source/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/source/librpc/gen_ndr/srv_echo.c b/source/librpc/gen_ndr/srv_echo.c
index 3f72504..b8b38da 100644
--- a/source/librpc/gen_ndr/srv_echo.c
+++ b/source/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/source/librpc/gen_ndr/srv_epmapper.c b/source/librpc/gen_ndr/srv_epmapper.c
index e6c89a5..f42598a 100644
--- a/source/librpc/gen_ndr/srv_epmapper.c
+++ b/source/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/source/librpc/gen_ndr/srv_eventlog.c b/source/librpc/gen_ndr/srv_eventlog.c
index 4d0722b..eb3fb1f 100644
--- a/source/librpc/gen_ndr/srv_eventlog.c
+++ b/source/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/source/librpc/gen_ndr/srv_initshutdown.c b/source/librpc/gen_ndr/srv_initshutdown.c
index f24530c..00a8966 100644
--- a/source/librpc/gen_ndr/srv_initshutdown.c
+++ b/source/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/source/librpc/gen_ndr/srv_lsa.c b/source/librpc/gen_ndr/srv_lsa.c
index 249bdc0..41d1c97 100644
--- a/source/librpc/gen_ndr/srv_lsa.c
+++ b/source/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/source/librpc/gen_ndr/srv_netlogon.c b/source/librpc/gen_ndr/srv_netlogon.c
index 67876f1..154ef71 100644
--- a/source/librpc/gen_ndr/srv_netlogon.c
+++ b/source/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/source/librpc/gen_ndr/srv_ntsvcs.c b/source/librpc/gen_ndr/srv_ntsvcs.c
index 523b4d8..d21e86d 100644
--- a/source/librpc/gen_ndr/srv_ntsvcs.c
+++ b/source/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/source/librpc/gen_ndr/srv_samr.c b/source/librpc/gen_ndr/srv_samr.c
index 3994587..1eaa19e 100644
--- a/source/librpc/gen_ndr/srv_samr.c
+++ b/source/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/source/librpc/gen_ndr/srv_srvsvc.c b/source/librpc/gen_ndr/srv_srvsvc.c
index 9f4055c..66faaaa 100644
--- a/source/librpc/gen_ndr/srv_srvsvc.c
+++ b/source/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/source/librpc/gen_ndr/srv_svcctl.c b/source/librpc/gen_ndr/srv_svcctl.c
index 264dea3..32317ad 100644
--- a/source/librpc/gen_ndr/srv_svcctl.c
+++ b/source/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/source/librpc/gen_ndr/srv_winreg.c b/source/librpc/gen_ndr/srv_winreg.c
index 4672944..c697f44 100644
--- a/source/librpc/gen_ndr/srv_winreg.c
+++ b/source/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/source/librpc/gen_ndr/srv_wkssvc.c b/source/librpc/gen_ndr/srv_wkssvc.c
index 90e6f48..227e4c1 100644
--- a/source/librpc/gen_ndr/srv_wkssvc.c
+++ b/source/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/source/librpc/ndr/ndr_misc.c b/source/librpc/ndr/ndr_misc.c
index 79761b9..f146816 100644
--- a/source/librpc/ndr/ndr_misc.c
+++ b/source/librpc/ndr/ndr_misc.c
@@ -43,6 +43,13 @@ void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *
 	ndr->print(ndr, "%-25s: %s", name, GUID_string(ndr, guid));
 }
 
+bool ndr_syntax_id_equal(const struct ndr_syntax_id *i1,
+			 const struct ndr_syntax_id *i2)
+{
+	return guid_equal(&i1->uuid, &i2->uuid)
+		&& (i1->if_version == i2->if_version);
+}
+
 enum ndr_err_code ndr_push_server_id(struct ndr_push *ndr, int ndr_flags, const struct server_id *r)
 {
 	if (ndr_flags & NDR_SCALARS) {
diff --git a/source/rpc_server/srv_eventlog.c b/source/rpc_server/srv_eventlog.c
index 5679a6a..da761c9 100644
--- a/source/rpc_server/srv_eventlog.c
+++ b/source/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/source/rpc_server/srv_ntsvcs.c b/source/rpc_server/srv_ntsvcs.c
index 12fffc3..100d577 100644
--- a/source/rpc_server/srv_ntsvcs.c
+++ b/source/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/source/rpc_server/srv_pipe.c b/source/rpc_server/srv_pipe.c
index 80e2b2f..48e6646 100644
--- a/source/rpc_server/srv_pipe.c
+++ b/source/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;
         
@@ -1565,16 +1570,32 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
 
 	DEBUG(5,("api_pipe_bind_req: decode request. %d\n", __LINE__));
 
+	ZERO_STRUCT(hdr_rb);
+
+	/* decode the bind request */
+
+	if(!smb_io_rpc_hdr_rb("", &hdr_rb, rpc_in_p, 0))  {
+		DEBUG(0,("api_pipe_bind_req: unable to unmarshall RPC_HDR_RB "
+			 "struct.\n"));
+		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;
 		}
@@ -1606,14 +1627,6 @@ bool api_pipe_bind_req(pipes_struct *p, prs_struct *rpc_in_p)
 		}
 	}
 
-	ZERO_STRUCT(hdr_rb);
-
-	/* decode the bind request */
-	if(!smb_io_rpc_hdr_rb("", &hdr_rb, rpc_in_p, 0))  {
-		DEBUG(0,("api_pipe_bind_req: unable to unmarshall RPC_HDR_RB struct.\n"));
-		goto err_exit;
-	}
-
 	/* name has to be \PIPE\xxxxx */
 	fstrcpy(ack_pipe_name, "\\PIPE\\");
 	fstrcat(ack_pipe_name, p->pipe_srv_name);
diff --git a/source/rpc_server/srv_spoolss.c b/source/rpc_server/srv_spoolss.c
index 7802fe4..4744b90 100644
--- a/source/rpc_server/srv_spoolss.c
+++ b/source/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/source/rpc_server/srv_svcctl.c b/source/rpc_server/srv_svcctl.c
index e3ff2cc..483fb8e 100644
--- a/source/rpc_server/srv_svcctl.c
+++ b/source/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));
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list