diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2022-07-16 08:00:00 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2022-07-16 08:00:00 +0000 |
commit | e91b8cd57663b132f53a4e2fc0497dc4afd52efb (patch) | |
tree | 733e18d02de41572c6dd89c02a45216a25c63fb3 /modules/pam_mkhomedir | |
parent | 6a55b0ceced0a926c366c87b371f6131874aabc6 (diff) | |
download | pam-e91b8cd57663b132f53a4e2fc0497dc4afd52efb.tar.gz pam-e91b8cd57663b132f53a4e2fc0497dc4afd52efb.tar.bz2 pam-e91b8cd57663b132f53a4e2fc0497dc4afd52efb.zip |
pam_mkhomedir: make sure the SIGCHLD handler is not reset too early
* modules/pam_mkhomedir/pam_mkhomedir.c (create_homedir): Make sure
the SIGCHLD handler is not reset too early by moving the sigaction
call right before the fork call.
Diffstat (limited to 'modules/pam_mkhomedir')
-rw-r--r-- | modules/pam_mkhomedir/pam_mkhomedir.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/modules/pam_mkhomedir/pam_mkhomedir.c b/modules/pam_mkhomedir/pam_mkhomedir.c index 48e578fa..6ddcd5a8 100644 --- a/modules/pam_mkhomedir/pam_mkhomedir.c +++ b/modules/pam_mkhomedir/pam_mkhomedir.c @@ -125,15 +125,6 @@ create_homedir (pam_handle_t *pamh, options_t *opt, D(("called.")); - /* - * This code arranges that the demise of the child does not cause - * the application to receive a signal it is not expecting - which - * may kill the application or worse. - */ - memset(&newsa, '\0', sizeof(newsa)); - newsa.sa_handler = SIG_DFL; - sigaction(SIGCHLD, &newsa, &oldsa); - if (opt->ctrl & MKHOMEDIR_DEBUG) { pam_syslog(pamh, LOG_DEBUG, "Executing mkhomedir_helper."); } @@ -153,6 +144,15 @@ create_homedir (pam_handle_t *pamh, options_t *opt, login_homemode = _pam_conv_str_umask_to_homemode(opt->umask); } + /* + * This code arranges that the demise of the child does not cause + * the application to receive a signal it is not expecting - which + * may kill the application or worse. + */ + memset(&newsa, '\0', sizeof(newsa)); + newsa.sa_handler = SIG_DFL; + sigaction(SIGCHLD, &newsa, &oldsa); + /* fork */ child = fork(); if (child == 0) { |