diff options
author | Thorsten Kukuk <kukuk@thkukuk.de> | 2004-09-22 09:37:46 +0000 |
---|---|---|
committer | Thorsten Kukuk <kukuk@thkukuk.de> | 2004-09-22 09:37:46 +0000 |
commit | 6e99aa00d23a68650fdd4fae01aab812dcfe10eb (patch) | |
tree | 0b929b30fa38ed1d402515fbf9d7d8cf6dcb5284 /modules/pam_tally | |
parent | e1f75a80821125170e23a9b920d138a4a952c708 (diff) | |
download | linux-pam-git-6e99aa00d23a68650fdd4fae01aab812dcfe10eb.tar.gz |
Relevant BUGIDs:
Purpose of commit:
Commit summary:
---------------
bugfix: Add rest of Steve Grubb's resource leak and other fixes
Diffstat (limited to 'modules/pam_tally')
-rw-r--r-- | modules/pam_tally/pam_tally.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/pam_tally/pam_tally.c b/modules/pam_tally/pam_tally.c index 3da37f40..27fe0b37 100644 --- a/modules/pam_tally/pam_tally.c +++ b/modules/pam_tally/pam_tally.c @@ -109,7 +109,7 @@ static char *cline_user=0; /* cline_user is used in the administration prog */ static int pam_get_uid( pam_handle_t *pamh, uid_t *uid, const char **userp ) { - const char *user; + const char *user = NULL; struct passwd *pw; #ifdef MAIN @@ -189,7 +189,8 @@ static int get_tally( tally_t *tally, if ( fseek( *TALLY, uid * sizeof(struct faillog), SEEK_SET ) ) { _pam_log(LOG_ALERT, "fseek failed %s", filename); - return PAM_AUTH_ERR; + fclose(*TALLY); + return PAM_AUTH_ERR; } if ( fileinfo.st_size <= uid * sizeof(struct faillog) ) { @@ -527,6 +528,8 @@ PAM_FUNCTION( pam_sm_acct_mgmt ) { user,uid, fsp->fs_fail_time+fsp->fs_faillog.fail_locktime -time(NULL)); + if (TALLY) + fclose(TALLY); return PAM_AUTH_ERR; } } @@ -537,6 +540,8 @@ PAM_FUNCTION( pam_sm_acct_mgmt ) { ) { _pam_log(LOG_NOTICE,"user %s ("UID_FMT") tally "TALLY_FMT", deny "TALLY_FMT, user, uid, tally, deny); + if (TALLY) + fclose(TALLY); return PAM_AUTH_ERR; /* Only unconditional failure */ } |