From 34a600a27f5b288a9185b6d32c7252b9f5a81a09 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 31 May 2011 10:28:39 +0200 Subject: s3-rpc_server: Move the context functions to own file. --- source3/Makefile.in | 3 ++- source3/rpc_server/rpc_contexts.c | 40 +++++++++++++++++++++++++++++++++++++++ source3/rpc_server/rpc_contexts.h | 28 +++++++++++++++++++++++++++ source3/rpc_server/srv_pipe.c | 21 +------------------- source3/rpc_server/wscript_build | 2 +- 5 files changed, 72 insertions(+), 22 deletions(-) create mode 100644 source3/rpc_server/rpc_contexts.c create mode 100644 source3/rpc_server/rpc_contexts.h diff --git a/source3/Makefile.in b/source3/Makefile.in index c768a402d4..f95fbeb461 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -727,7 +727,8 @@ NPA_TSTREAM_OBJ = ../libcli/named_pipe_auth/npa_tstream.o \ ../auth/auth_sam_reply.o librpc/gen_ndr/ndr_auth.o ../librpc/ndr/ndr_auth.o RPC_NCACN_NP = rpc_server/srv_pipe_register.o rpc_server/rpc_ncacn_np.o \ - rpc_server/rpc_handles.o rpc_server/srv_access_check.o + rpc_server/rpc_handles.o rpc_server/rpc_contexts.o \ + rpc_server/srv_access_check.o RPC_SERVICE = rpc_server/rpc_server.o diff --git a/source3/rpc_server/rpc_contexts.c b/source3/rpc_server/rpc_contexts.c new file mode 100644 index 0000000000..bb5c0eaf6c --- /dev/null +++ b/source3/rpc_server/rpc_contexts.c @@ -0,0 +1,40 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Almost completely rewritten by (C) Jeremy Allison 2005 - 2010 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include "includes.h" +#include "ntdomain.h" + +#include "rpc_contexts.h" + +struct pipe_rpc_fns *find_pipe_fns_by_context(struct pipe_rpc_fns *list, + uint32_t context_id) +{ + struct pipe_rpc_fns *fns = NULL; + + if ( !list ) { + DEBUG(0,("find_pipe_fns_by_context: ERROR! No context list for pipe!\n")); + return NULL; + } + + for (fns=list; fns; fns=fns->next ) { + if ( fns->context_id == context_id ) + return fns; + } + return NULL; +} diff --git a/source3/rpc_server/rpc_contexts.h b/source3/rpc_server/rpc_contexts.h new file mode 100644 index 0000000000..8463414bbb --- /dev/null +++ b/source3/rpc_server/rpc_contexts.h @@ -0,0 +1,28 @@ +/* + * Unix SMB/CIFS implementation. + * RPC Pipe client / server routines + * Almost completely rewritten by (C) Jeremy Allison 2005 - 2010 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef _RPC_SERVER_RPC_CONTEXTS_H_ +#define _RPC_SERVER_RPC_CONTEXTS_H_ + +struct pipe_rpc_fns; + +struct pipe_rpc_fns *find_pipe_fns_by_context(struct pipe_rpc_fns *list, + uint32_t context_id); + +#endif /* _RPC_SERVER_RPC_CONTEXTS_H_*/ diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index a6e43b65ec..1af8cdac07 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -42,6 +42,7 @@ #include "auth.h" #include "ntdomain.h" #include "rpc_server/srv_pipe.h" +#include "rpc_server/rpc_contexts.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV @@ -1509,26 +1510,6 @@ static bool api_pipe_alter_context(struct pipes_struct *p, return setup_bind_nak(p, pkt); } -/**************************************************************************** - Find the set of RPC functions associated with this context_id -****************************************************************************/ - -static PIPE_RPC_FNS* find_pipe_fns_by_context( PIPE_RPC_FNS *list, uint32 context_id ) -{ - PIPE_RPC_FNS *fns = NULL; - - if ( !list ) { - DEBUG(0,("find_pipe_fns_by_context: ERROR! No context list for pipe!\n")); - return NULL; - } - - for (fns=list; fns; fns=fns->next ) { - if ( fns->context_id == context_id ) - return fns; - } - return NULL; -} - static bool api_rpcTNP(struct pipes_struct *p, struct ncacn_packet *pkt, const struct api_struct *api_rpc_cmds, int n_cmds); diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build index eba52a1b25..0e557a4bb7 100644 --- a/source3/rpc_server/wscript_build +++ b/source3/rpc_server/wscript_build @@ -26,7 +26,7 @@ bld.SAMBA3_SUBSYSTEM('rpc', vars=locals()) bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP', - source='rpc_ncacn_np.c rpc_handles.c', + source='rpc_ncacn_np.c rpc_handles.c rpc_contexts.c', deps='auth_sam_reply RPC_PIPE_REGISTER AUTH_COMMON npa_tstream') bld.SAMBA3_SUBSYSTEM('RPC_SERVICE', -- cgit