mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-01 12:19:28 +00:00
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()
This commit is contained in:
parent
640984ba48
commit
b36e10eee6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95119
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user