summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/servconf.c12
-rw-r--r--usr.bin/ssh/servconf.h3
-rw-r--r--usr.bin/ssh/ssh-agent.c4
-rw-r--r--usr.bin/ssh/sshd.88
-rw-r--r--usr.bin/ssh/sshd.c18
-rw-r--r--usr.bin/ssh/sshd_config5
6 files changed, 40 insertions, 10 deletions
diff --git a/usr.bin/ssh/servconf.c b/usr.bin/ssh/servconf.c
index ab8cac6d2ea..7524cd33ba9 100644
--- a/usr.bin/ssh/servconf.c
+++ b/usr.bin/ssh/servconf.c
@@ -12,7 +12,7 @@ Created: Mon Aug 21 15:48:58 1995 ylo
*/
#include "includes.h"
-RCSID("$Id: servconf.c,v 1.10 1999/10/07 21:45:02 markus Exp $");
+RCSID("$Id: servconf.c,v 1.11 1999/10/07 22:46:32 markus Exp $");
#include "ssh.h"
#include "servconf.h"
@@ -34,6 +34,7 @@ void initialize_server_options(ServerOptions *options)
options->quiet_mode = -1;
options->fascist_logging = -1;
options->print_motd = -1;
+ options->check_mail = -1;
options->x11_forwarding = -1;
options->x11_display_offset = -1;
options->strict_modes = -1;
@@ -87,6 +88,8 @@ void fill_default_server_options(ServerOptions *options)
options->ignore_rhosts = 0;
if (options->quiet_mode == -1)
options->quiet_mode = 0;
+ if (options->check_mail == -1)
+ options->check_mail = 0;
if (options->fascist_logging == -1)
options->fascist_logging = 1;
if (options->print_motd == -1)
@@ -150,7 +153,7 @@ typedef enum
#endif
sPasswordAuthentication, sAllowHosts, sDenyHosts, sListenAddress,
sPrintMotd, sIgnoreRhosts, sX11Forwarding, sX11DisplayOffset,
- sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives
+ sStrictModes, sEmptyPasswd, sRandomSeedFile, sKeepAlives, sCheckMail
} ServerOpCodes;
/* Textual representation of the tokens. */
@@ -186,6 +189,7 @@ static struct
{ "skeyauthentication", sSkeyAuthentication },
#endif
{ "allowhosts", sAllowHosts },
+ { "checkmail", sCheckMail },
{ "denyhosts", sDenyHosts },
{ "listenaddress", sListenAddress },
{ "printmotd", sPrintMotd },
@@ -405,6 +409,10 @@ void read_server_config(ServerOptions *options, const char *filename)
intptr = &options->password_authentication;
goto parse_flag;
+ case sCheckMail:
+ intptr = &options->check_mail;
+ goto parse_flag;
+
#ifdef SKEY
case sSkeyAuthentication:
intptr = &options->skey_authentication;
diff --git a/usr.bin/ssh/servconf.h b/usr.bin/ssh/servconf.h
index 8a838011594..e721a18f9c2 100644
--- a/usr.bin/ssh/servconf.h
+++ b/usr.bin/ssh/servconf.h
@@ -13,7 +13,7 @@ Definitions for server configuration data and for the functions reading it.
*/
-/* RCSID("$Id: servconf.h,v 1.5 1999/10/07 21:45:02 markus Exp $"); */
+/* RCSID("$Id: servconf.h,v 1.6 1999/10/07 22:46:32 markus Exp $"); */
#ifndef SERVCONF_H
#define SERVCONF_H
@@ -34,6 +34,7 @@ typedef struct
int quiet_mode; /* If true, don't log anything but fatals. */
int fascist_logging; /* Perform very verbose logging. */
int print_motd; /* If true, print /etc/motd. */
+ int check_mail; /* If true, check for new mail. */
int x11_forwarding; /* If true, permit inet (spoofing) X11 fwd. */
int x11_display_offset; /* What DISPLAY number to start searching at */
int strict_modes; /* If true, require string home dir modes. */
diff --git a/usr.bin/ssh/ssh-agent.c b/usr.bin/ssh/ssh-agent.c
index 1ab53eee1af..24ad6179513 100644
--- a/usr.bin/ssh/ssh-agent.c
+++ b/usr.bin/ssh/ssh-agent.c
@@ -14,7 +14,7 @@ The authentication agent program.
*/
#include "includes.h"
-RCSID("$Id: ssh-agent.c,v 1.10 1999/10/05 22:18:52 markus Exp $");
+RCSID("$Id: ssh-agent.c,v 1.11 1999/10/07 22:46:32 markus Exp $");
#include "ssh.h"
#include "rsa.h"
@@ -51,7 +51,7 @@ Identity *identities = NULL;
int max_fd = 0;
-/* pid of agent == parent of shell */
+/* pid of shell == parent of agent */
int parent_pid = -1;
/* pathname and directory for AUTH_SOCKET */
diff --git a/usr.bin/ssh/sshd.8 b/usr.bin/ssh/sshd.8
index d088b62105f..00eec33455a 100644
--- a/usr.bin/ssh/sshd.8
+++ b/usr.bin/ssh/sshd.8
@@ -9,7 +9,7 @@
.\"
.\" Created: Sat Apr 22 21:55:14 1995 ylo
.\"
-.\" $Id: sshd.8,v 1.7 1999/10/07 21:45:02 markus Exp $
+.\" $Id: sshd.8,v 1.8 1999/10/07 22:46:33 markus Exp $
.\"
.Dd September 25, 1999
.Dt SSHD 8
@@ -192,6 +192,12 @@ Note that
can also be configured to use tcp_wrappers using the
.Sy LIBWARP
compile-time option.
+.It Cm CheckMail
+Specifies whether
+.Nm
+should check for new mail for interactive logins.
+The default is
+.Dq no .
.It Cm DenyHosts
This keyword can be followed by any number of host name patterns,
separated by spaces. If specified, login is disallowed from the hosts
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);
diff --git a/usr.bin/ssh/sshd_config b/usr.bin/ssh/sshd_config
index 5f30462b301..838daea447b 100644
--- a/usr.bin/ssh/sshd_config
+++ b/usr.bin/ssh/sshd_config
@@ -23,7 +23,6 @@ RhostsAuthentication no
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
#
-# Changed RSAAuthentication to no/bg
RSAAuthentication yes
# To disable tunneled clear text passwords, change to no here!
@@ -41,10 +40,10 @@ PermitEmptyPasswords no
# Kerberos TGT Passing does only work with the AFS kaserver
#KerberosTgtPassing yes
+#CheckMail yes
+
# XXX implement these
#UseLogin no
-#CheckMail no
# AllowHosts *.our.com friend.other.com
# DenyHosts lowsecurity.theirs.com *.evil.org evil.org
-