From owner-freebsd-bugs Mon Aug 5 13:40:15 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5A21837B400 for ; Mon, 5 Aug 2002 13:40:05 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 67DCD43E3B for ; Mon, 5 Aug 2002 13:40:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g75Ke4JU063601 for ; Mon, 5 Aug 2002 13:40:04 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g75Ke4tn063599; Mon, 5 Aug 2002 13:40:04 -0700 (PDT) Date: Mon, 5 Aug 2002 13:40:04 -0700 (PDT) Message-Id: <200208052040.g75Ke4tn063599@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Stephen Cravey Subject: Re: misc/41328: ssh logins in 4.6.1 no longer give incoming mail status Reply-To: Stephen Cravey Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR misc/41328; it has been noted by GNATS. From: Stephen Cravey To: "Andrey A. Chernov" Cc: Subject: Re: misc/41328: ssh logins in 4.6.1 no longer give incoming mail status Date: Mon, 5 Aug 2002 15:35:02 -0500 (CDT) On Mon, 5 Aug 2002, Andrey A. Chernov wrote: ---snip--- > Try this patch: ---snip--- The line numbers didn't match up to what I had.. I applied it manually, but I'm not sure how to get openssh compiled and installed with it other than a make world. Can you give me some suggestions? I'm getting better at this. Really, I am. :) My diff follows. Let me know if I missed something. -Stephen *** session.c.oldd Mon Aug 5 12:35:37 2002 --- session.c Mon Aug 5 12:49:53 2002 *************** *** 1269,1274 **** --- 1269,1277 ---- const char *shell, *shell0, *hostname = NULL; struct passwd *pw = s->pw; u_int i; + #ifdef HAVE_LOGIN_CAP + int lc_requirehome, lc_nocheckmail; + #endif /* remove hostkey from the child's memory */ destroy_sensitive_data(); *************** *** 1327,1332 **** --- 1330,1340 ---- /* XXX better use close-on-exec? -markus */ channel_close_all(); + #ifdef HAVE_LOGIN_CAP + lc_requirehome = login_getcapbool(lc, "requirehome", 0); + lc_nocheckmail = login_getcapbool(lc, "nocheckmail", 0); + login_close(lc); + #endif /* * Close any extra file descriptors. Note that there may still be * descriptors left by system functions. They will be closed later. *************** *** 1365,1371 **** fprintf(stderr, "Could not chdir to home directory %s: %s\n", pw->pw_dir, strerror(errno)); #ifdef HAVE_LOGIN_CAP ! if (login_getcapbool(lc, "requirehome", 0)) exit(1); #endif } --- 1373,1379 ---- fprintf(stderr, "Could not chdir to home directory %s: %s\n", pw->pw_dir, strerror(errno)); #ifdef HAVE_LOGIN_CAP ! if (lc_requirehome) exit(1); #endif } *************** *** 1403,1408 **** --- 1411,1439 ---- errno = EINVAL; perror(shell); exit(1); + } + + /* + * Check for mail if we have a tty. + */ + if (s->ttyfd != -1 + #ifdef HAVE_LOGIN_CAP + && !lc_nocheckmail + #endif + ) { + char *mailbox; + struct stat mailstat; + + mailbox = getenv("MAIL"); + if (mailbox != NULL) { + if (stat(mailbox, &mailstat) != 0 || mailstat.st_size == 0) + ; + else if (mailstat.st_mtime < mailstat.st_atime) + printf("You have mail.\n"); + else + printf("You have new mail.\n"); + } + } /* Execute the shell. */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message