Skip site navigation (1)Skip section navigation (2)
Date:      20 Apr 2002 18:10:50 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        "Andrey A. Chernov" <ache@nagual.pp.ru>
Cc:        current@freebsd.org
Subject:   Re: PAM & OpenSSH: two incorrect "last login"
Message-ID:  <xzp8z7iqrjp.fsf@flood.ping.uio.no>
In-Reply-To: <20020420011633.GA66468@nagual.pp.ru>
References:  <20020420011633.GA66468@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=

"Andrey A. Chernov" <ache@nagual.pp.ru> writes:
> I got this TWO last login lines with recent -current SSH+PAM:

See attached patch.

DES
-- 
Dag-Erling Smorgrav - des@ofug.org


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=lastlog.diff

==== //depot/user/des/pam/lib/libpam/modules/pam_lastlog/pam_lastlog.c#9 - /usr/src/lib/libpam/modules/pam_lastlog/pam_lastlog.c ====
--- /tmp/tmp.23049.0	Sat Apr 20 18:09:14 2002
+++ /usr/src/lib/libpam/modules/pam_lastlog/pam_lastlog.c	Sat Apr 20 18:08:29 2002
@@ -108,15 +108,14 @@
 	if (lseek(fd, llpos, L_SET) != llpos)
 		goto file_err;
 	if ((flags & PAM_SILENT) == 0) {
-		if (read(fd, &ll, sizeof(ll)) == sizeof(ll) &&
-		    ll.ll_time != 0) {
-			pam_info(pamh, "Last login: %.*s ", 24 - 5,
-			    ctime(&ll.ll_time));
+		if (read(fd, &ll, sizeof ll) == sizeof ll && ll.ll_time != 0) {
 			if (*ll.ll_host != '\0')
-				pam_info(pamh, "from %.*s\n",
+				pam_info(pamh, "Last login: %.*s from %.*s",
+				    24 - 5, ctime(&ll.ll_time),
 				    (int)sizeof(ll.ll_host), ll.ll_host);
 			else
-				pam_info(pamh, "on %.*s\n",
+				pam_info(pamh, "Last login: %.*s on %.*s",
+				    24 - 5, ctime(&ll.ll_time),
 				    (int)sizeof(ll.ll_line), ll.ll_line);
 		}
 		if (lseek(fd, llpos, L_SET) != llpos)
==== //depot/user/des/pam/crypto/openssh/session.c#6 - /usr/src/crypto/openssh/session.c ====
--- /tmp/tmp.23049.1	Sat Apr 20 18:09:15 2002
+++ /usr/src/crypto/openssh/session.c	Sat Apr 20 18:04:43 2002
@@ -647,6 +647,7 @@
 	}
 #endif
 
+#ifndef USE_PAM
 	/* Get the time and hostname when the user last logged in. */
 	if (options.print_lastlog) {
 		hostname[0] = '\0';
@@ -654,7 +655,6 @@
 		    hostname, sizeof(hostname));
 	}
 
-#ifndef USE_PAM
 	/* Record that there was a login on that tty from the remote host. */
 	record_login(pid, s->tty, pw->pw_name, pw->pw_uid,
 	    get_remote_name_or_ip(utmp_len, options.verify_reverse_mapping),

--=-=-=--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzp8z7iqrjp.fsf>