aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mraz <tm@t8m.info>2009-06-01 07:07:35 +0000
committerTomas Mraz <tm@t8m.info>2009-06-01 07:07:35 +0000
commit87d1508a7362e2f213a90b30a6e5bd72f47d6060 (patch)
treeb6b77fc925d52d3c507f2cd3d2eebe7a2482c5c8
parentfbd40f8764ac17611e1e7f9464565a1b3e7792a2 (diff)
downloadpam-87d1508a7362e2f213a90b30a6e5bd72f47d6060.tar.gz
pam-87d1508a7362e2f213a90b30a6e5bd72f47d6060.tar.bz2
pam-87d1508a7362e2f213a90b30a6e5bd72f47d6060.zip
Relevant BUGIDs:
Purpose of commit: bugfix Commit summary: --------------- 2009-06-01 Tomáš Mráz <t8m@centrum.cz> * modules/pam_pwhistory/opasswd.c (save_old_password): Don't call fclose() on NULL descriptor. Found by Steve Grubb.
-rw-r--r--ChangeLog5
-rw-r--r--modules/pam_pwhistory/opasswd.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 105be775..9172391c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-01 Tomáš Mráz <t8m@centrum.cz>
+
+ * modules/pam_pwhistory/opasswd.c (save_old_password): Don't
+ call fclose() on NULL descriptor. Found by Steve Grubb.
+
2009-06-01 Ville Skyttä <ville.skytta@iki.fi>
* modules/pam_limits/pam_limits.8.xml: Only *.conf
diff --git a/modules/pam_pwhistory/opasswd.c b/modules/pam_pwhistory/opasswd.c
index dbcd04e3..3c8e5cff 100644
--- a/modules/pam_pwhistory/opasswd.c
+++ b/modules/pam_pwhistory/opasswd.c
@@ -244,7 +244,8 @@ save_old_password (pam_handle_t *pamh, const char *user, uid_t uid,
{
pam_syslog (pamh, LOG_ERR, "Cannot create %s temp file: %m",
OLD_PASSWORDS_FILE);
- fclose (oldpf);
+ if (oldpf)
+ fclose (oldpf);
return PAM_AUTHTOK_ERR;
}
if (do_create)
@@ -273,7 +274,8 @@ save_old_password (pam_handle_t *pamh, const char *user, uid_t uid,
if (newpf == NULL)
{
pam_syslog (pamh, LOG_ERR, "Cannot fdopen %s: %m", opasswd_tmp);
- fclose (oldpf);
+ if (oldpf)
+ fclose (oldpf);
close (newpf_fd);
retval = PAM_AUTHTOK_ERR;
goto error_opasswd;