Resolve conflicts.
This commit is contained in:
parent
c262af8430
commit
bdb0aaa123
@ -1,4 +1,4 @@
|
|||||||
.\" $OpenBSD: nc.1,v 1.43 2006/01/31 09:34:12 jmc Exp $
|
.\" $OpenBSD: nc.1,v 1.44 2006/12/02 01:08:30 jmc Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1996 David Sacerdote
|
.\" Copyright (c) 1996 David Sacerdote
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@ -345,8 +345,8 @@ As another example, an email may be submitted to an SMTP server using:
|
|||||||
.Bd -literal -offset indent
|
.Bd -literal -offset indent
|
||||||
$ nc localhost 25 \*(Lt\*(Lt EOF
|
$ nc localhost 25 \*(Lt\*(Lt EOF
|
||||||
HELO host.example.com
|
HELO host.example.com
|
||||||
MAIL FROM: \*(Ltuser@host.example.com\*(Gt
|
MAIL FROM:\*(Ltuser@host.example.com\*(Gt
|
||||||
RCPT TO: \*(Ltuser2@host.example.com\*(Gt
|
RCPT TO:\*(Ltuser2@host.example.com\*(Gt
|
||||||
DATA
|
DATA
|
||||||
Body of email.
|
Body of email.
|
||||||
\&.
|
\&.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: netcat.c,v 1.87 2006/02/01 21:33:14 otto Exp $ */
|
/* $OpenBSD: netcat.c,v 1.89 2007/02/20 14:11:17 jmc Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
|
* Copyright (c) 2001 Eric Jackson <ericj@monkey.org>
|
||||||
*
|
*
|
||||||
@ -72,7 +72,7 @@
|
|||||||
/* Command Line Options */
|
/* Command Line Options */
|
||||||
int Eflag; /* Use IPsec ESP */
|
int Eflag; /* Use IPsec ESP */
|
||||||
int dflag; /* detached, no stdin */
|
int dflag; /* detached, no stdin */
|
||||||
int iflag; /* Interval Flag */
|
unsigned int iflag; /* Interval Flag */
|
||||||
int jflag; /* use jumbo frames if we can */
|
int jflag; /* use jumbo frames if we can */
|
||||||
int kflag; /* More than one connect */
|
int kflag; /* More than one connect */
|
||||||
int lflag; /* Bind to local port */
|
int lflag; /* Bind to local port */
|
||||||
@ -120,13 +120,13 @@ int
|
|||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ch, s, ret, socksv, ipsec_count;
|
int ch, s, ret, socksv, ipsec_count;
|
||||||
char *host, *uport, *endp;
|
char *host, *uport;
|
||||||
struct addrinfo hints;
|
struct addrinfo hints;
|
||||||
struct servent *sv;
|
struct servent *sv;
|
||||||
socklen_t len;
|
socklen_t len;
|
||||||
struct sockaddr_storage cliaddr;
|
struct sockaddr_storage cliaddr;
|
||||||
char *proxy;
|
char *proxy;
|
||||||
const char *proxyhost = "", *proxyport = NULL;
|
const char *errstr, *proxyhost = "", *proxyport = NULL;
|
||||||
struct addrinfo proxyhints;
|
struct addrinfo proxyhints;
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
@ -135,7 +135,6 @@ main(int argc, char *argv[])
|
|||||||
socksv = 5;
|
socksv = 5;
|
||||||
host = NULL;
|
host = NULL;
|
||||||
uport = NULL;
|
uport = NULL;
|
||||||
endp = NULL;
|
|
||||||
sv = NULL;
|
sv = NULL;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv,
|
while ((ch = getopt(argc, argv,
|
||||||
@ -182,9 +181,9 @@ main(int argc, char *argv[])
|
|||||||
help();
|
help();
|
||||||
break;
|
break;
|
||||||
case 'i':
|
case 'i':
|
||||||
iflag = (int)strtoul(optarg, &endp, 10);
|
iflag = strtonum(optarg, 0, UINT_MAX, &errstr);
|
||||||
if (iflag < 0 || *endp != '\0')
|
if (errstr)
|
||||||
errx(1, "interval cannot be negative");
|
errx(1, "interval %s: %s", errstr, optarg);
|
||||||
break;
|
break;
|
||||||
#ifdef SO_JUMBO
|
#ifdef SO_JUMBO
|
||||||
case 'j':
|
case 'j':
|
||||||
@ -225,11 +224,9 @@ main(int argc, char *argv[])
|
|||||||
vflag = 1;
|
vflag = 1;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
timeout = (int)strtoul(optarg, &endp, 10);
|
timeout = strtonum(optarg, 0, INT_MAX / 1000, &errstr);
|
||||||
if (timeout < 0 || *endp != '\0')
|
if (errstr)
|
||||||
errx(1, "timeout cannot be negative");
|
errx(1, "timeout %s: %s", errstr, optarg);
|
||||||
if (timeout >= (INT_MAX / 1000))
|
|
||||||
errx(1, "timeout too large");
|
|
||||||
timeout *= 1000;
|
timeout *= 1000;
|
||||||
break;
|
break;
|
||||||
case 'x':
|
case 'x':
|
||||||
@ -727,7 +724,8 @@ atelnet(int nfd, unsigned char *buf, unsigned int size)
|
|||||||
void
|
void
|
||||||
build_ports(char *p)
|
build_ports(char *p)
|
||||||
{
|
{
|
||||||
char *n, *endp;
|
const char *errstr;
|
||||||
|
char *n;
|
||||||
int hi, lo, cp;
|
int hi, lo, cp;
|
||||||
int x = 0;
|
int x = 0;
|
||||||
|
|
||||||
@ -739,12 +737,12 @@ build_ports(char *p)
|
|||||||
n++;
|
n++;
|
||||||
|
|
||||||
/* Make sure the ports are in order: lowest->highest. */
|
/* Make sure the ports are in order: lowest->highest. */
|
||||||
hi = (int)strtoul(n, &endp, 10);
|
hi = strtonum(n, 1, PORT_MAX, &errstr);
|
||||||
if (hi <= 0 || hi > PORT_MAX || *endp != '\0')
|
if (errstr)
|
||||||
errx(1, "port range not valid");
|
errx(1, "port number %s: %s", errstr, n);
|
||||||
lo = (int)strtoul(p, &endp, 10);
|
lo = strtonum(p, 1, PORT_MAX, &errstr);
|
||||||
if (lo <= 0 || lo > PORT_MAX || *endp != '\0')
|
if (errstr)
|
||||||
errx(1, "port range not valid");
|
errx(1, "port number %s: %s", errstr, p);
|
||||||
|
|
||||||
if (lo > hi) {
|
if (lo > hi) {
|
||||||
cp = hi;
|
cp = hi;
|
||||||
@ -774,9 +772,9 @@ build_ports(char *p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
hi = (int)strtoul(p, &endp, 10);
|
hi = strtonum(p, 1, PORT_MAX, &errstr);
|
||||||
if (hi <= 0 || hi > PORT_MAX || *endp != '\0')
|
if (errstr)
|
||||||
errx(1, "port range not valid");
|
errx(1, "port number %s: %s", errstr, p);
|
||||||
portlist[0] = calloc(1, PORT_MAX_LEN);
|
portlist[0] = calloc(1, PORT_MAX_LEN);
|
||||||
if (portlist[0] == NULL)
|
if (portlist[0] == NULL)
|
||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
@ -916,13 +914,12 @@ add_ipsec_policy(int s, char *policy)
|
|||||||
void
|
void
|
||||||
usage(int ret)
|
usage(int ret)
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifdef IPSEC
|
#ifdef IPSEC
|
||||||
fprintf(stderr, "usage: nc [-46DEdhklnrStUuvz] [-e policy] [-i interval] [-p source_port]\n");
|
fprintf(stderr, "usage: nc [-46DEdhklnrStUuvz] [-e policy] [-i interval] [-P proxy_username] [-p source_port]\n");
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "usage: nc [-46DdhklnrStUuvz] [-i interval] [-p source_port]\n");
|
fprintf(stderr, "usage: nc [-46DdhklnrStUuvz] [-i interval] [-P proxy_username] [-p source_port]\n");
|
||||||
#endif
|
#endif
|
||||||
fprintf(stderr, "\t [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_version]\n");
|
fprintf(stderr, "\t [-s source_ip_address] [-T ToS] [-w timeout] [-X proxy_protocol]\n");
|
||||||
fprintf(stderr, "\t [-x proxy_address[:port]] [hostname] [port[s]]\n");
|
fprintf(stderr, "\t [-x proxy_address[:port]] [hostname] [port[s]]\n");
|
||||||
if (ret)
|
if (ret)
|
||||||
exit(1);
|
exit(1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user