From 5a4f71d40cbcfc67802fb2cbc45d8d74a9312342 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 7 Jan 2009 17:36:54 +0100 Subject: Simplify init_pipe_handle_list a bit --- source3/rpc_server/srv_lsa_hnd.c | 49 +++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 23 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_lsa_hnd.c b/source3/rpc_server/srv_lsa_hnd.c index 839833ce54..a00e097596 100644 --- a/source3/rpc_server/srv_lsa_hnd.c +++ b/source3/rpc_server/srv_lsa_hnd.c @@ -46,35 +46,38 @@ static bool is_samr_lsa_pipe(const char *pipe_name) bool init_pipe_handle_list(pipes_struct *p, const char *pipe_name) { - pipes_struct *plist = get_first_internal_pipe(); - struct handle_list *hl = NULL; - - for (plist = get_first_internal_pipe(); plist; plist = get_next_internal_pipe(plist)) { - if (strequal( plist->name, pipe_name) || - (is_samr_lsa_pipe(plist->name) && is_samr_lsa_pipe(pipe_name))) { - if (!plist->pipe_handles) { - char *msg; - if (asprintf(&msg, "init_pipe_handles: NULL " - "pipe_handle pointer in pipe %s", - pipe_name) != -1) { - smb_panic(msg); - } else { - smb_panic("init_pipe_handle_list"); - } - } - hl = plist->pipe_handles; + pipes_struct *plist; + struct handle_list *hl; + + for (plist = get_first_internal_pipe(); + plist; + plist = get_next_internal_pipe(plist)) { + if (strequal(plist->name, pipe_name)) { + break; + } + if (is_samr_lsa_pipe(plist->name) + && is_samr_lsa_pipe(pipe_name)) { + /* + * samr and lsa share a handle space (same process + * under Windows?) + */ break; } } - if (!hl) { + if (plist != NULL) { + hl = plist->pipe_handles; + if (hl == NULL) { + return false; + } + } else { /* - * No handle list for this pipe (first open of pipe). - * Create list. + * First open, we have to create the handle list */ - - if ((hl = SMB_MALLOC_P(struct handle_list)) == NULL) - return False; + hl = SMB_MALLOC_P(struct handle_list); + if (hl == NULL) { + return false; + } ZERO_STRUCTP(hl); DEBUG(10,("init_pipe_handles: created handle list for pipe %s\n", pipe_name )); -- cgit