diff --git a/source3/winbindd/winbindd.h b/source3/winbindd/winbindd.h index 8f89e27..b7b9f1c 100644 --- a/source3/winbindd/winbindd.h +++ b/source3/winbindd/winbindd.h @@ -145,6 +145,7 @@ struct winbindd_child { struct tevent_timer *lockout_policy_event; struct tevent_timer *machine_password_change_event; + struct tevent_timer *check_to_exit_child_event; const struct winbindd_child_dispatch_table *table; }; diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index de254e9..2804251 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -1368,6 +1368,33 @@ static void child_handler(struct tevent_context *ev, struct tevent_fd *fde, } } +static void check_child_exit_handler(struct tevent_context *ctx, + struct tevent_timer *te, + struct timeval now, + void *private_data) +{ + struct winbindd_child *child = (struct winbindd_child *)private_data; + + DEBUG(10,("check_child_exit_handler called %d \n", + (int)tevent_queue_length(child->queue))); + + TALLOC_FREE(child->check_to_exit_child_event); + + if (tevent_queue_length(child->queue) <= 1 ) { + DEBUG(1, ("Exiting child : from check_child_exit_handler \n")); + exit(1); + } + + /* re-install timer */ + + child->check_to_exit_child_event = tevent_add_timer(winbind_event_context(), NULL, + timeval_current_ofs(3*60, 0), + check_child_exit_handler, + child); + +} + + static bool fork_domain_child(struct winbindd_child *child) { int fdpair[2]; @@ -1549,6 +1576,15 @@ static bool fork_domain_child(struct winbindd_child *child) _exit(1); } + if (!child->check_to_exit_child_event) { + + child->check_to_exit_child_event = tevent_add_timer( + winbind_event_context(), NULL, + timeval_current_ofs(3*60, 0), + check_child_exit_handler, + child); + } + while (1) { int ret;