summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2002-04-20 09:26:43 +0000
committerache <ache@FreeBSD.org>2002-04-20 09:26:43 +0000
commita9f47835a092aeed527114bab11b759e9ac4410a (patch)
tree9869fda56cd10a2b502411a5f15cd08fca560262 /crypto
parentb1b786a07b6a165ea19265fbc3a187e3be31280d (diff)
downloadFreeBSD-src-a9f47835a092aeed527114bab11b759e9ac4410a.zip
FreeBSD-src-a9f47835a092aeed527114bab11b759e9ac4410a.tar.gz
1) Surprisingly, "CheckMail" handling code completely removed from this
version, so documented "CheckMail" option exists but does nothing. Bring it back to life adding code back. 2) Cosmetique. Reduce number of args in do_setusercontext()
Diffstat (limited to 'crypto')
-rw-r--r--crypto/openssh/servconf.c1
-rw-r--r--crypto/openssh/session.c25
2 files changed, 24 insertions, 2 deletions
diff --git a/crypto/openssh/servconf.c b/crypto/openssh/servconf.c
index 8ba194d..1cf7f9d 100644
--- a/crypto/openssh/servconf.c
+++ b/crypto/openssh/servconf.c
@@ -110,6 +110,7 @@ initialize_server_options(ServerOptions *options)
options->client_alive_count_max = -1;
options->authorized_keys_file = NULL;
options->authorized_keys_file2 = NULL;
+ options->check_mail = -1;
}
void
diff --git a/crypto/openssh/session.c b/crypto/openssh/session.c
index 26612d4..e7be40e 100644
--- a/crypto/openssh/session.c
+++ b/crypto/openssh/session.c
@@ -1143,9 +1143,10 @@ do_nologin(struct passwd *pw)
/* Set login name, uid, gid, and groups. */
static char **
-do_setusercontext(struct passwd *pw, Session *s)
+do_setusercontext(Session *s)
{
char **env = NULL;
+ struct passwd *pw = s->pw;
#ifdef HAVE_LOGIN_CAP
char buf[256];
char **tmpenv;
@@ -1222,6 +1223,7 @@ do_child(Session *s, const char *command)
const char *shell, *shell0, *hostname = NULL;
struct passwd *pw = s->pw;
u_int i;
+ int ttyfd = s->ttyfd;
/* remove hostkey from the child's memory */
destroy_sensitive_data();
@@ -1236,7 +1238,7 @@ do_child(Session *s, const char *command)
*/
if (!options.use_login) {
do_nologin(pw);
- env = do_setusercontext(pw, s);
+ env = do_setusercontext(s);
}
/*
@@ -1359,6 +1361,25 @@ do_child(Session *s, const char *command)
exit(1);
}
+ /*
+ * Check for mail if we have a tty and it was enabled
+ * in server options.
+ */
+ if (ttyfd != -1 && options.check_mail) {
+ 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. */
argv[0] = argv0;
argv[1] = NULL;
OpenPOWER on IntegriCloud