diff options
author | Simo Sorce <idra@samba.org> | 2011-07-21 09:53:10 -0400 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-07-21 18:40:23 +0200 |
commit | 759a04e58a88b400dbf0cafc2b86ab58ea196433 (patch) | |
tree | c3bb8258da0bf6c7c6366c56c890e3d5a995d2d6 /source3/rpc_server/rpc_handles.c | |
parent | 0d8f65b346592d98f4edbc1fa3905688c9677326 (diff) | |
download | samba-759a04e58a88b400dbf0cafc2b86ab58ea196433.tar.gz samba-759a04e58a88b400dbf0cafc2b86ab58ea196433.tar.bz2 samba-759a04e58a88b400dbf0cafc2b86ab58ea196433.zip |
s3-rpc_server: Move pipe/handles functions
Put InternalPipes related functions in rpc_handles.c and out of rpc_ncacn_np.c
rpc_handles.c is the only file that really uses them after all and ncacn_np.c
is the wrong place for that stuff.
While ther remove unnecessary wrapper functions now that the InternalPipes
static variable is directly accessible.
Also move all pipes_struct related header stuff in its own rpc_pipes.h header.
Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'source3/rpc_server/rpc_handles.c')
-rw-r--r-- | source3/rpc_server/rpc_handles.c | 70 |
1 files changed, 65 insertions, 5 deletions
diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index 3500a228d5..1fbee9e3c0 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -23,13 +23,75 @@ #include "../librpc/gen_ndr/ndr_lsa.h" #include "../librpc/gen_ndr/ndr_samr.h" #include "auth.h" -#include "ntdomain.h" -#include "rpc_server/rpc_ncacn_np.h" +#include "rpc_server/rpc_pipes.h" #include "../libcli/security/security.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_RPC_SRV +static struct pipes_struct *InternalPipes; + +/* TODO + * the following prototypes are declared here to avoid + * code being moved about too much for a patch to be + * disrupted / less obvious. + * + * these functions, and associated functions that they + * call, should be moved behind a .so module-loading + * system _anyway_. so that's the next step... + */ + +bool check_open_pipes(void) +{ + struct pipes_struct *p; + + for (p = InternalPipes; p != NULL; p = p->next) { + if (num_pipe_handles(p) != 0) { + return true; + } + } + return false; +} + +/**************************************************************************** + Close an rpc pipe. +****************************************************************************/ + +static void free_pipe_rpc_context_internal(struct pipe_rpc_fns *list) +{ + struct pipe_rpc_fns *tmp = list; + struct pipe_rpc_fns *tmp2; + + while (tmp) { + tmp2 = tmp->next; + SAFE_FREE(tmp); + tmp = tmp2; + } + + return; +} + +int close_internal_rpc_pipe_hnd(struct pipes_struct *p) +{ + if (!p) { + DEBUG(0,("Invalid pipe in close_internal_rpc_pipe_hnd\n")); + return False; + } + + TALLOC_FREE(p->auth.auth_ctx); + + /* Free the handles database. */ + close_policy_by_pipe(p); + + free_pipe_rpc_context_internal( p->contexts ); + + DLIST_REMOVE(InternalPipes, p); + + ZERO_STRUCTP(p); + + return 0; +} + /* * Handle database - stored per pipe. */ @@ -82,9 +144,7 @@ bool init_pipe_handles(struct pipes_struct *p, const struct ndr_syntax_id *synta struct pipes_struct *plist; struct handle_list *hl; - for (plist = get_first_internal_pipe(); - plist; - plist = get_next_internal_pipe(plist)) { + for (plist = InternalPipes; plist; plist = plist->next) { struct pipe_rpc_fns *p_ctx; bool stop = false; |