summaryrefslogtreecommitdiffstats
path: root/contrib/telnet
diff options
context:
space:
mode:
authortobez <tobez@FreeBSD.org>2005-02-28 12:46:53 +0000
committertobez <tobez@FreeBSD.org>2005-02-28 12:46:53 +0000
commite89ea7ac963197dccdcfb1c60e9100bf7548ac64 (patch)
tree6825b1019986cb1b53ef0d6ec3d0abab91f3ab10 /contrib/telnet
parent3cc07fe4d655fff6274b2ed654ced7f3a81d52ad (diff)
downloadFreeBSD-src-e89ea7ac963197dccdcfb1c60e9100bf7548ac64.zip
FreeBSD-src-e89ea7ac963197dccdcfb1c60e9100bf7548ac64.tar.gz
Increase usefulness of telnet(1) as a protocol tester. By prepending
"+" to the port number, disable option negotiation and allow transferring of data with high bit set. OKed by: markm (maintainer) PR: 52032 Submitted by: Valentin Nechayev <netch maybe-at netch stop kiev stop ua> MFC After: 2 weeks
Diffstat (limited to 'contrib/telnet')
-rw-r--r--contrib/telnet/telnet/commands.c3
-rw-r--r--contrib/telnet/telnet/telnet.112
-rw-r--r--contrib/telnet/telnet/telnet.c12
3 files changed, 23 insertions, 4 deletions
diff --git a/contrib/telnet/telnet/commands.c b/contrib/telnet/telnet/commands.c
index a8a3a44..a64d763 100644
--- a/contrib/telnet/telnet/commands.c
+++ b/contrib/telnet/telnet/commands.c
@@ -2299,6 +2299,9 @@ tn(int argc, char *argv[])
} else if (*portp == '-') {
portp++;
telnetport = 1;
+ } else if (*portp == '+') {
+ portp++;
+ telnetport = -1;
} else
telnetport = 0;
diff --git a/contrib/telnet/telnet/telnet.1 b/contrib/telnet/telnet/telnet.1
index 06a9274..2e0181c 100644
--- a/contrib/telnet/telnet/telnet.1
+++ b/contrib/telnet/telnet/telnet.1
@@ -591,9 +591,10 @@ Prints out help information for the
command.
.El
.It Xo
-.Ic open Ar host
+.Ic open
.Op Fl l Ar user
-.Op Oo Fl Oc Ns Ar port
+.Op Ar host
+.Op Oo Fl /+ Oc Ns Ar port
.Xc
Open a connection to the named host.
If no port number
@@ -620,6 +621,13 @@ omits any automatic initiation of
options.
When the port number is preceded by a minus sign,
the initial option negotiation is done.
+When, however, the port number
+is preceded by a plus sign,
+any option negotiation and understanding is prohibited,
+making telnet dumb client for POP3/SMTP/NNTP/HTTP-like
+protocols with any data including
+.Tn TELNET
+IAC character (0xff).
After establishing a connection, the file
.Pa \&.telnetrc
in the
diff --git a/contrib/telnet/telnet/telnet.c b/contrib/telnet/telnet/telnet.c
index 82ee464..692fb49 100644
--- a/contrib/telnet/telnet/telnet.c
+++ b/contrib/telnet/telnet/telnet.c
@@ -217,6 +217,8 @@ send_do(int c, int init)
set_my_want_state_do(c);
do_dont_resp[c]++;
}
+ if (telnetport < 0)
+ return;
NET2ADD(IAC, DO);
NETADD(c);
printoption("SENT", DO, c);
@@ -232,6 +234,8 @@ send_dont(int c, int init)
set_my_want_state_dont(c);
do_dont_resp[c]++;
}
+ if (telnetport < 0)
+ return;
NET2ADD(IAC, DONT);
NETADD(c);
printoption("SENT", DONT, c);
@@ -247,6 +251,8 @@ send_will(int c, int init)
set_my_want_state_will(c);
will_wont_resp[c]++;
}
+ if (telnetport < 0)
+ return;
NET2ADD(IAC, WILL);
NETADD(c);
printoption("SENT", WILL, c);
@@ -262,6 +268,8 @@ send_wont(int c, int init)
set_my_want_state_wont(c);
will_wont_resp[c]++;
}
+ if (telnetport < 0)
+ return;
NET2ADD(IAC, WONT);
NETADD(c);
printoption("SENT", WONT, c);
@@ -1651,7 +1659,7 @@ telrcv(void)
/* FALLTHROUGH */
case TS_DATA:
- if (c == IAC) {
+ if (c == IAC && telnetport >= 0) {
telrcv_state = TS_IAC;
break;
}
@@ -2069,7 +2077,7 @@ telnet(char *user __unusedhere)
}
#endif
#endif
- if (telnetport) {
+ if (telnetport > 0) {
#ifdef AUTHENTICATION
if (autologin)
send_will(TELOPT_AUTHENTICATION, 1);
OpenPOWER on IntegriCloud