summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-13 16:50:04 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-11-13 16:50:04 +0000
commitca63826665dba5c7ded7d46af8942ab7293df0ca (patch)
tree9d128018dff7e5289111f50d2eccfcd6337ef39e
parent721331485113010a50f394bb958daaea53fc65a9 (diff)
remove support for !shell
ok millert
-rw-r--r--usr.bin/telnet/commands.c58
-rw-r--r--usr.bin/telnet/telnet.19
2 files changed, 2 insertions, 65 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 8cda8e57f70..db208ed1aa1 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.75 2015/11/13 16:46:30 deraadt Exp $ */
+/* $OpenBSD: commands.c,v 1.76 2015/11/13 16:50:03 deraadt Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -33,7 +33,6 @@
#include "telnet_locl.h"
#include <sys/socket.h>
-#include <sys/wait.h>
#include <netinet/in.h>
#include <netinet/ip.h>
#include <arpa/inet.h>
@@ -60,7 +59,6 @@ typedef struct {
} Command;
static char line[256];
-static char saveline[256];
static int margc;
static char *margv[20];
@@ -72,12 +70,6 @@ makeargv(void)
margc = 0;
cp = line;
- if (*cp == '!') { /* Special case shell escape */
- strlcpy(saveline, line, sizeof(saveline)); /* save for shell command */
- *argp++ = "!"; /* No room in string to get this */
- margc++;
- cp++;
- }
while ((c = *cp)) {
int inquote = 0;
while (isspace((unsigned char)c))
@@ -1212,52 +1204,6 @@ telnetsuspend(int unused1, char *unused2[])
return 1;
}
-int
-shell(int argc, char *argv[])
-{
- long oldrows, oldcols, newrows, newcols, err;
-
- setcommandmode();
-
- err = (TerminalWindowSize(&oldrows, &oldcols) == 0) ? 1 : 0;
- switch(vfork()) {
- case -1:
- perror("Fork failed\r\n");
- break;
-
- case 0:
- {
- /*
- * Fire up the shell in the child.
- */
- char *shellp, *shellname;
-
- shellp = getenv("SHELL");
- if (shellp == NULL)
- shellp = "/bin/sh";
- if ((shellname = strrchr(shellp, '/')) == 0)
- shellname = shellp;
- else
- shellname++;
- if (argc > 1)
- execl(shellp, shellname, "-c", &saveline[1], (char *)NULL);
- else
- execl(shellp, shellname, (char *)NULL);
- perror("Execl");
- _exit(1);
- }
- default:
- (void)wait((int *)0); /* Wait for the shell to complete */
-
- if (TerminalWindowSize(&newrows, &newcols) && connected &&
- (err || ((oldrows != newrows) || (oldcols != newcols)))) {
- sendnaws();
- }
- break;
- }
- return 1;
-}
-
static void
close_connection(void)
{
@@ -2025,7 +1971,6 @@ static char
slchelp[] = "change state of special charaters ('slc ?' for more)",
displayhelp[] = "display operating parameters",
zhelp[] = "suspend telnet",
- shellhelp[] = "invoke a subshell",
envhelp[] = "change environment variables ('environ ?' for more)",
modestring[] = "try to enter line or character mode ('mode ?' for more)";
@@ -2046,7 +1991,6 @@ static Command cmdtab[] = {
{ "slc", slchelp, slccmd, 0 },
{ "z", zhelp, telnetsuspend, 0 },
- { "!", shellhelp, shell, 0 },
{ "environ", envhelp, env_cmd, 0 },
{ "?", helphelp, help, 0 },
{ 0, 0, 0, 0 }
diff --git a/usr.bin/telnet/telnet.1 b/usr.bin/telnet/telnet.1
index 20435b8c3f5..d5c6c291095 100644
--- a/usr.bin/telnet/telnet.1
+++ b/usr.bin/telnet/telnet.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: telnet.1,v 1.57 2015/11/13 16:46:30 deraadt Exp $
+.\" $OpenBSD: telnet.1,v 1.58 2015/11/13 16:50:03 deraadt Exp $
.\" $NetBSD: telnet.1,v 1.5 1996/02/28 21:04:12 thorpej Exp $
.\"
.\" Copyright (c) 1983, 1990, 1993
@@ -1288,13 +1288,6 @@ Suspend
.Nm telnet .
This command only works when the user is using a shell with
job control enabled.
-.It Ic \&! Op Ar command
-Execute a single command in a subshell on the local
-system.
-If
-.Ar command
-is omitted, then an interactive
-subshell is invoked.
.It Ic \&? Op Ar command
Get help.
With no arguments,