mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-02 12:20:51 +00:00
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
This commit is contained in:
parent
d1a67300e2
commit
3a44a4c33e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=142790
@ -2299,6 +2299,9 @@ tn(int argc, char *argv[])
|
||||
} else if (*portp == '-') {
|
||||
portp++;
|
||||
telnetport = 1;
|
||||
} else if (*portp == '+') {
|
||||
portp++;
|
||||
telnetport = -1;
|
||||
} else
|
||||
telnetport = 0;
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user