diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 1999-10-07 22:46:34 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 1999-10-07 22:46:34 +0000 |
commit | 97e3b0e0d49aa5afe86c5147465a6e8d5d360614 (patch) | |
tree | f5c25b2aa0458dc9196ba960cfc43ae4cac31833 /usr.bin/ssh/sshd.c | |
parent | 73acd75b8f7477bc696e7ac3487b450dd712ea1a (diff) |
You have Mail. Email fuer Dich. Karsten Patzwaldt <kpa@gmx.net> default=no
Diffstat (limited to 'usr.bin/ssh/sshd.c')
-rw-r--r-- | usr.bin/ssh/sshd.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c index 5c5317eec34..6e57bc52fdd 100644 --- a/usr.bin/ssh/sshd.c +++ b/usr.bin/ssh/sshd.c @@ -18,7 +18,7 @@ agent connections. */ #include "includes.h" -RCSID("$Id: sshd.c,v 1.24 1999/10/07 21:45:02 markus Exp $"); +RCSID("$Id: sshd.c,v 1.25 1999/10/07 22:46:33 markus Exp $"); #include "xmalloc.h" #include "rsa.h" @@ -35,6 +35,7 @@ RCSID("$Id: sshd.c,v 1.24 1999/10/07 21:45:02 markus Exp $"); #include <tcpd.h> #include <syslog.h> #include <sys/syslog.h> +#include <sys/stat.h> int allow_severity = LOG_INFO; int deny_severity = LOG_WARNING; #endif /* LIBWRAP */ @@ -2213,6 +2214,21 @@ void do_child(const char *command, struct passwd *pw, const char *term, { char buf[256]; + /* Check for mail if we have a tty and it was enabled in server options. */ + if (ttyname && options.check_mail) { + char *mailbox; + struct stat mailstat; + mailbox = getenv("MAIL"); + if(mailbox != NULL) { + if(stat(mailbox, &mailstat) != 0 || mailstat.st_size == 0) { + printf("No mail.\n"); + } else if(mailstat.st_mtime < mailstat.st_atime) { + printf("You have mail.\n"); + } else { + printf("You have new mail.\n"); + } + } + } /* Start the shell. Set initial character to '-'. */ buf[0] = '-'; strncpy(buf + 1, cp, sizeof(buf) - 1); |