Changeset 40

Show
Ignore:
Timestamp:
05/18/07 16:09:53 (2 years ago)
Author:
csellers
Message:

Initial support for multiple timestamps in the file format. This only keeps track of them and functions as before. It does not provide the new option yet.

Files:

Legend:

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

    r37 r40  
    516516               lock_time applies */ 
    517517            tally->fail_cnt = oldcnt; 
    518             tally->fail_time = oldtime; 
     518            /* TODO check for out of fail_time bounds */ 
     519            tally->fail_time[oldcnt] = 0; 
    519520 
    520521            if (!(opts->ctrl & OPT_QUIET)) { 
     
    564565 
    565566    /* to remember old fail time (for locktime) */ 
    566     if (oldtime) { 
    567         *oldtime = (time_t)tally.fail_time; 
     567    if (oldtime && tally.fail_cnt > 0) { 
     568        /* TODO check for out of fail_time bounds */ 
     569        *oldtime = (time_t)tally.fail_time[tally.fail_cnt-1]; 
    568570    } 
    569571     
    570     tally.fail_time = time(NULL); 
     572    /* TODO check for out of fail_time bounds */ 
     573    tally.fail_time[tally.fail_cnt] = time(NULL); 
    571574 
    572575    (void) pam_get_item(pamh, PAM_RHOST, &remote_host); 
     
    820823 
    821824   pwent = getpwuid(uid); 
    822    fail_time = tally->fail_time; 
     825   /* TODO check for out of fail_time bounds */ 
     826   fail_time = tally->fail_time[tally->fail_cnt-1]; 
    823827   tm = localtime(&fail_time); 
    824828   strftime (ptime, sizeof (ptime), "%D %H:%M:%S", tm); 
     
    832836   } 
    833837   printf ("%-15.15s %5hu    ", username, tally->fail_cnt); 
    834    if (tally->fail_time) { 
     838   if (fail_time) { 
    835839        printf ("%-17.17s  %s", cp, tally->fail_line); 
    836840   } 
  • trunk/RHEL5/pam_tally2/tallylog.h

    r37 r40  
    4646        uint16_t        reserved;       /* reserved for future use */ 
    4747        uint16_t        fail_cnt;       /* failures since last success */ 
    48         uint64_t        fail_time;     /* time of last failure */ 
     48        uint64_t        fail_time[9];  /* time of previous failures */ 
    4949}; 
    5050/* 64 bytes / entry */