Simplify the RPC servers: remove get_pipe_fns
authorVolker Lendecke <vl@samba.org>
Tue, 15 Jul 2008 22:03:49 +0000 (00:03 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 18 Jul 2008 13:04:05 +0000 (15:04 +0200)
The per-server xxx_get_pipe_fns functions can go once all the RPC servers are
converted

source/include/ntdomain.h
source/include/proto.h
source/rpc_server/srv_pipe.c

index 1829b19c772dff3cfc3581a05c3ac5ef3f5ee58e..23bbe9aba26b0fe55f1415085f2b08379150c3b1 100644 (file)
@@ -157,7 +157,7 @@ typedef struct pipe_rpc_fns {
        
        /* RPC function table associated with the current rpc_bind (associated by context) */
        
-       struct api_struct *cmds;
+       const struct api_struct *cmds;
        int n_cmds;
        uint32 context_id;
        
index 3c3d5018df326dee0a91468deff934ec8f139c54..209bc0704edddd567d749e9b64e598b8359d764d 100644 (file)
@@ -8825,7 +8825,6 @@ void free_pipe_rpc_context( PIPE_RPC_FNS *list );
 bool api_pipe_request(pipes_struct *p);
 bool api_rpcTNP(pipes_struct *p, const char *rpc_name, 
                const struct api_struct *api_rpc_cmds, int n_cmds);
-void get_pipe_fns( int idx, struct api_struct **fns, int *n_fns );
 
 /* The following definitions come from rpc_server/srv_pipe_hnd.c  */
 
index 48e6646c7529e635da396f291374f0d5db9446fb..fa8fffa3503641b33e60921cc4bb7632efb01725 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "includes.h"
 
-extern struct pipe_id_info pipe_names[];
 extern struct current_user current_user;
 
 #undef DBGC_CLASS
@@ -986,53 +985,42 @@ 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)
 {
-       char *pipe_name = p->name;
        int i=0;
-       fstring pname;
-       
-       fstrcpy(pname,"\\PIPE\\");
-       fstrcat(pname,pipe_name);
+       struct pipe_rpc_fns *context_fns;
 
-       DEBUG(3,("check_bind_req for %s\n", pname));
+       DEBUG(3,("check_bind_req for %s\n", p->name));
 
        /* we have to check all now since win2k introduced a new UUID on the lsaprpc pipe */
-               
-       for ( i=0; pipe_names[i].client_pipe; i++ ) {
-               DEBUGADD(10,("checking %s\n", pipe_names[i].client_pipe));
-               if ( strequal(pipe_names[i].client_pipe, pname)
-                       && (abstract->if_version == pipe_names[i].abstr_syntax->if_version) 
-                       && (memcmp(&abstract->uuid, &pipe_names[i].abstr_syntax->uuid, sizeof(struct GUID)) == 0)
-                       && (transfer->if_version == pipe_names[i].trans_syntax->if_version)
-                       && (memcmp(&transfer->uuid, &pipe_names[i].trans_syntax->uuid, sizeof(struct GUID)) == 0) ) {
-                       struct api_struct       *fns = NULL;
-                       int                     n_fns = 0;
-                       PIPE_RPC_FNS            *context_fns;
-                       
-                       if ( !(context_fns = SMB_MALLOC_P(PIPE_RPC_FNS)) ) {
-                               DEBUG(0,("check_bind_req: malloc() failed!\n"));
-                               return False;
-                       }
-                       
-                       /* save the RPC function table associated with this bind */
-                       
-                       get_pipe_fns(i, &fns, &n_fns);
-                       
-                       context_fns->cmds = fns;
-                       context_fns->n_cmds = n_fns;
-                       context_fns->context_id = context_id;
-                       
-                       /* add to the list of open contexts */
-                       
-                       DLIST_ADD( p->contexts, context_fns );
-                       
+
+       for (i=0; i<rpc_lookup_size; i++) {
+               DEBUGADD(10, ("checking %s\n", rpc_lookup[i].pipe.clnt));
+               if (strequal(rpc_lookup[i].pipe.clnt, p->name)
+                   && ndr_syntax_id_equal(
+                           abstract, &rpc_lookup[i].rpc_interface)
+                   && ndr_syntax_id_equal(
+                           transfer, &ndr_transfer_syntax)) {
                        break;
                }
        }
 
-       if(pipe_names[i].client_pipe == NULL) {
+       if (i == rpc_lookup_size) {
+               return false;
+       }
+
+       context_fns = SMB_MALLOC_P(struct pipe_rpc_fns);
+       if (context_fns == NULL) {
+               DEBUG(0,("check_bind_req: malloc() failed!\n"));
                return False;
        }
 
+       context_fns->cmds = rpc_lookup[i].cmds;
+       context_fns->n_cmds = rpc_lookup[i].n_cmds;
+       context_fns->context_id = context_id;
+
+       /* add to the list of open contexts */
+
+       DLIST_ADD( p->contexts, context_fns );
+
        return True;
 }
 
@@ -2393,63 +2381,3 @@ bool api_rpcTNP(pipes_struct *p, const char *rpc_name,
 
        return True;
 }
-
-/*******************************************************************
-*******************************************************************/
-
-void get_pipe_fns( int idx, struct api_struct **fns, int *n_fns )
-{
-       struct api_struct *cmds = NULL;
-       int               n_cmds = 0;
-
-       switch ( idx ) {
-               case PI_LSARPC:
-                       lsarpc_get_pipe_fns( &cmds, &n_cmds );
-                       break;
-               case PI_DSSETUP:
-                       dssetup_get_pipe_fns( &cmds, &n_cmds );
-                       break;
-               case PI_SAMR:
-                       samr_get_pipe_fns( &cmds, &n_cmds );
-                       break;
-               case PI_NETLOGON:
-                       netlogon_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:
-                       svcctl2_get_pipe_fns( &cmds, &n_cmds );
-                       break;
-               case PI_EVENTLOG:
-                       eventlog2_get_pipe_fns( &cmds, &n_cmds );
-                       break;
-               case PI_NTSVCS:
-                       ntsvcs2_get_pipe_fns( &cmds, &n_cmds );
-                       break;
-#ifdef DEVELOPER
-               case PI_RPCECHO:
-                       rpcecho_get_pipe_fns( &cmds, &n_cmds );
-                       break;
-#endif
-               default:
-                       DEBUG(0,("get_pipe_fns: Unknown pipe index! [%d]\n", idx));
-       }
-
-       *fns = cmds;
-       *n_fns = n_cmds;
-
-       return;
-}