pam/pam-0.99.3.0-tally-fail-close.patch
Tomáš Mráz 94d78f5a6d - the namespace instance init script is now in /etc/security (#190148)
- pam_namespace: added missing braces (#190026)
- pam_tally(2): never call fclose twice on the same FILE (from upstream)
2006-05-04 11:51:03 +00:00

53 lines
1.5 KiB
Diff

--- Linux-PAM-0.99.3.0/modules/pam_tally2/pam_tally.c.fail-close 2006-05-04 13:33:30.000000000 +0200
+++ Linux-PAM-0.99.3.0/modules/pam_tally2/pam_tally.c 2006-05-04 13:34:11.000000000 +0200
@@ -342,6 +342,7 @@
}
lstat_ret = fstat(fileno(*tfile),&fileinfo);
fclose(*tfile);
+ *tfile = NULL;
}
if ( lstat_ret ) {
@@ -372,6 +373,7 @@
if (fseek(*tfile, uid*sizeof(*tally), SEEK_SET)) {
pam_syslog(pamh, LOG_ALERT, "fseek failed for %s: %m", filename);
fclose(*tfile);
+ *tfile = NULL;
return PAM_AUTH_ERR;
}
@@ -407,6 +409,7 @@
}
if (fclose(*tfile)) {
+ *tfile = NULL;
pam_syslog(pamh, LOG_ALERT, "update (fclose) failed for %s: %m", filename);
return PAM_AUTH_ERR;
}
--- Linux-PAM-0.99.3.0/modules/pam_tally/pam_tally.c.fail-close 2005-09-21 15:35:29.000000000 +0200
+++ Linux-PAM-0.99.3.0/modules/pam_tally/pam_tally.c 2006-05-04 13:31:59.000000000 +0200
@@ -318,6 +318,7 @@
}
lstat_ret = fstat(fileno(*TALLY),&fileinfo);
fclose(*TALLY);
+ *TALLY = NULL;
}
if ( lstat_ret ) {
@@ -348,6 +349,7 @@
if ( fseek( *TALLY, uid * sizeof(struct faillog), SEEK_SET ) ) {
pam_syslog(pamh, LOG_ALERT, "fseek failed for %s", filename);
fclose(*TALLY);
+ *TALLY = NULL;
return PAM_AUTH_ERR;
}
@@ -394,6 +396,7 @@
}
if ( fclose(*TALLY) ) {
+ *TALLY = NULL;
pam_syslog(pamh, LOG_ALERT, "update (fclose) failed for %s", filename);
return PAM_AUTH_ERR;
}