1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Simplify the RPC servers: remove get_pipe_fns

The per-server xxx_get_pipe_fns functions can go once all the RPC servers are
converted
This commit is contained in:
Volker Lendecke 2008-07-16 00:03:49 +02:00
parent 3ab2e7fada
commit 6aa2391cbe
3 changed files with 26 additions and 99 deletions

View 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;

View 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 */

View 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;
}