[PATCH] decouple RPC modules from get_pipe_fns()

James Peach jpeach at samba.org
Sat Jan 27 03:13:57 GMT 2007


On 25/01/2007, at 11:32 PM, James Peach wrote:

> On 25/01/2007, at 11:19 PM, James Peach wrote:
>
>> Hi Jerry,
>>
>> This patch is the first step in making the RPC modules dynamically  
>> loadable. Rather than having get_pipe_fns() reach into the modules  
>> directly, we now register the pipe index along with the names and  
>> API callbacks.
>>
>> Can you please review?
>
> Here it is again, with a sensible mime type :)
>
> <remove-pipe-fns-accessors.txt>

And here's the corresponding SAMBA_3_0 and pidl patches. The  
SAMBA_3_0 preserves the interesting LSA pipe proxying AFAICT ...

-------------- next part --------------
Index: SAMBA_3_0/source/rpc_server/srv_lsa_ds.c
===================================================================
--- SAMBA_3_0/source/rpc_server/srv_lsa_ds.c	(revision 21034)
+++ SAMBA_3_0/source/rpc_server/srv_lsa_ds.c	(working copy)
@@ -79,15 +79,10 @@
 
 };
 
-void lsa_ds_get_pipe_fns( struct api_struct **fns, int *n_fns )
-{
-	*fns = api_lsa_ds_cmds;
-	*n_fns = sizeof(api_lsa_ds_cmds) / sizeof(struct api_struct);
-}
 
-
 NTSTATUS rpc_lsa_ds_init(void)
 {
-	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "lsa_ds", "lsa_ds", api_lsa_ds_cmds,
-		sizeof(api_lsa_ds_cmds) / sizeof(struct api_struct));
+	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
+			PI_LSARPC_DS, "lsa_ds", "lsa_ds",
+			api_lsa_ds_cmds, ARRAY_SIZE(api_lsa_ds_cmds));
 }
Index: SAMBA_3_0/source/rpc_server/srv_lsa.c
===================================================================
--- SAMBA_3_0/source/rpc_server/srv_lsa.c	(revision 21034)
+++ SAMBA_3_0/source/rpc_server/srv_lsa.c	(working copy)
@@ -35,7 +35,7 @@
 	struct api_struct *fns;
 	int n_fns;
 
-	lsarpc_get_pipe_fns(&fns, &n_fns);
+	get_pipe_fns(PI_LSARPC_GEN, &fns, &n_fns);
 
 	if (opnum >= n_fns)
 		return False;
@@ -1054,17 +1054,10 @@
 
 	return funcs;
 }
-void lsa_get_pipe_fns( struct api_struct **fns, int *n_fns )
-{
-	*fns = api_lsa_cmds;
-	*n_fns = count_fns();
-}
 
-
 NTSTATUS rpc_lsa_init(void)
 {
-	int funcs = count_fns();
-
-	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "lsarpc", "lsass", api_lsa_cmds, 
-		funcs);
+	rpc_lsarpc_init();
+	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, PI_LSARPC,
+		"lsarpc", "lsass", api_lsa_cmds, count_fns());
 }
Index: SAMBA_3_0/source/rpc_server/srv_ntsvcs.c
===================================================================
--- SAMBA_3_0/source/rpc_server/srv_ntsvcs.c	(revision 21034)
+++ SAMBA_3_0/source/rpc_server/srv_ntsvcs.c	(working copy)
@@ -206,15 +206,9 @@
       { "NTSVCS_HW_PROFILE_FLAGS"         , NTSVCS_HW_PROFILE_FLAGS         , api_ntsvcs_hw_profile_flags }
 };
 
-
-void ntsvcs_get_pipe_fns( struct api_struct **fns, int *n_fns )
-{
-	*fns = api_ntsvcs_cmds;
-	*n_fns = sizeof(api_ntsvcs_cmds) / sizeof(struct api_struct);
-}
-
 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,
+		    PI_NTSVCS, "ntsvcs", "ntsvcs",
+		    api_ntsvcs_cmds, ARRAY_SIZE(api_ntsvcs_cmds));
 }
Index: SAMBA_3_0/source/rpc_server/srv_eventlog.c
===================================================================
--- SAMBA_3_0/source/rpc_server/srv_eventlog.c	(revision 21034)
+++ SAMBA_3_0/source/rpc_server/srv_eventlog.c	(working copy)
@@ -189,12 +189,6 @@
 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));
+			PI_EVENTLOG, "eventlog", "eventlog",
+			api_eventlog_cmds, ARRAY_SIZE(api_eventlog_cmds));
 }
