summaryrefslogtreecommitdiffstats
path: root/usr.bin/login
diff options
context:
space:
mode:
authoreric <eric@FreeBSD.org>2001-05-17 03:10:04 +0000
committereric <eric@FreeBSD.org>2001-05-17 03:10:04 +0000
commit5d8c7438667676e1a77feff99a50c98444bd8792 (patch)
treedca754d4b58167013d45cf18340593ca854c3ec6 /usr.bin/login
parent9dc1e5fad0b6d266228b16e0492bfadbff689204 (diff)
downloadFreeBSD-src-5d8c7438667676e1a77feff99a50c98444bd8792.zip
FreeBSD-src-5d8c7438667676e1a77feff99a50c98444bd8792.tar.gz
Check for the expiration of an account and its password in the proper
order. Reviewed by: -audit (silence) Approved by: murray Obtained from: OpenBSD MFC after: 5 days
Diffstat (limited to 'usr.bin/login')
-rw-r--r--usr.bin/login/login.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/usr.bin/login/login.c b/usr.bin/login/login.c
index 7ddc948..fb7cff2 100644
--- a/usr.bin/login/login.c
+++ b/usr.bin/login/login.c
@@ -415,6 +415,19 @@ main(argc, argv)
#define DEFAULT_WARN (2L * 7L * 86400L) /* Two weeks */
+
+ warntime = login_getcaptime(lc, "warnexpire",
+ DEFAULT_WARN, DEFAULT_WARN);
+
+ if (pwd->pw_expire) {
+ if (tp.tv_sec >= pwd->pw_expire) {
+ refused("Sorry -- your account has expired",
+ "EXPIRED", 1);
+ } else if (pwd->pw_expire - tp.tv_sec < warntime && !quietlog)
+ (void)printf("Warning: your account expires on %s",
+ ctime(&pwd->pw_expire));
+ }
+
warntime = login_getcaptime(lc, "warnpassword",
DEFAULT_WARN, DEFAULT_WARN);
@@ -431,18 +444,6 @@ main(argc, argv)
ctime(&pwd->pw_change));
}
- warntime = login_getcaptime(lc, "warnexpire",
- DEFAULT_WARN, DEFAULT_WARN);
-
- if (pwd->pw_expire) {
- if (tp.tv_sec >= pwd->pw_expire) {
- refused("Sorry -- your account has expired",
- "EXPIRED", 1);
- } else if (pwd->pw_expire - tp.tv_sec < warntime && !quietlog)
- (void)printf("Warning: your account expires on %s",
- ctime(&pwd->pw_expire));
- }
-
if (lc != NULL) {
if (hostname) {
struct addrinfo hints, *res;
OpenPOWER on IntegriCloud