Date: Mon, 5 Aug 2002 04:00:18 -0700 (PDT) From: "Andrey A. Chernov" <ache@nagual.pp.ru> To: freebsd-bugs@FreeBSD.org Subject: Re: misc/41328: ssh logins in 4.6.1 no longer give incoming mail status Message-ID: <200208051100.g75B0Ifk049654@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR misc/41328; it has been noted by GNATS. From: "Andrey A. Chernov" <ache@nagual.pp.ru> To: Stephen Cravey <cravey@gotbrains.org> Cc: FreeBSD-gnats-submit@FreeBSD.ORG Subject: Re: misc/41328: ssh logins in 4.6.1 no longer give incoming mail status Date: Mon, 5 Aug 2002 14:58:42 +0400 On Sun, Aug 04, 2002 at 13:33:39 -0500, Stephen Cravey wrote: > >How-To-Repeat: > get new mail. ssh to the box you get new mail on. Try this patch: --- session.c.old Sat Jul 27 00:56:22 2002 +++ session.c Mon Aug 5 14:46:40 2002 @@ -1288,6 +1288,9 @@ 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(); @@ -1346,6 +1349,11 @@ /* 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. @@ -1384,7 +1392,7 @@ 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)) + if (lc_requirehome) exit(1); #endif } @@ -1422,6 +1430,28 @@ 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. */ -- Andrey A. Chernov http://ache.pp.ru/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208051100.g75B0Ifk049654>