-
-void eventlog_get_pipe_fns(struct api_struct **fns, int *n_fns)
-{
-	*fns = api_eventlog_cmds;
-	*n_fns = sizeof(api_eventlog_cmds) / sizeof(struct api_struct);
-}
Index: SAMBA_3_0/source/rpc_server/srv_netlog.c
===================================================================
--- SAMBA_3_0/source/rpc_server/srv_netlog.c	(revision 21034)
+++ SAMBA_3_0/source/rpc_server/srv_netlog.c	(working copy)
@@ -393,14 +393,9 @@
 #endif	/* JERRY */
     };
 
-void netlog_get_pipe_fns( struct api_struct **fns, int *n_fns )
-{
-	*fns = api_net_cmds;
-	*n_fns = sizeof(api_net_cmds) / sizeof(struct api_struct);
-}
-
 NTSTATUS rpc_net_init(void)
 {
-  return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "NETLOGON", "lsass", api_net_cmds,
-				    sizeof(api_net_cmds) / sizeof(struct api_struct));
+	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
+			PI_NETLOGON, "NETLOGON", "lsass",
+			api_net_cmds, ARRAY_SIZE(api_net_cmds));
 }
Index: SAMBA_3_0/source/rpc_server/srv_pipe.c
===================================================================
--- SAMBA_3_0/source/rpc_server/srv_pipe.c	(revision 21034)
+++ SAMBA_3_0/source/rpc_server/srv_pipe.c	(working copy)
@@ -712,6 +712,7 @@
 
 struct rpc_table {
 	struct {
+		int pnum; /* pipe number, a PI_* constant */
 		const char *clnt;
 		const char *srv;
 	} pipe;
@@ -1036,7 +1037,9 @@
  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, int pnum,
+		const char *clnt, const char *srv,
+		const struct api_struct *cmds, int ncmds)
 {
         struct rpc_table *rpc_entry;
 
@@ -1074,14 +1077,17 @@
         
         rpc_entry = rpc_lookup + (rpc_lookup_size - 1);
         ZERO_STRUCTP(rpc_entry);
+	rpc_entry->pipe.pnum = pnum;
         rpc_entry->pipe.clnt = SMB_STRDUP(clnt);
         rpc_entry->pipe.srv = SMB_STRDUP(srv);
-        rpc_entry->cmds = SMB_REALLOC_ARRAY(rpc_entry->cmds, struct api_struct, rpc_entry->n_cmds + size);
+        rpc_entry->cmds = SMB_REALLOC_ARRAY(rpc_entry->cmds,
+			    struct api_struct, rpc_entry->n_cmds + ncmds);
 	if (!rpc_entry->cmds) {
 		return NT_STATUS_NO_MEMORY;
 	}
-        memcpy(rpc_entry->cmds + rpc_entry->n_cmds, cmds, size * sizeof(struct api_struct));
-        rpc_entry->n_cmds += size;
+        memcpy(rpc_entry->cmds + rpc_entry->n_cmds, cmds,
+		ncmds * sizeof(struct api_struct));
+        rpc_entry->n_cmds += ncmds;
         
         return NT_STATUS_OK;
 }
@@ -2348,60 +2354,27 @@
 
 void get_pipe_fns( int idx, struct api_struct **fns, int *n_fns )
 {
-	struct api_struct *cmds = NULL;
-	int               n_cmds = 0;
+	int i;
+  
+	for (i = 0; i < rpc_lookup_size; i++) {
 
-	switch ( idx ) {
-		case PI_LSARPC:
-			lsa_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_LSARPC_DS:
-			lsa_ds_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_SAMR:
-			samr_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_NETLOGON:
-			netlog_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_SRVSVC:
-			srvsvc_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_WKSSVC:
-			wkssvc_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_WINREG:
-			winreg_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_SPOOLSS:
-			spoolss_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_NETDFS:
-			netdfs_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_SVCCTL:
-			svcctl_get_pipe_fns( &cmds, &n_cmds );
-			break;
-	        case PI_EVENTLOG:
-			eventlog_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_UNIXINFO:
-			unixinfo_get_pipe_fns( &cmds, &n_cmds );
-			break;
-		case PI_NTSVCS:
-			ntsvcs_get_pipe_fns( &cmds, &n_cmds );
-			break;
-#ifdef DEVELOPER
-		case PI_RPCECHO:
-			rpcecho_get_pipe_fns( &cmds, &n_cmds );
-			break;
+		/* We only grant access to the echo pipe if we
+		 * were built in developer mode.
+		 */
+#if !defined(DEVELOPER)
+	        if (rpc_lookup[i].pipe.pnum == PI_RPCECHO) {
+			continue;
+		}
 #endif
-		default:
-			DEBUG(0,("get_pipe_fns: Unknown pipe index! [%d]\n", idx));
+
+	        if (rpc_lookup[i].pipe.pnum == idx) {
+			*fns = rpc_lookup[i].cmds;
+			*n_fns = rpc_lookup[i].n_cmds;
+			return;
+		}
 	}
 
-	*fns = cmds;
-	*n_fns = n_cmds;
-
+	DEBUG(0,("get_pipe_fns: Unknown pipe index! [%d]\n", idx));
 	return;
 }
+
Index: SAMBA_3_0/source/rpc_server/srv_svcctl.c
===================================================================
--- SAMBA_3_0/source/rpc_server/srv_svcctl.c	(revision 21034)
+++ SAMBA_3_0/source/rpc_server/srv_svcctl.c	(working copy)
@@ -431,15 +431,9 @@
       { "SVCCTL_SET_SERVICE_SEC"            , SVCCTL_SET_SERVICE_SEC            , api_svcctl_set_security_sec }
 };
 
