Date: Sun, 30 Mar 1997 16:59:38 +0400 (MSD) From: Sergei Chechetkin <csl@whale.sunbay.crimea.ua> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/3144: ~/.hushlogin and expire time checks don't work in /usr/bin/login Message-ID: <199703301259.QAA07163@whale.sunbay.crimea.ua> Resent-Message-ID: <199703301400.GAA25561@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 3144
>Category: bin
>Synopsis: ~/.hushlogin and expire time checks don't work in /usr/bin/login
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Sun Mar 30 06:00:01 PST 1997
>Last-Modified:
>Originator: Sergei Chechetkin
>Organization:
Sunbay Development Group
>Release: FreeBSD 3.0-CURRENT i386
>Environment:
>Description:
Due to misplaced figure brackets code that checks for existing
~/.hushlogin and expire time is executed only if pw->pw_dir
has incorrect value. Code is not executed in normal way.
Points are against revision 1.23 of usr.bin/login/login.c
Line 538:
if (chdir("/") < 0) {
refused("Cannot find root directory", "ROOTDIR", 1);
pwd->pw_dir = "/";
if (!quietlog || *pwd->pw_dir)
here is first incorrect bracket
Line 561:
if (tp.tv_sec >= pwd->pw_change) {
(void)printf("Sorry -- your password has expired.\n");
changepass=1;
syslog(LOG_INFO,
"%s Password expired - forcing change",
pwd->pw_name);
} else if (pwd->pw_change - tp.tv_sec < warntime && !quietlog)
(void)printf("Warning: your password expires on %s",
ctime(&pwd->pw_change));
}
^
as we can see this bracket must not be here. it's reverse
bracket. so code compiles correctly but /usr/bin/login does not
work as it must.
>How-To-Repeat:
Create .hushlogin in your home directory and relogin.
Motd, last login time, etc are still shown.
>Fix:
Patch that removes two incorrect brackets:
*** login.c.orig Sun Mar 30 16:49:35 1997
--- login.c Sun Mar 30 16:49:50 1997
***************
*** 535,541 ****
if (login_getcapbool(lc, "requirehome", !rootlogin))
refused("Home directory not available", "HOMEDIR", 1);
#endif
! if (chdir("/") < 0) {
refused("Cannot find root directory", "ROOTDIR", 1);
pwd->pw_dir = "/";
if (!quietlog || *pwd->pw_dir)
--- 535,541 ----
if (login_getcapbool(lc, "requirehome", !rootlogin))
refused("Home directory not available", "HOMEDIR", 1);
#endif
! if (chdir("/") < 0)
refused("Cannot find root directory", "ROOTDIR", 1);
pwd->pw_dir = "/";
if (!quietlog || *pwd->pw_dir)
***************
*** 567,573 ****
} else if (pwd->pw_change - tp.tv_sec < warntime && !quietlog)
(void)printf("Warning: your password expires on %s",
ctime(&pwd->pw_change));
- }
}
#ifdef LOGIN_CAP
--- 567,572 ----
>Audit-Trail:
>Unformatted:
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703301259.QAA07163>
