summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2002-07-26 02:20:00 +0000
committerache <ache@FreeBSD.org>2002-07-26 02:20:00 +0000
commit57a3dbab09d2fecee95c0d95e21bffede7428258 (patch)
treeded311a99e950aa4ad6de9aee20523ad17d24175 /crypto
parentb54fc31edcf49788fa933b84b9b9bb8c5bc97b9c (diff)
downloadFreeBSD-src-57a3dbab09d2fecee95c0d95e21bffede7428258.zip
FreeBSD-src-57a3dbab09d2fecee95c0d95e21bffede7428258.tar.gz
Problems addressed:
1) options.print_lastlog was not honored. 2) "Last login: ..." was printed twice. 3) "copyright" was not printed 4) No newline was before motd. Reviewed by: maintainer's silence in 2 weeks (with my constant reminders)
Diffstat (limited to 'crypto')
-rw-r--r--crypto/openssh/session.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/crypto/openssh/session.c b/crypto/openssh/session.c
index 82f4604..95831d3 100644
--- a/crypto/openssh/session.c
+++ b/crypto/openssh/session.c
@@ -752,14 +752,14 @@ do_login(Session *s, const char *command)
return;
#ifdef USE_PAM
- if (!is_pam_password_change_required())
+ if (options.print_lastlog && !is_pam_password_change_required())
print_pam_messages();
#endif /* USE_PAM */
#ifdef WITH_AIXAUTHENTICATE
if (aixloginmsg && *aixloginmsg)
printf("%s\n", aixloginmsg);
#endif /* WITH_AIXAUTHENTICATE */
-
+#ifndef USE_PAM
if (options.print_lastlog && s->last_login_time != 0) {
time_string = ctime(&s->last_login_time);
if (strchr(time_string, '\n'))
@@ -770,6 +770,7 @@ do_login(Session *s, const char *command)
printf("Last login: %s from %s\r\n", time_string,
s->hostname);
}
+#endif /* !USE_PAM */
do_motd();
}
@@ -782,6 +783,24 @@ do_motd(void)
{
FILE *f;
char buf[256];
+#ifdef HAVE_LOGIN_CAP
+ const char *fname;
+#endif
+
+#ifdef HAVE_LOGIN_CAP
+ fname = login_getcapstr(lc, "copyright", NULL, NULL);
+ if (fname != NULL && (f = fopen(fname, "r")) != NULL) {
+ while (fgets(buf, sizeof(buf), f) != NULL)
+ fputs(buf, stdout);
+ fclose(f);
+ } else
+#endif /* HAVE_LOGIN_CAP */
+ (void)printf("%s\n\t%s %s\n",
+ "Copyright (c) 1980, 1983, 1986, 1988, 1990, 1991, 1993, 1994",
+ "The Regents of the University of California. ",
+ "All rights reserved.");
+
+ (void)printf("\n");
if (options.print_motd) {
#ifdef HAVE_LOGIN_CAP
OpenPOWER on IntegriCloud