summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-01-07 17:36:54 +0100
committerVolker Lendecke <vl@samba.org>2009-01-08 22:29:53 +0100
commit5a4f71d40cbcfc67802fb2cbc45d8d74a9312342 (patch)
tree2a7c6938f38a3122da56e6e57a624879aed2cd48 /source3
parent8cddcefb134ce33b853f45c7512aa78b5d720f23 (diff)
downloadsamba-5a4f71d40cbcfc67802fb2cbc45d8d74a9312342.tar.gz
samba-5a4f71d40cbcfc67802fb2cbc45d8d74a9312342.tar.bz2
samba-5a4f71d40cbcfc67802fb2cbc45d8d74a9312342.zip
Simplify init_pipe_handle_list a bit
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/srv_lsa_hnd.c49
1 files changed, 26 insertions, 23 deletions
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 ));