summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbeck <beck@openbsd.org>2015-11-24 05:06:24 +0000
committerbeck <beck@openbsd.org>2015-11-24 05:06:24 +0000
commit432f18a774ae8bcf89cc203a02cfd4bbde0636ee (patch)
tree9554aefa768014cc55fb83545e6390e59040c6e2
parentadd some more tail tests, from Martijn van Duren (diff)
downloadwireguard-openbsd-432f18a774ae8bcf89cc203a02cfd4bbde0636ee.tar.xz
wireguard-openbsd-432f18a774ae8bcf89cc203a02cfd4bbde0636ee.zip
Don't support repeated connections - avoids pledge problems
ok deraadt@, "god please commit before I see any more" tedu@
-rw-r--r--usr.bin/telnet/commands.c6
-rw-r--r--usr.bin/telnet/externs.h3
-rw-r--r--usr.bin/telnet/telnet.c4
3 files changed, 10 insertions, 3 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 0faec4fb26a..ff432fb723a 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.80 2015/11/20 12:43:37 jca Exp $ */
+/* $OpenBSD: commands.c,v 1.81 2015/11/24 05:06:24 beck Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -1753,6 +1753,10 @@ tn(int argc, char *argv[])
printf("?Already connected to %s\r\n", hostname);
return 0;
}
+ if (connections) {
+ printf("Repeated connections not supported\r\n");
+ return 0;
+ }
if (argc < 2) {
strlcpy(line, "open ", sizeof(line));
printf("(to) ");
diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h
index e96fb850521..ca7fe77aa53 100644
--- a/usr.bin/telnet/externs.h
+++ b/usr.bin/telnet/externs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: externs.h,v 1.29 2014/09/09 03:41:08 guenther Exp $ */
+/* $OpenBSD: externs.h,v 1.30 2015/11/24 05:06:24 beck Exp $ */
/* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
/*
@@ -41,6 +41,7 @@ extern int
binary,
family, /* address family of peer */
flushout, /* flush output */
+ connections,
connected, /* Are we connected to the other side? */
globalmode, /* Mode tty should be in */
telnetport, /* Are we connected to the telnet port? */
diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c
index 444ff1f0bd6..8d452406ccc 100644
--- a/usr.bin/telnet/telnet.c
+++ b/usr.bin/telnet/telnet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: telnet.c,v 1.32 2015/11/13 17:13:59 deraadt Exp $ */
+/* $OpenBSD: telnet.c,v 1.33 2015/11/24 05:06:24 beck Exp $ */
/* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */
/*
@@ -81,6 +81,7 @@ int
binary = 0,
autologin = 0, /* Autologin anyone? */
skiprc = 0,
+ connections = 0,
connected,
showoptions,
ISend, /* trying to send network data in */
@@ -1837,6 +1838,7 @@ Scheduler(int block) /* should we block in the select ? */
void
telnet(char *user)
{
+ connections++;
sys_telnet_init();
if (pledge("stdio tty", NULL) == -1) {