-
-void svcctl_get_pipe_fns( struct api_struct **fns, int *n_fns )
-{
-	*fns = api_svcctl_cmds;
-	*n_fns = sizeof(api_svcctl_cmds) / sizeof(struct api_struct);
-}
-
 NTSTATUS rpc_svcctl_init(void)
 {
-  return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "svcctl", "ntsvcs", api_svcctl_cmds,
-				    sizeof(api_svcctl_cmds) / sizeof(struct api_struct));
+	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
+		    PI_SVCCTL, "svcctl", "ntsvcs",
+		    api_svcctl_cmds, ARRAY_SIZE(api_svcctl_cmds));
 }
Index: SAMBA_3_0/source/rpc_server/srv_samr.c
===================================================================
--- SAMBA_3_0/source/rpc_server/srv_samr.c	(revision 21034)
+++ SAMBA_3_0/source/rpc_server/srv_samr.c	(working copy)
@@ -1558,15 +1558,9 @@
       {"SAMR_CONNECT5"          , SAMR_CONNECT5         , api_samr_connect5         }
 };
 
-void samr_get_pipe_fns( struct api_struct **fns, int *n_fns )
-{
-	*fns = api_samr_cmds;
-	*n_fns = sizeof(api_samr_cmds) / sizeof(struct api_struct);
-}
-
-
 NTSTATUS rpc_samr_init(void)
 {
-  return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "samr", "lsass", api_samr_cmds,
-				    sizeof(api_samr_cmds) / sizeof(struct api_struct));
+	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
+		    PI_SAMR, "samr", "lsass",
+		    api_samr_cmds, ARRAY_SIZE(api_samr_cmds));
 }
Index: SAMBA_3_0/source/rpc_server/srv_spoolss.c
===================================================================
--- SAMBA_3_0/source/rpc_server/srv_spoolss.c	(revision 21034)
+++ SAMBA_3_0/source/rpc_server/srv_spoolss.c	(working copy)
@@ -1607,14 +1607,9 @@
  {"SPOOLSS_XCVDATAPORT",               SPOOLSS_XCVDATAPORT,               api_spoolss_xcvdataport               },
 };
 
-void spoolss_get_pipe_fns( struct api_struct **fns, int *n_fns )
-{
-	*fns = api_spoolss_cmds;
-	*n_fns = sizeof(api_spoolss_cmds) / sizeof(struct api_struct);
-}
-
 NTSTATUS rpc_spoolss_init(void)
 {
-  return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "spoolss", "spoolss", api_spoolss_cmds,
-				    sizeof(api_spoolss_cmds) / sizeof(struct api_struct));
+	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
+		    PI_SPOOLSS, "spoolss", "spoolss",
+		    api_spoolss_cmds, ARRAY_SIZE(api_spoolss_cmds));
 }
Index: SAMBA_3_0/source/include/smb.h
===================================================================
--- SAMBA_3_0/source/include/smb.h	(revision 21034)
+++ SAMBA_3_0/source/include/smb.h	(working copy)
@@ -208,7 +208,9 @@
 #define PI_EVENTLOG 		12
 #define PI_UNIXINFO		13
 #define PI_NTSVCS		14
-#define PI_MAX_PIPES		15
+/* Temporary pipe index until srv_lsa is fully handled in only one place. */
+#define PI_LSARPC_GEN		15
+#define PI_MAX_PIPES		16
 
 /* 64 bit time (100usec) since ????? - cifs6.txt, section 3.5, page 30 */
 typedef uint64_t NTTIME;
