diff options
author | Jeremy Allison <jra@samba.org> | 2008-09-23 16:40:16 -0700 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2008-09-29 04:55:40 -0700 |
commit | cb2360315e0f40f45b37b7030b42e836afe26ccd (patch) | |
tree | 139dbfb81e10df093cc14d1cd060e80a2a9c072c /source | |
parent | 588ec10a297acd3d39b32c699afd49898759b8c9 (diff) | |
download | samba-cb2360315e0f40f45b37b7030b42e836afe26ccd.tar.gz samba-cb2360315e0f40f45b37b7030b42e836afe26ccd.tar.xz samba-cb2360315e0f40f45b37b7030b42e836afe26ccd.zip |
Fix winbindd crash in an unusual failure mode. Bug #5737. Based on original patch from shargagan@novell.com
Jeremy.
(cherry picked from commit d5c490d79024ee41544512f7968999a6b3a313dc)
Diffstat (limited to 'source')
-rw-r--r-- | source/winbindd/winbindd_dual.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/winbindd/winbindd_dual.c b/source/winbindd/winbindd_dual.c index f3b277cc84e..9e9a244acfb 100644 --- a/source/winbindd/winbindd_dual.c +++ b/source/winbindd/winbindd_dual.c @@ -196,10 +196,12 @@ static void async_request_fail(struct winbindd_async_request *state) TALLOC_FREE(state->reply_timeout_event); - SMB_ASSERT(state->child_pid != (pid_t)0); + /* If child exists and is not already reaped, + send kill signal to child. */ - /* If not already reaped, send kill signal to child. */ - if (state->child->pid == state->child_pid) { + if ((state->child->pid != (pid_t)0) && + (state->child->pid != (pid_t)-1) && + (state->child->pid == state->child_pid)) { kill(state->child_pid, SIGTERM); /* @@ -295,12 +297,14 @@ static void schedule_async_request(struct winbindd_child *child) } if ((child->pid == 0) && (!fork_domain_child(child))) { - /* Cancel all outstanding requests */ + /* fork_domain_child failed. + Cancel all outstanding requests */ while (request != NULL) { /* request might be free'd in the continuation */ struct winbindd_async_request *next = request->next; - request->continuation(request->private_data, False); + + async_request_fail(request); request = next; } return; |