summaryrefslogtreecommitdiff
path: root/modules/pam_pwhistory/opasswd.c
diff options
context:
space:
mode:
authorTomas Mraz <tm@t8m.info>2009-03-24 16:33:21 +0000
committerTomas Mraz <tm@t8m.info>2009-03-24 16:33:21 +0000
commit1e56491f0e1cbd07fc0eb0fbfdf5982eced366a6 (patch)
tree6d4211caa00fc345c645ee4405661e1c0b90a159 /modules/pam_pwhistory/opasswd.c
parent72855d240704c34326c9ae2db56e18f926218b3b (diff)
Relevant BUGIDs:
Purpose of commit: bugfix Commit summary: --------------- 2009-03-24 Tomas Mraz <t8m@centrum.cz> * modules/pam_unix/passverify.c(save_old_password): Call fflush() and fsync(). (unix_update_passwd, unix_update_shadow): Likewise. * modules/pam_pwhistory/opasswd.c(save_old_password): Likewise.
Diffstat (limited to 'modules/pam_pwhistory/opasswd.c')
-rw-r--r--modules/pam_pwhistory/opasswd.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/pam_pwhistory/opasswd.c b/modules/pam_pwhistory/opasswd.c
index fd4cd251..dbcd04e3 100644
--- a/modules/pam_pwhistory/opasswd.c
+++ b/modules/pam_pwhistory/opasswd.c
@@ -452,6 +452,15 @@ save_old_password (pam_handle_t *pamh, const char *user, uid_t uid,
goto error_opasswd;
}
+ if (fflush (newpf) != 0 || fsync (fileno (newpf)) != 0)
+ {
+ pam_syslog (pamh, LOG_ERR,
+ "Error while syncing temporary opasswd file: %m");
+ retval = PAM_AUTHTOK_ERR;
+ fclose (newpf);
+ goto error_opasswd;
+ }
+
if (fclose (newpf) != 0)
{
pam_syslog (pamh, LOG_ERR,