Index: SAMBA_3_0/source/librpc/gen_ndr/srv_winreg.c
===================================================================
--- SAMBA_3_0/source/librpc/gen_ndr/srv_winreg.c	(revision 21034)
+++ SAMBA_3_0/source/librpc/gen_ndr/srv_winreg.c	(working copy)
@@ -2445,13 +2445,9 @@
 	{"WINREG_QUERYMULTIPLEVALUES2", DCERPC_WINREG_QUERYMULTIPLEVALUES2, api_winreg_QueryMultipleValues2},
 };
 
-void winreg_get_pipe_fns(struct api_struct **fns, int *n_fns)
-{
-	*fns = api_winreg_cmds;
-	*n_fns = sizeof(api_winreg_cmds) / sizeof(struct api_struct);
-}
-
 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,
+		PI_WINREG, "winreg", "winreg",
+		api_winreg_cmds, ARRAY_SIZE(api_winreg_cmds));
 }
Index: SAMBA_3_0/source/librpc/gen_ndr/srv_lsa.c
===================================================================
--- SAMBA_3_0/source/librpc/gen_ndr/srv_lsa.c	(revision 21034)
+++ SAMBA_3_0/source/librpc/gen_ndr/srv_lsa.c	(working copy)
@@ -5604,13 +5604,9 @@
 	{"LSA_LSARADTREPORTSECURITYEVENT", DCERPC_LSA_LSARADTREPORTSECURITYEVENT, api_lsa_LSARADTREPORTSECURITYEVENT},
 };
 
-void lsarpc_get_pipe_fns(struct api_struct **fns, int *n_fns)
-{
-	*fns = api_lsarpc_cmds;
-	*n_fns = sizeof(api_lsarpc_cmds) / sizeof(struct api_struct);
-}
-
 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, 
+		PI_LSARPC_GEN, "lsarpc_gen", "lsarpc_gen",
+		api_lsarpc_cmds, ARRAY_SIZE(api_lsarpc_cmds));
 }
Index: SAMBA_3_0/source/librpc/gen_ndr/srv_wkssvc.c
===================================================================
--- SAMBA_3_0/source/librpc/gen_ndr/srv_wkssvc.c	(revision 21034)
+++ SAMBA_3_0/source/librpc/gen_ndr/srv_wkssvc.c	(working copy)
@@ -2061,13 +2061,9 @@
 	{"WKSSVC_NETRENUMERATECOMPUTERNAMES", DCERPC_WKSSVC_NETRENUMERATECOMPUTERNAMES, api_WKSSVC_NETRENUMERATECOMPUTERNAMES},
 };
 
-void wkssvc_get_pipe_fns(struct api_struct **fns, int *n_fns)
-{
-	*fns = api_wkssvc_cmds;
-	*n_fns = sizeof(api_wkssvc_cmds) / sizeof(struct api_struct);
-}
-
 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,
+			PI_WKSSVC, "wkssvc", "wkssvc",
+			api_wkssvc_cmds, ARRAY_SIZE(api_wkssvc_cmds));
 }
Index: SAMBA_3_0/source/librpc/gen_ndr/srv_dfs.c
===================================================================
--- SAMBA_3_0/source/librpc/gen_ndr/srv_dfs.c	(revision 21034)
+++ SAMBA_3_0/source/librpc/gen_ndr/srv_dfs.c	(working copy)
@@ -1527,13 +1527,9 @@
 	{"DFS_SETINFO2", DCERPC_DFS_SETINFO2, api_dfs_SetInfo2},
 };
 
-void netdfs_get_pipe_fns(struct api_struct **fns, int *n_fns)
-{
-	*fns = api_netdfs_cmds;
-	*n_fns = sizeof(api_netdfs_cmds) / sizeof(struct api_struct);
-}
-
 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,
+		PI_NETDFS, "netdfs", "netdfs",
+		api_netdfs_cmds, ARRAY_SIZE(api_netdfs_cmds));
 }
Index: SAMBA_3_0/source/librpc/gen_ndr/srv_srvsvc.c
===================================================================
--- SAMBA_3_0/source/librpc/gen_ndr/srv_srvsvc.c	(revision 21034)
+++ SAMBA_3_0/source/librpc/gen_ndr/srv_srvsvc.c	(working copy)
@@ -3706,13 +3706,9 @@
 	{"SRVSVC_NETRSERVERTRANSPORTDELEX", DCERPC_SRVSVC_NETRSERVERTRANSPORTDELEX, api_srvsvc_NETRSERVERTRANSPORTDELEX},
 };
 
-void srvsvc_get_pipe_fns(struct api_struct **fns, int *n_fns)
-{
-	*fns = api_srvsvc_cmds;
-	*n_fns = sizeof(api_srvsvc_cmds) / sizeof(struct api_struct);
-}
-
 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,
