summaryrefslogtreecommitdiff
path: root/modules/pam_filter
diff options
context:
space:
mode:
authorRobin Hack <rhack@redhat.com>2014-08-25 17:30:01 +0200
committerTomas Mraz <tmraz@fedoraproject.org>2014-08-25 17:30:01 +0200
commitbbe948ae58314ce3395d39e0fe49cdba309c29df (patch)
tree4f6c663b4eaeb85fabb1453620a374c2834f1c0e /modules/pam_filter
parent8514bfe08da3912fce8b6c17c39ef20af136a087 (diff)
pam_filter: Avoid leaking descriptors when fork() fails.
modules/pam_filter/pam_filter.c (set_filter): Close descriptors when fork() fails.
Diffstat (limited to 'modules/pam_filter')
-rw-r--r--modules/pam_filter/pam_filter.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/pam_filter/pam_filter.c b/modules/pam_filter/pam_filter.c
index da98148f..9935d994 100644
--- a/modules/pam_filter/pam_filter.c
+++ b/modules/pam_filter/pam_filter.c
@@ -341,6 +341,11 @@ set_filter (pam_handle_t *pamh, int flags UNUSED, int ctrl,
pam_syslog(pamh, LOG_WARNING, "first fork failed: %m");
if (aterminal) {
(void) tcsetattr(STDIN_FILENO, TCSAFLUSH, &stored_mode);
+ close(fd[0]);
+ } else {
+ /* Socket pair */
+ close(fd[0]);
+ close(fd[1]);
}
return PAM_AUTH_ERR;