Import nc from OpenBSD's OPENBSD_4_7 as of today.
This commit is contained in:
parent
e49b913015
commit
a83f96f193
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/netcat/dist/; revision=205559 svn path=/vendor/netcat/4.7/; revision=205560; tag=vendor/netcat/4.7
16
nc.1
16
nc.1
@ -1,4 +1,4 @@
|
||||
.\" $OpenBSD: nc.1,v 1.50 2009/06/05 06:47:12 jmc Exp $
|
||||
.\" $OpenBSD: nc.1,v 1.53 2010/02/23 23:00:52 schwarze Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1996 David Sacerdote
|
||||
.\" All rights reserved.
|
||||
@ -25,7 +25,7 @@
|
||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: June 5 2009 $
|
||||
.Dd $Mdocdate: February 23 2010 $
|
||||
.Dt NC 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -47,8 +47,8 @@
|
||||
.Op Fl X Ar proxy_protocol
|
||||
.Oo Xo
|
||||
.Fl x Ar proxy_address Ns Oo : Ns
|
||||
.Ar port Oc Oc
|
||||
.Xc
|
||||
.Ar port Oc
|
||||
.Xc Oc
|
||||
.Op Ar hostname
|
||||
.Op Ar port
|
||||
.Ek
|
||||
@ -174,7 +174,9 @@ This makes it possible to use
|
||||
.Nm
|
||||
to script telnet sessions.
|
||||
.It Fl U
|
||||
Specifies to use Unix Domain Sockets.
|
||||
Specifies to use
|
||||
.Ux Ns -domain
|
||||
sockets.
|
||||
.It Fl u
|
||||
Use UDP instead of the default option of TCP.
|
||||
.It Fl V Ar rdomain
|
||||
@ -386,7 +388,9 @@ IP for the local end of the connection:
|
||||
.Pp
|
||||
.Dl $ nc -s 10.1.2.3 host.example.com 42
|
||||
.Pp
|
||||
Create and listen on a Unix Domain Socket:
|
||||
Create and listen on a
|
||||
.Ux Ns -domain
|
||||
socket:
|
||||
.Pp
|
||||
.Dl $ nc -lU /var/tmp/dsocket
|
||||
.Pp
|
||||
|
32
netcat.c
32
netcat.c
@ -1,4 +1,4 @@
|
||||
/* $OpenBSD: netcat.c,v 1.93 2009/06/05 00:18:10 claudio Exp $ */
|
||||
/* $OpenBSD: netcat.c,v 1.95 2010/02/27 00:58:56 nicm Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
|
||||
*
|
||||
@ -403,8 +403,10 @@ main(int argc, char *argv[])
|
||||
uflag ? "udp" : "tcp");
|
||||
}
|
||||
|
||||
printf("Connection to %s %s port [%s/%s] succeeded!\n",
|
||||
host, portlist[i], uflag ? "udp" : "tcp",
|
||||
fprintf(stderr,
|
||||
"Connection to %s %s port [%s/%s] "
|
||||
"succeeded!\n", host, portlist[i],
|
||||
uflag ? "udp" : "tcp",
|
||||
sv ? sv->s_name : "*");
|
||||
}
|
||||
if (!zflag)
|
||||
@ -681,27 +683,27 @@ atelnet(int nfd, unsigned char *buf, unsigned int size)
|
||||
unsigned char *p, *end;
|
||||
unsigned char obuf[4];
|
||||
|
||||
end = buf + size;
|
||||
obuf[0] = '\0';
|
||||
if (size < 3)
|
||||
return;
|
||||
end = buf + size - 2;
|
||||
|
||||
for (p = buf; p < end; p++) {
|
||||
if (*p != IAC)
|
||||
break;
|
||||
continue;
|
||||
|
||||
obuf[0] = IAC;
|
||||
p++;
|
||||
if ((*p == WILL) || (*p == WONT))
|
||||
obuf[1] = DONT;
|
||||
if ((*p == DO) || (*p == DONT))
|
||||
else if ((*p == DO) || (*p == DONT))
|
||||
obuf[1] = WONT;
|
||||
if (obuf) {
|
||||
p++;
|
||||
obuf[2] = *p;
|
||||
obuf[3] = '\0';
|
||||
if (atomicio(vwrite, nfd, obuf, 3) != 3)
|
||||
warn("Write Error!");
|
||||
obuf[0] = '\0';
|
||||
}
|
||||
else
|
||||
continue;
|
||||
|
||||
p++;
|
||||
obuf[2] = *p;
|
||||
if (atomicio(vwrite, nfd, obuf, 3) != 3)
|
||||
warn("Write Error!");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user