diff options
author | Michael Adam <obnox@samba.org> | 2012-03-15 16:29:27 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2012-03-15 18:41:37 +0100 |
commit | c80f70390c3763d5d7248979db9542cd05b7cb44 (patch) | |
tree | a0f96da41205705839cec1dead1fc1762051a2e5 /source3/winbindd | |
parent | e5ebe67e3837cf4da0ae2c3d00c72a244b8f202f (diff) | |
download | samba-c80f70390c3763d5d7248979db9542cd05b7cb44.tar.gz samba-c80f70390c3763d5d7248979db9542cd05b7cb44.tar.bz2 samba-c80f70390c3763d5d7248979db9542cd05b7cb44.zip |
s3:smbd: let smbd/nmbd/winbindd child processes terminate if the parent process died.
This applies to all child processes making use of reinit_after_fork().
It is implemented by establishing a pipe between parent and child.
The child watches for EOF on the read end of the pipe, indidcating
an exited parent.
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/winbindd')
-rw-r--r-- | source3/winbindd/winbindd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index d1d36fd007..66e53d9cae 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -1461,6 +1461,17 @@ int main(int argc, char **argv, char **envp) exit(1); } + /* + * Do not initialize the parent-child-pipe before becoming + * a daemon: this is used to detect a died parent in the child + * process. + */ + status = init_before_fork(); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("init_before_fork failed: %s\n", nt_errstr(status))); + exit(1); + } + winbindd_register_handlers(!Fork); status = init_system_info(); |