From owner-freebsd-current Sat Apr 20 9:10:59 2002 Delivered-To: freebsd-current@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id 2DB4937B41B for ; Sat, 20 Apr 2002 09:10:53 -0700 (PDT) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 8F9705309; Sat, 20 Apr 2002 18:10:51 +0200 (CEST) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: "Andrey A. Chernov" Cc: current@freebsd.org Subject: Re: PAM & OpenSSH: two incorrect "last login" References: <20020420011633.GA66468@nagual.pp.ru> From: Dag-Erling Smorgrav Date: 20 Apr 2002 18:10:50 +0200 In-Reply-To: <20020420011633.GA66468@nagual.pp.ru> Message-ID: Lines: 11 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.1 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --=-=-= "Andrey A. Chernov" 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