Mailing List Archive

Bug#59054: New option: "PrintLastLogin"
Package: openssh
Version: 1.2.2-1.1
Severity: wishlist

While the PrintMotd option allows deferring that feature to PAM,
there is no corresponding "PrintLastLogin" option.

... Or at least, there _was_ no such option, until now. :-)

Index: servconf.h
***************
*** 41,44 ****
--- 41,45 ----
int ignore_user_known_hosts; /* Ignore ~/.ssh/known_hosts
* for RhostsRsaAuth */
+ int print_last_login; /* If true, print last login. */
int print_motd; /* If true, print /etc/motd. */
int check_mail; /* If true, check for new mail. */

Index: servconf.c
*************** initialize_server_options(ServerOptions
*** 38,41 ****
--- 38,42 ----
options->ignore_rhosts = -1;
options->ignore_user_known_hosts = -1;
+ options->print_last_login = -1;
options->print_motd = -1;
options->check_mail = -1;
*************** fill_default_server_options(ServerOption
*** 93,96 ****
--- 94,99 ----
if (options->check_mail == -1)
options->check_mail = 0;
+ if (options->print_last_login == -1)
+ options->print_last_login = 1;
if (options->print_motd == -1)
options->print_motd = 1;
*************** typedef enum {
*** 156,161 ****
sSkeyAuthentication,
#endif
! sPasswordAuthentication, sListenAddress,
! sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset,
sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail,
sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
--- 159,164 ----
sSkeyAuthentication,
#endif
! sPasswordAuthentication, sListenAddress, sPrintLastLogin, sPrintMotd,
! sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset,
sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail,
sUseLogin, sAllowUsers, sDenyUsers, sAllowGroups, sDenyGroups,
*************** static struct {
*** 194,197 ****
--- 197,201 ----
{ "checkmail", sCheckMail },
{ "listenaddress", sListenAddress },
+ { "printlastlogin", sPrintLastLogin },
{ "printmotd", sPrintMotd },
{ "ignorerhosts", sIgnoreRhosts },
*************** parse_flag:
*** 454,457 ****
--- 458,465 ----
goto parse_flag;
#endif
+
+ case sPrintLastLogin:
+ intptr = &options->print_last_login;
+ goto parse_flag;

case sPrintMotd:

Index: sshd.8
***************
*** 384,387 ****
--- 384,398 ----
listens on. The default is 22.
Multiple options of this type are permitted.
+ .It Cm PrintLastLogin
+ Specifies whether
+ .Nm
+ should print the date and tty of last login when a user logs in
+ interactively. The default is
+ .Dq yes .
+ .Pp
+ Note: These messages can also be generated by PAM, so if you find that
+ you are getting the message twice, switch this one
+ .Dq off
+ and let PAM handle it.
.It Cm PrintMotd
Specifies whether

Index: sshd.c
*************** do_exec_pty(const char *command, int pty
*** 2260,2264 ****
*/
if (command == NULL && last_login_time != 0 && !quiet_login &&
! !options.use_login) {
/* Convert the date to a string. */
time_string = ctime(&last_login_time);
--- 2260,2264 ----
*/
if (command == NULL && last_login_time != 0 && !quiet_login &&
! options.print_last_login && !options.use_login) {
/* Convert the date to a string. */
time_string = ctime(&last_login_time);

--
Chip Salzenberg - a.k.a. - <chip@valinux.com>
"I wanted to play hopscotch with the impenetrable mystery of existence,
but he stepped in a wormhole and had to go in early." // MST3K