summaryrefslogtreecommitdiff
path: root/modules/pam_namespace
diff options
context:
space:
mode:
authorikerexxe <ipedrosa@redhat.com>2020-06-29 15:40:40 +0200
committerDmitry V. Levin <ldv@altlinux.org>2020-07-01 09:54:22 +0000
commit2bae5daf16d4466185fac89539d653b269a3ea01 (patch)
treedea0eb06840d2d3115df076d90680b0e6a174de6 /modules/pam_namespace
parenta6a1b9f788a79b2a09827c72a755f471c2e05100 (diff)
pam_namespace, pam_mkhomedir: fix unlikely descriptor leaks on error path
[ldv: rewrote commit message] * modules/pam_mkhomedir/mkhomedir_helper.c (create_homedir): Close just opened file descriptor "srcfd" in an unlikely case when it cannot be fstat'ed. * modules/pam_namespace/pam_namespace.c (create_instance): Close just opened file descriptor "fd" in an unlikely case when it cannot be fstat'ed.
Diffstat (limited to 'modules/pam_namespace')
-rw-r--r--modules/pam_namespace/pam_namespace.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c
index 63b5c665..57b322fe 100644
--- a/modules/pam_namespace/pam_namespace.c
+++ b/modules/pam_namespace/pam_namespace.c
@@ -1488,6 +1488,7 @@ static int create_instance(struct polydir_s *polyptr, char *ipath, struct stat *
if (fstat(fd, &newstatbuf) < 0) {
pam_syslog(idata->pamh, LOG_ERR, "Error stating %s, %m",
ipath);
+ close(fd);
rmdir(ipath);
return PAM_SESSION_ERR;
}