diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2016-05-17 11:52:00 +0200 |
---|---|---|
committer | Lukas Slebodnik <lslebodn@redhat.com> | 2016-05-19 13:56:57 +0200 |
commit | de8815aba87d08b6b7ac5d502dcb1755787e0857 (patch) | |
tree | 32a7cf823321aa6ff5af4173d6613b06d89244ca /src/responder | |
parent | c2e3176eaff7c219d63f328570a79f6e5b6f4aec (diff) | |
download | sssd-de8815aba87d08b6b7ac5d502dcb1755787e0857.tar.gz sssd-de8815aba87d08b6b7ac5d502dcb1755787e0857.tar.xz sssd-de8815aba87d08b6b7ac5d502dcb1755787e0857.zip |
UTIL: exit() the forked process if exec()-ing a child process fails
When exec() fails, we should not attempt to continue, but just kill the
forked process. The patch adds this logic to the exec_child() and
exec_child_ex() functions to avoid code duplication
Resolves:
https://fedorahosted.org/sssd/ticket/3016
Reviewed-by: Lukáš Slebodník <lslebodn@redhat.com>
Diffstat (limited to 'src/responder')
-rw-r--r-- | src/responder/pam/pamsrv_p11.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/responder/pam/pamsrv_p11.c b/src/responder/pam/pamsrv_p11.c index 7a8002c28..d290283de 100644 --- a/src/responder/pam/pamsrv_p11.c +++ b/src/responder/pam/pamsrv_p11.c @@ -321,14 +321,12 @@ struct tevent_req *pam_check_cert_send(TALLOC_CTX *mem_ctx, child_pid = fork(); if (child_pid == 0) { /* child */ - ret = exec_child_ex(state, pipefd_to_child, pipefd_from_child, - P11_CHILD_PATH, child_debug_fd, extra_args, false, - STDIN_FILENO, STDOUT_FILENO); - if (ret != EOK) { - DEBUG(SSSDBG_CRIT_FAILURE, "Could not exec p11 child: [%d][%s].\n", - ret, strerror(ret)); - goto done; - } + exec_child_ex(state, pipefd_to_child, pipefd_from_child, + P11_CHILD_PATH, child_debug_fd, extra_args, false, + STDIN_FILENO, STDOUT_FILENO); + + /* We should never get here */ + DEBUG(SSSDBG_CRIT_FAILURE, "BUG: Could not exec p11 child\n"); } else if (child_pid > 0) { /* parent */ state->read_from_child_fd = pipefd_from_child[0]; |