mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
Fix bug #5504. winbindd children and parent were handing SIGTERM in the same way - deleting the socket!
Jeremy.
(This used to be commit 3ab5a3883e
)
This commit is contained in:
parent
a991c5a7c3
commit
908812e98d
@ -131,15 +131,20 @@ static void flush_caches(void)
|
|||||||
|
|
||||||
/* Handle the signal by unlinking socket and exiting */
|
/* Handle the signal by unlinking socket and exiting */
|
||||||
|
|
||||||
static void terminate(void)
|
static void terminate(bool is_parent)
|
||||||
{
|
{
|
||||||
char *path = NULL;
|
if (is_parent) {
|
||||||
|
/* When parent goes away we should
|
||||||
|
* remove the socket file. Not so
|
||||||
|
* when children terminate.
|
||||||
|
*/
|
||||||
|
char *path = NULL;
|
||||||
|
|
||||||
/* Remove socket file */
|
if (asprintf(&path, "%s/%s",
|
||||||
if (asprintf(&path, "%s/%s",
|
|
||||||
get_winbind_pipe_dir(), WINBINDD_SOCKET_NAME) > 0) {
|
get_winbind_pipe_dir(), WINBINDD_SOCKET_NAME) > 0) {
|
||||||
unlink(path);
|
unlink(path);
|
||||||
SAFE_FREE(path);
|
SAFE_FREE(path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
idmap_close();
|
idmap_close();
|
||||||
@ -810,10 +815,10 @@ void winbind_check_sighup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if TERM has been received */
|
/* check if TERM has been received */
|
||||||
void winbind_check_sigterm(void)
|
void winbind_check_sigterm(bool is_parent)
|
||||||
{
|
{
|
||||||
if (do_sigterm)
|
if (do_sigterm)
|
||||||
terminate();
|
terminate(is_parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process incoming clients on listen_sock. We use a tricky non-blocking,
|
/* Process incoming clients on listen_sock. We use a tricky non-blocking,
|
||||||
@ -975,7 +980,7 @@ static void process_loop(void)
|
|||||||
|
|
||||||
/* Check signal handling things */
|
/* Check signal handling things */
|
||||||
|
|
||||||
winbind_check_sigterm();
|
winbind_check_sigterm(true);
|
||||||
winbind_check_sighup();
|
winbind_check_sighup();
|
||||||
|
|
||||||
if (do_sigusr2) {
|
if (do_sigusr2) {
|
||||||
|
@ -1097,7 +1097,7 @@ static bool fork_domain_child(struct winbindd_child *child)
|
|||||||
TALLOC_CTX *frame = talloc_stackframe();
|
TALLOC_CTX *frame = talloc_stackframe();
|
||||||
|
|
||||||
/* check for signals */
|
/* check for signals */
|
||||||
winbind_check_sigterm();
|
winbind_check_sigterm(false);
|
||||||
winbind_check_sighup();
|
winbind_check_sighup();
|
||||||
|
|
||||||
run_events(winbind_event_context(), 0, NULL, NULL);
|
run_events(winbind_event_context(), 0, NULL, NULL);
|
||||||
|
@ -67,7 +67,7 @@ void request_error(struct winbindd_cli_state *state);
|
|||||||
void request_ok(struct winbindd_cli_state *state);
|
void request_ok(struct winbindd_cli_state *state);
|
||||||
void request_finished_cont(void *private_data, bool success);
|
void request_finished_cont(void *private_data, bool success);
|
||||||
void winbind_check_sighup(void);
|
void winbind_check_sighup(void);
|
||||||
void winbind_check_sigterm(void);
|
void winbind_check_sigterm(bool in_parent);
|
||||||
int main(int argc, char **argv, char **envp);
|
int main(int argc, char **argv, char **envp);
|
||||||
|
|
||||||
/* The following definitions come from winbindd/winbindd_ads.c */
|
/* The following definitions come from winbindd/winbindd_ads.c */
|
||||||
|
Loading…
Reference in New Issue
Block a user