Allow the user to disable the use of T/TCP by setting the -T option.

This option becomes useless when all TCP stacks are fixed out there.
This commit is contained in:
Andras Olah 1996-03-15 16:41:49 +00:00
parent dedc04fe95
commit 03801815df
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=14631
3 changed files with 20 additions and 4 deletions

View File

@ -39,7 +39,7 @@
.Nd user information lookup program
.Sh SYNOPSIS
.Nm finger
.Op Fl lmpsho
.Op Fl lmpshoT
.Op Ar user ...
.Op Ar user@host ...
.Sh DESCRIPTION
@ -140,6 +140,11 @@ option is supplied.
All name matching performed by
.Nm finger
is case insensitive.
.Pp
.It Fl T
Disable the use of T/TCP (see
.Xr ttcp 4 ).
This option is needed to finger hosts with a broken TCP implementation.
.El
.Pp
If no options are specified,
@ -191,6 +196,7 @@ This variable may be set with favored options to
.Xr chpass 1 ,
.Xr w 1 ,
.Xr who 1 ,
.Xr ttcp 4 .
.Sh HISTORY
The
.Nm finger

View File

@ -83,7 +83,7 @@ static char sccsid[] = "@(#)finger.c 8.2 (Berkeley) 9/30/93";
DB *db;
time_t now;
int entries, lflag, mflag, pplan, sflag, oflag;
int entries, lflag, mflag, pplan, sflag, oflag, Tflag;
char tbuf[1024];
static void loginlist __P((void));
@ -98,7 +98,7 @@ option(argc, argv)
optind = 1; /* reset getopt */
while ((ch = getopt(argc, argv, "lmpsho")) != EOF)
while ((ch = getopt(argc, argv, "lmpshoT")) != EOF)
switch(ch) {
case 'l':
lflag = 1; /* long format */
@ -118,10 +118,13 @@ option(argc, argv)
case 'o':
oflag = 1; /* office info */
break;
case 'T':
Tflag = 1; /* disable T/TCP */
break;
case '?':
default:
(void)fprintf(stderr,
"usage: finger [-lmpsho] [login ...]\n");
"usage: finger [-lmpshoT] [login ...]\n");
exit(1);
}

View File

@ -58,6 +58,7 @@ netfinger(name)
char *name;
{
extern int lflag;
extern int Tflag;
register FILE *fp;
register int c, lastc;
struct in_addr defaddr;
@ -119,6 +120,12 @@ netfinger(name)
iov[msg.msg_iovlen].iov_base = "\r\n";
iov[msg.msg_iovlen++].iov_len = 2;
/* -T disables T/TCP: compatibility option to finger broken hosts */
if (Tflag && connect(s, (struct sockaddr *)&sin, sizeof (sin))) {
perror("finger: connect");
return;
}
if (sendmsg(s, &msg, MSG_EOF) < 0) {
perror("finger: sendmsg");
close(s);