+		PI_SRVSVC, "srvsvc", "srvsvc",
+		api_srvsvc_cmds, ARRAY_SIZE(api_srvsvc_cmds));
 }
Index: SAMBA_3_0/source/librpc/gen_ndr/srv_initshutdown.c
===================================================================
--- SAMBA_3_0/source/librpc/gen_ndr/srv_initshutdown.c	(revision 21034)
+++ SAMBA_3_0/source/librpc/gen_ndr/srv_initshutdown.c	(working copy)
@@ -207,13 +207,9 @@
 	{"INITSHUTDOWN_INITEX", DCERPC_INITSHUTDOWN_INITEX, api_initshutdown_InitEx},
 };
 
-void initshutdown_get_pipe_fns(struct api_struct **fns, int *n_fns)
-{
-	*fns = api_initshutdown_cmds;
-	*n_fns = sizeof(api_initshutdown_cmds) / sizeof(struct api_struct);
-}
-
 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,
+		PI_INITSHUTDOWN, "initshutdown", "initshutdown",
+		api_initshutdown_cmds, ARRAY_SIZE(api_initshutdown_cmds));
 }
Index: SAMBA_3_0/source/librpc/gen_ndr/srv_unixinfo.c
===================================================================
--- SAMBA_3_0/source/librpc/gen_ndr/srv_unixinfo.c	(revision 21034)
+++ SAMBA_3_0/source/librpc/gen_ndr/srv_unixinfo.c	(working copy)
@@ -373,13 +373,9 @@
 	{"UNIXINFO_GETPWUID", DCERPC_UNIXINFO_GETPWUID, api_unixinfo_GetPWUid},
 };
 
-void unixinfo_get_pipe_fns(struct api_struct **fns, int *n_fns)
-{
-	*fns = api_unixinfo_cmds;
-	*n_fns = sizeof(api_unixinfo_cmds) / sizeof(struct api_struct);
-}
-
 NTSTATUS rpc_unixinfo_init(void)
 {
-	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, "unixinfo", "unixinfo", api_unixinfo_cmds, sizeof(api_unixinfo_cmds) / sizeof(struct api_struct));
+	return rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,
+		PI_UNIXINFO, "unixinfo", "unixinfo",
+		api_unixinfo_cmds, ARRAY_SIZE(api_unixinfo_cmds));
 }
-------------- next part --------------
Index: SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm
===================================================================
--- SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm	(revision 21034)
+++ SAMBA_4_0/source/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm	(working copy)
@@ -202,7 +202,10 @@
 	my $if = shift;
 
 	my $uif = uc($if->{NAME});
+	my $pipe_index = "PI_$if->{NAME}";
 
+	$pipe_index =~ tr/a-z/A-Z/;
+
 	pidl_hdr "#ifndef __SRV_$uif\__";
 	pidl_hdr "#define __SRV_$uif\__";
 	ParseFunction($if, $_) foreach (@{$if->{FUNCTIONS}});
@@ -222,20 +225,13 @@
 
 	pidl "";
 
-	pidl_hdr "void $if->{NAME}_get_pipe_fns(struct api_struct **fns, int *n_fns);";
-	pidl "void $if->{NAME}_get_pipe_fns(struct api_struct **fns, int *n_fns)";
-	pidl "{";
-	indent;
-	pidl "*fns = api_$if->{NAME}_cmds;";
-	pidl "*n_fns = sizeof(api_$if->{NAME}_cmds) / sizeof(struct api_struct);";
-	deindent;
-	pidl "}";
-	pidl "";
-
 	pidl_hdr "NTSTATUS rpc_$if->{NAME}_init(void);";
 	pidl "NTSTATUS rpc_$if->{NAME}_init(void)";
 	pidl "{";
-	pidl "\treturn rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION, \"$if->{NAME}\", \"$if->{NAME}\", api_$if->{NAME}_cmds, sizeof(api_$if->{NAME}_cmds) / sizeof(struct api_struct));";
+	pidl
+	    "\treturn rpc_pipe_register_commands(SMB_RPC_INTERFACE_VERSION,\n".
+	    "\t\t$pipe_index, \"$if->{NAME}\", \"$if->{NAME}\",\n".
+	    "\t\tapi_$if->{NAME}_cmds, ARRAY_SIZE(api_$if->{NAME}_cmds));";
 	pidl "}";
 
 	pidl_hdr "#endif /* __SRV_$uif\__ */";
-------------- next part --------------


--
James Peach | jpeach at samba.org




More information about the samba-technical mailing list