|
Line
Link Here
|
| 0 |
-- mod_auth_shadow-1.3.orig/validate.c |
0 |
++ mod_auth_shadow-1.3/validate.c |
|
Lines 43-48
Link Here
|
| 43 |
char pw[MAX_PW_LENGTH+2]; |
42 |
char pw[MAX_PW_LENGTH+2]; |
| 44 |
char *cryptpw; |
43 |
char *cryptpw; |
| 45 |
char *progname; |
44 |
char *progname; |
|
|
45 |
long int secs, days; |
| 46 |
|
46 |
|
| 47 |
progname = argv[0]; |
47 |
progname = argv[0]; |
| 48 |
|
48 |
|
|
Lines 92-97
Link Here
|
| 92 |
if ( (SLEEP_SECONDS>0) && (sleep(SLEEP_SECONDS)!=0)) |
88 |
if ( (SLEEP_SECONDS>0) && (sleep(SLEEP_SECONDS)!=0)) |
| 93 |
fprintf(stderr,"%s: Error sleeping for %d seconds.\n", progname,SLEEP_SECONDS); |
89 |
fprintf(stderr,"%s: Error sleeping for %d seconds.\n", progname,SLEEP_SECONDS); |
| 94 |
fprintf(stderr,"%s: User %s: authentication failure\n",progname,user); |
90 |
fprintf(stderr,"%s: User %s: authentication failure\n",progname,user); |
|
|
91 |
exit(1); |
| 92 |
} |
| 93 |
|
| 94 |
/* |
| 95 |
* Check password expiration information. See shadow(5) |
| 96 |
*/ |
| 97 |
secs = (long int) time(NULL); |
| 98 |
days = secs / (24L * 60L * 60L); |
| 99 |
/* |
| 100 |
* An account is considered to be inactive and is disabled if the |
| 101 |
* password is not changed within the specified number of days after the |
| 102 |
* password expires. |
| 103 |
*/ |
| 104 |
if ( ret->sp_max > 0 |
| 105 |
&& ret->sp_inact > 0 |
| 106 |
&& ret->sp_lstchg != 0 |
| 107 |
&& days > (ret->sp_lstchg + ret->sp_max + ret->sp_inact)) { |
| 108 |
#ifdef LOG_FAILED_ATTEMPTS |
| 109 |
syslog(LOG_ERR,"VALIDATE: user: %s, Account inactivity period expired",user); |
| 110 |
#endif |
| 111 |
if ( (SLEEP_SECONDS>0) && (sleep(SLEEP_SECONDS)!=0)) |
| 112 |
fprintf(stderr,"%s: Error sleeping for %d seconds.\n", progname,SLEEP_SECONDS); |
| 113 |
fprintf(stderr,"%s: User %s: account inactivity period expired\n",progname,user); |
| 114 |
exit(1); |
| 115 |
} |
| 116 |
|
| 117 |
/* |
| 118 |
* An account will also be disabled on the specified day regardless of |
| 119 |
* other password expiration information. |
| 120 |
*/ |
| 121 |
if (ret->sp_expire > 0 && ret->sp_lstchg != 0 && days > ret->sp_expire) { |
| 122 |
#ifdef LOG_FAILED_ATTEMPTS |
| 123 |
syslog(LOG_ERR,"VALIDATE: user: %s, Account expired",user); |
| 124 |
#endif |
| 125 |
if ( (SLEEP_SECONDS>0) && (sleep(SLEEP_SECONDS)!=0)) |
| 126 |
fprintf(stderr,"%s: Error sleeping for %d seconds.\n", progname,SLEEP_SECONDS); |
| 127 |
fprintf(stderr,"%s: User %s: account expired\n",progname,user); |
| 95 |
exit(1); |
128 |
exit(1); |
| 96 |
} |
129 |
} |
| 97 |
exit(0); |
130 |
exit(0); |