Changeset 46

Show
Ignore:
Timestamp:
05/22/07 21:48:53 (2 years ago)
Author:
csellers
Message:

oops, previous checkin doens't work when there is not previous failure. this fixes it

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/RHEL5/pam_tally2/pam_tally.c

    r45 r46  
    574574    } 
    575575 
    576     last_fail = (tally.fail_cnt>TALLYLOG_FAIL_TIME_COUNT) ? 
    577                 TALLYLOG_FAIL_TIME_COUNT-1 : 
    578                 tally.fail_cnt-1; 
     576    if (tally.fail_cnt) { 
     577        last_fail = (tally.fail_cnt>TALLYLOG_FAIL_TIME_COUNT) ? 
     578                     TALLYLOG_FAIL_TIME_COUNT-1 : 
     579                     tally.fail_cnt-1; 
     580    } 
     581    else { 
     582        last_fail = 0; 
     583    } 
    579584 
    580585    /* to remember old fail time (for locktime) */ 
    581     if (oldtime && last_fail >= 0) { 
     586    if (oldtime) { 
    582587        *oldtime = (time_t)tally.fail_time[last_fail]; 
    583588    } 
    584589     
    585590    last_fail = (tally.fail_cnt>=TALLYLOG_FAIL_TIME_COUNT) ? 
    586                TALLYLOG_FAIL_TIME_COUNT-1 : 
    587                tally.fail_cnt; 
     591                 TALLYLOG_FAIL_TIME_COUNT-1 : 
     592                 tally.fail_cnt; 
    588593 
    589594    tally.fail_time[last_fail] = time(NULL);