OpenBSD CVS

CVS log for src/usr.bin/nc/netcat.c


[BACK] Up to [local] / src / usr.bin / nc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.226 / (download) - annotate - [select for diffs], Mon Aug 14 08:07:27 2023 UTC (9 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.225: +9 -3 lines
Diff to previous 1.225 (colored)

netcat: avoid issuing syscalls on fd -1

In case a socket error condition occurs, readwrite() invalidates the
corresponding fd. Later on, readwrite() may still issue a syscall on
it. Avoid that by adding a couple of checks for fd == -1.

Reported and fix suggested by Leah Neukirchen.
Fixes https://github.com/libressl/openbsd/issues/143

"looks right" deraadt

Revision 1.225 / (download) - annotate - [select for diffs], Wed Jan 4 12:53:38 2023 UTC (16 months, 2 weeks ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.224: +2 -2 lines
Diff to previous 1.224 (colored)

ugly white space

Revision 1.224 / (download) - annotate - [select for diffs], Sun Dec 18 12:53:18 2022 UTC (17 months ago) by tb
Branch: MAIN
Changes since 1.223: +7 -4 lines
Diff to previous 1.223 (colored)

nc: skip connection info on failed or skipped udptest()

In udp mode, nc would always print that the connected succeeded
independently of whether that was actually the case. Don't do that.

idea/ok mpf

Revision 1.223 / (download) - annotate - [select for diffs], Sun Dec 18 12:51:10 2022 UTC (17 months ago) by tb
Branch: MAIN
Changes since 1.222: +4 -0 lines
Diff to previous 1.222 (colored)

nc: do not test the connection in non-interactive mode

The connection test writes four X to the socket, which corrupts data
that we may want to pipe into nc. So don't do that if stdin is not a
tty but still do it in scan mode, this is needed according to chris.

based on a diff by and ok mpf

Revision 1.222 / (download) - annotate - [select for diffs], Sun Dec 18 12:48:28 2022 UTC (17 months ago) by tb
Branch: MAIN
Changes since 1.221: +6 -6 lines
Diff to previous 1.221 (colored)

nc: clean up and simplify connection_infO()

ok mpf as part of a larger diff

Revision 1.221 / (download) - annotate - [select for diffs], Sun Dec 18 12:47:31 2022 UTC (17 months ago) by tb
Branch: MAIN
Changes since 1.220: +8 -6 lines
Diff to previous 1.220 (colored)

nc: pass protocol name to connection_info()

Avoids repeated use of ternary operator on globals.

Revision 1.220 / (download) - annotate - [select for diffs], Sun Dec 18 12:45:34 2022 UTC (17 months ago) by tb
Branch: MAIN
Changes since 1.219: +28 -25 lines
Diff to previous 1.219 (colored)

nc: factor printing of connection info into a function

This simply moves a chunk of code in this spaghetti mess into its own
function with minimal changes.

idea from a diff by mpf

Revision 1.219 / (download) - annotate - [select for diffs], Wed Jun 8 20:07:31 2022 UTC (23 months, 1 week ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.218: +19 -22 lines
Diff to previous 1.218 (colored)

KNF, mostly whitespace - no binary change on amd64

Revision 1.218 / (download) - annotate - [select for diffs], Mon Jul 12 15:09:20 2021 UTC (2 years, 10 months ago) by beck
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.217: +9 -9 lines
Diff to previous 1.217 (colored)

Change the error reporting pattern throughout the tree when unveil
fails to report the path that the failure occured on. Suggested by
deraadt@ after some tech discussion.

Work done and verified by Ashton Fagg <ashton@fagg.id.au>

ok deraadt@ semarie@ claudio@

Revision 1.217 / (download) - annotate - [select for diffs], Wed Feb 12 14:46:36 2020 UTC (4 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7
Changes since 1.216: +3 -3 lines
Diff to previous 1.216 (colored)

Standardize argument naming for "sourceaddr" and unify the wording a bit,
similar to what deraadt@ recently did in other manual pages.

Revision 1.216 / (download) - annotate - [select for diffs], Sun Jan 26 23:47:57 2020 UTC (4 years, 3 months ago) by beck
Branch: MAIN
Changes since 1.215: +36 -64 lines
Diff to previous 1.215 (colored)

revert previous nc loop refactor from 1.211, breaks bluhm's stuff

will attempt again later, now that there is new regress

Revision 1.215 / (download) - annotate - [select for diffs], Tue Jan 7 17:36:04 2020 UTC (4 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.214: +6 -5 lines
Diff to previous 1.214 (colored)

If the client provides a TLS certificate and the user specifies a
hash value on the nc(1) server command line, the netcat server must
use the TLS context of the accepted socket for verification.  As
the listening socket was used instead, the verification was always
successful.
If the peer provides a certificate, there must be a hash.  Make the
hash verification fail safe.
OK tb@

Revision 1.214 / (download) - annotate - [select for diffs], Mon Jan 6 19:39:58 2020 UTC (4 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.213: +23 -4 lines
Diff to previous 1.213 (colored)

The unveil(2) for nc -U -u -l was wrong.  The server cannot unveil
the file system as it has to connect to the UNIX domain client
socket.  The path of the latter is determined dynamically.  Instead
add a restrictive pledge(2) after connect(2).
OK tb@

Revision 1.213 / (download) - annotate - [select for diffs], Mon Jan 6 15:19:12 2020 UTC (4 years, 4 months ago) by bluhm
Branch: MAIN
Changes since 1.212: +10 -6 lines
Diff to previous 1.212 (colored)

When using UNIX domain sockets, always call report_sock() with the
path name of the socket.  This avoids bad errors from getnameinfo(3).
Use the same error check for both calls to getnameinfo(3).
OK millert@ tb@

Revision 1.212 / (download) - annotate - [select for diffs], Sun Nov 17 17:38:33 2019 UTC (4 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.211: +4 -8 lines
Diff to previous 1.211 (colored)

fail to usage if extra argv are present
noticed by jsing and beck, ok tedu

Revision 1.211 / (download) - annotate - [select for diffs], Wed Nov 13 04:10:38 2019 UTC (4 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.210: +64 -36 lines
Diff to previous 1.210 (colored)

refactor the nc pool loop to not shut down the socket early, and
to handle tls_shutdown correctly if using TLS, doing tls_shutdown
correctly if we are using the -N flag

ok sthen@

Revision 1.210 / (download) - annotate - [select for diffs], Mon Nov 4 17:33:28 2019 UTC (4 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.209: +18 -8 lines
Diff to previous 1.209 (colored)

Fix an out of bound read/write when using a proxy.
From Lucas AT sexy DOT is.  OK job@ kn@

Revision 1.209 / (download) - annotate - [select for diffs], Thu Oct 24 12:48:54 2019 UTC (4 years, 6 months ago) by job
Branch: MAIN
Changes since 1.208: +34 -12 lines
Diff to previous 1.208 (colored)

Print IP address in verbose mode

OK kn@

Revision 1.208 / (download) - annotate - [select for diffs], Wed Oct 23 13:49:24 2019 UTC (4 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.207: +0 -17 lines
Diff to previous 1.207 (colored)

Revert previous, which works for -N case but causes regress failures
for tls, since the socket is shut down without calling tls_close().
Since nc appears to have a problem with this in other shutdown() cases
I am simply going to bake a new diff for this.
noticed by bluhm@.

Revision 1.207 / (download) - annotate - [select for diffs], Thu Oct 17 14:29:24 2019 UTC (4 years, 7 months ago) by beck
Branch: MAIN
Changes since 1.206: +18 -1 lines
Diff to previous 1.206 (colored)

Fix -N flag to actually shut down the (entire) socket when the input
goes away. This allows for using nc in cases where the network server
will no longer expect anything after eof, instead of hanging waiting
for more input from our end.

Additionaly, shut down if tls is in use if either side of the socket
goes away, since we higher level TLS operations (tls_read and write)
will require the socket to be both readable and writable as we can
get TLS_WANT_POLLIN or TLS_WANT_POLLOUT on either operation.

deraadt@ buying it.  found by sthen@

Revision 1.206 / (download) - annotate - [select for diffs], Thu Aug 8 16:49:35 2019 UTC (4 years, 9 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.205: +2 -1 lines
Diff to previous 1.205 (colored)

added /* no filesystem visibility */ above unveil("/", "") since "" is too easy
to misread.

as per suggestion by and OK deraadt@

Revision 1.205 / (download) - annotate - [select for diffs], Fri Jun 28 13:35:02 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.204: +16 -16 lines
Diff to previous 1.204 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.204 / (download) - annotate - [select for diffs], Thu Jun 27 18:03:37 2019 UTC (4 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.203: +3 -3 lines
Diff to previous 1.203 (colored)

Some asprintf() calls were checked < 0, rather than the precise == -1.
ok millert nicm tb, etc

Revision 1.203 / (download) - annotate - [select for diffs], Tue Feb 26 17:32:47 2019 UTC (5 years, 2 months ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.202: +9 -5 lines
Diff to previous 1.202 (colored)

Correctly handle tls_read() and tls_write() failures.

Otherwise a TLS error (for example the remote end sent a fatal alert) is
silently ignored.

ok bluhm@ tb@

Revision 1.202 / (download) - annotate - [select for diffs], Thu Jan 10 12:44:54 2019 UTC (5 years, 4 months ago) by mestre
Branch: MAIN
Changes since 1.201: +5 -6 lines
Diff to previous 1.201 (colored)

Revert back previous commit and stop including strings.h

Use memset(3) instead of bzero(3) since POSIX recommends using the former and
because it's also more portable (conforms to ANSI C standard)

OK tedu@ tb@

Revision 1.201 / (download) - annotate - [select for diffs], Wed Jan 9 12:58:18 2019 UTC (5 years, 4 months ago) by inoguchi
Branch: MAIN
Changes since 1.200: +2 -1 lines
Diff to previous 1.200 (colored)

Include strings.h for bzero in usr.bin/nc

bzero is defined in strings.h.

ok deraadt@

Revision 1.200 / (download) - annotate - [select for diffs], Thu Dec 27 17:22:45 2018 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
Changes since 1.199: +3 -2 lines
Diff to previous 1.199 (colored)

port ranges can be ambiguous with hypenated port-names.
specify that ranges must be numeric, and only check for range if
first argument is a digit.
identified by danj, fix suggest by sthen

Revision 1.199 / (download) - annotate - [select for diffs], Thu Nov 29 14:25:06 2018 UTC (5 years, 5 months ago) by tedu
Branch: MAIN
Changes since 1.198: +6 -5 lines
Diff to previous 1.198 (colored)

update for libtls default cert changes.
bonus: this exposed a few missing const qualifiers.

Revision 1.198 / (download) - annotate - [select for diffs], Fri Nov 9 04:05:14 2018 UTC (5 years, 6 months ago) by bluhm
Branch: MAIN
Changes since 1.197: +29 -16 lines
Diff to previous 1.197 (colored)

In verbose mode netcat reports to stderr when the listen system
call has finished.  This allows to write race free scripts as they
can check that the server is up and running.
OK sthen@ tb@

Revision 1.197 / (download) - annotate - [select for diffs], Tue Nov 6 20:39:19 2018 UTC (5 years, 6 months ago) by jsing
Branch: MAIN
Changes since 1.196: +2 -3 lines
Diff to previous 1.196 (colored)

Use TLS_CA_CERT_FILE instead of a separate define.

ok beck@ bluhm@ tb@

Revision 1.196 / (download) - annotate - [select for diffs], Fri Oct 26 07:19:26 2018 UTC (5 years, 6 months ago) by dlg
Branch: MAIN
Changes since 1.195: +4 -2 lines
Diff to previous 1.195 (colored)

show what went wrong with a unix domain socket, rather than fail silently

handy if you type the path wrong or don't have permission...

ok deraadt@

Revision 1.195 / (download) - annotate - [select for diffs], Thu Oct 4 17:04:50 2018 UTC (5 years, 7 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.194: +10 -12 lines
Diff to previous 1.194 (colored)

Plug TLS context leak in nc(1) server and client mode.  Move
tls_free(3) directly after close(2) to catch all cases.
based on a patch from Nan Xiao; OK tb@ deraadt@

Revision 1.194 / (download) - annotate - [select for diffs], Fri Sep 7 09:55:29 2018 UTC (5 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.193: +3 -3 lines
Diff to previous 1.193 (colored)

Declare strings passed to local_listen() as const.  This makes it
consistent to remote_connect() and getaddrinfo(3).
from Nan Xiao

Revision 1.193 / (download) - annotate - [select for diffs], Thu Sep 6 13:23:02 2018 UTC (5 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.192: +6 -5 lines
Diff to previous 1.192 (colored)

Do not close the socket twice in netcat.
from Nan Xiao; OK tb@

Revision 1.192 / (download) - annotate - [select for diffs], Fri Aug 10 17:15:22 2018 UTC (5 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.191: +24 -1 lines
Diff to previous 1.191 (colored)

In typical swiss-army style, various modes and options cause
different unveils.  Joint work with beck and florian.
Let us know if you hit any corner cases.

Revision 1.191 / (download) - annotate - [select for diffs], Fri Apr 27 15:17:53 2018 UTC (6 years ago) by beck
Branch: MAIN
Changes since 1.190: +17 -17 lines
Diff to previous 1.190 (colored)

trailing whitespace, and move arg checking before pledge
in preparation for pledgepath
ok deraadt@

Revision 1.190 / (download) - annotate - [select for diffs], Mon Mar 19 16:35:29 2018 UTC (6 years, 2 months ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.189: +1 -3 lines
Diff to previous 1.189 (colored)

Remove the tls_init() call, since it is no longer necessary.

ok bcook@ beck@ inoguchi@

Revision 1.189 / (download) - annotate - [select for diffs], Tue Nov 28 16:59:10 2017 UTC (6 years, 5 months ago) by jsing
Branch: MAIN
Changes since 1.188: +47 -33 lines
Diff to previous 1.188 (colored)

Allow TLS ciphers and protocols to be specified for nc(1).

Replace the "tlscompat" and "tlsall" options with "cipher" and "protocol"
options that are key/value pairs. This allows the user to specify ciphers
and protocols in a form that are accepted by tls_config_set_ciphers() and
tls_config_set_protocols() respectively.

ok beck@

(also ok jmc@ for a previous revision of the man page).

Revision 1.188 / (download) - annotate - [select for diffs], Tue Oct 24 17:49:35 2017 UTC (6 years, 6 months ago) by bluhm
Branch: MAIN
Changes since 1.187: +4 -5 lines
Diff to previous 1.187 (colored)

Use a smaller buffer size too peek the receive data.  The content
is discarded anyway, the plen variable is a leftover from the -j
jumbo option.
reported by Nan Xiao; OK deraadt@

Revision 1.187 / (download) - annotate - [select for diffs], Sat Jul 15 17:27:39 2017 UTC (6 years, 10 months ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.186: +8 -3 lines
Diff to previous 1.186 (colored)

Add a "-T tlscompat" option to nc(1), which enables the use of all TLS
protocols and "compat" ciphers. This allows for TLS connections to TLS
servers that are using less than ideal cipher suites, without having to
resort to "-T tlsall" which enables all known cipher suites.

Diff from Kyle J. McKay <mackyle at gmail dot com>

ok beck@

Revision 1.186 / (download) - annotate - [select for diffs], Sun Jun 11 14:38:52 2017 UTC (6 years, 11 months ago) by tb
Branch: MAIN
Changes since 1.185: +8 -8 lines
Diff to previous 1.185 (colored)

Continue the flattening of the pledge logic started in r1.184 and place
a blank space somewhere else.

suggested by and ok jsing

Revision 1.185 / (download) - annotate - [select for diffs], Sun Jun 11 10:53:07 2017 UTC (6 years, 11 months ago) by tb
Branch: MAIN
Changes since 1.184: +35 -33 lines
Diff to previous 1.184 (colored)

Simple style(9) fixes from Juuso Lapinlampi, mostly whitespace and
omitting parentheses in return statements. Binary change because of
return instead of exit(3) from main and because help() is now __dead.

ok awolk

Revision 1.184 / (download) - annotate - [select for diffs], Sat Jun 10 18:14:10 2017 UTC (6 years, 11 months ago) by tb
Branch: MAIN
Changes since 1.183: +5 -8 lines
Diff to previous 1.183 (colored)

If -P and -c were given, a second pledge call tried to add "rpath" to the
first pledge promises, so nc exited with EPERM. To fix this, merge the
pledge of the Pflag && usetls case into the first pledge block. This
allows us to get rid of the second pledge block and thus to simplify the
logic a bit. While there, add a missing blank to an error string.

Joint effort by the #openbsd-daily code reading group, problem found and
initial patch by <rain1 openmailbox org>.

ok awolk

Revision 1.183 / (download) - annotate - [select for diffs], Fri May 26 16:05:35 2017 UTC (6 years, 11 months ago) by bluhm
Branch: MAIN
Changes since 1.182: +9 -9 lines
Diff to previous 1.182 (colored)

Fix gcc warnings triggered by WARNINGS=yes.
OK florian@

Revision 1.182 / (download) - annotate - [select for diffs], Wed May 10 21:56:53 2017 UTC (7 years ago) by bluhm
Branch: MAIN
Changes since 1.181: +21 -6 lines
Diff to previous 1.181 (colored)

Implement nc -W recvlimit to terminate netcat after receiving a
number of packets.  This allows to send a UDP request, receive a
reply and check the result on the command line.
input jmc@; OK millert@

Revision 1.181 / (download) - annotate - [select for diffs], Sun Apr 16 15:11:01 2017 UTC (7 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.180: +13 -12 lines
Diff to previous 1.180 (colored)

Move comments into a block and uses {} to unconfuse reading.

Revision 1.180 / (download) - annotate - [select for diffs], Wed Apr 5 06:55:59 2017 UTC (7 years, 1 month ago) by jmc
Branch: MAIN
Changes since 1.179: +4 -2 lines
Diff to previous 1.179 (colored)

- -Z before -z in options list
- add -Z to help and usage()

Revision 1.179 / (download) - annotate - [select for diffs], Wed Apr 5 03:20:19 2017 UTC (7 years, 1 month ago) by beck
Branch: MAIN
Changes since 1.178: +32 -2 lines
Diff to previous 1.178 (colored)

Allow nc to save the peer certificate and chain in a pem file specified
with -Z
ok jsing@

Revision 1.178 / (download) - annotate - [select for diffs], Thu Mar 9 13:58:00 2017 UTC (7 years, 2 months ago) by bluhm
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.177: +2 -2 lines
Diff to previous 1.177 (colored)

The netcat server did not print the correct TLS error message if
the handshake after accept had failed.  Use the context of the
accepted TLS connection.
OK beck@

Revision 1.177 / (download) - annotate - [select for diffs], Thu Feb 9 22:55:45 2017 UTC (7 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.176: +4 -3 lines
Diff to previous 1.176 (colored)

When netcat was started with -Uz, the exit status was always 1.  If
the unix connect is successful, let nc -z close the socket and exit
with 0.
OK jca@

Revision 1.176 / (download) - annotate - [select for diffs], Thu Feb 9 20:14:41 2017 UTC (7 years, 3 months ago) by jca
Branch: MAIN
Changes since 1.175: +3 -2 lines
Diff to previous 1.175 (colored)

When getaddrinfo fails, print the requested host and port.

Should make debugging easier, especially when using -x literal_ipv6_address

Revision 1.175 / (download) - annotate - [select for diffs], Wed Feb 8 18:44:50 2017 UTC (7 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.174: +8 -18 lines
Diff to previous 1.174 (colored)

Avoid a busy loop in netcat's tls_close().  Reuse the tls_handshake()
wrapper that calls poll(2) and handles the -w timeout.
OK beck@

Revision 1.174 / (download) - annotate - [select for diffs], Wed Feb 8 18:03:31 2017 UTC (7 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.173: +5 -13 lines
Diff to previous 1.173 (colored)

Avoid double close(2) in netcat.  After every call to readwrite()
there is already a close(2), so do not do it in readwrite().
OK beck@

Revision 1.173 / (download) - annotate - [select for diffs], Wed Feb 8 13:43:33 2017 UTC (7 years, 3 months ago) by bluhm
Branch: MAIN
Changes since 1.172: +42 -21 lines
Diff to previous 1.172 (colored)

Due to non-blocking sockets, tls_handshake() could wait in a busy
loop.  Use an additional poll(2) during the handshake and also
respect the -w timeout option there.
From Shuo Chen; OK beck@

Revision 1.172 / (download) - annotate - [select for diffs], Sun Feb 5 01:39:14 2017 UTC (7 years, 3 months ago) by jca
Branch: MAIN
Changes since 1.171: +24 -10 lines
Diff to previous 1.171 (colored)

Support IPv6 proxy addresses

ok beck@

Revision 1.171 / (download) - annotate - [select for diffs], Wed Nov 30 07:56:23 2016 UTC (7 years, 5 months ago) by mestre
Branch: MAIN
Changes since 1.170: +6 -3 lines
Diff to previous 1.170 (colored)

Check return value of tls_config_set_protocols(3) and tls_config_set_ciphers(3)
and bail out in case of failure

Feedback and OK jsing@

Revision 1.170 / (download) - annotate - [select for diffs], Sun Nov 6 13:33:30 2016 UTC (7 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.169: +4 -4 lines
Diff to previous 1.169 (colored)

rename tlslegacy to tlsall, and better describe what it does.
ok jsing@

Revision 1.169 / (download) - annotate - [select for diffs], Sat Nov 5 16:03:09 2016 UTC (7 years, 6 months ago) by jmc
Branch: MAIN
Changes since 1.168: +6 -3 lines
Diff to previous 1.168 (colored)

zap trailing whitespace, and add -o to usage() and help (-h);

Revision 1.168 / (download) - annotate - [select for diffs], Sat Nov 5 15:13:26 2016 UTC (7 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.167: +10 -2 lines
Diff to previous 1.167 (colored)

Add support for server side OCSP stapling to libtls.
Add support for server side OCSP stapling to netcat.

Revision 1.167 / (download) - annotate - [select for diffs], Fri Nov 4 05:13:13 2016 UTC (7 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.166: +5 -1 lines
Diff to previous 1.166 (colored)

Add ocsp_require_stapling config option for tls - allows a connection
to indicate that it requires the peer to provide a stapled OCSP response
with the handshake.  Provide a "-T muststaple" for nc that uses it.
ok jsing@, guenther@

Revision 1.166 / (download) - annotate - [select for diffs], Thu Nov 3 15:54:39 2016 UTC (7 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.165: +3 -2 lines
Diff to previous 1.165 (colored)

make OCSP_URL only show up when an OCSP url is actually present in the cert

Revision 1.165 / (download) - annotate - [select for diffs], Thu Nov 3 15:52:10 2016 UTC (7 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.164: +3 -5 lines
Diff to previous 1.164 (colored)

Make OCSP Stapling: only appear if there is stapling info present.

Revision 1.164 / (download) - annotate - [select for diffs], Wed Nov 2 15:18:42 2016 UTC (7 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.163: +37 -1 lines
Diff to previous 1.163 (colored)

Add OCSP client side support to libtls.
   - Provide access to certificate OCSP URL
   - Provide ability to check a raw OCSP reply against an
     established TLS ctx
   - Check and validate OCSP stapling info in the TLS handshake
     if a stapled OCSP response is provided.`

Add example code to show OCSP URL and stapled info
into netcat.

ok jsing@

Revision 1.163 / (download) - annotate - [select for diffs], Sat Sep 3 17:35:34 2016 UTC (7 years, 8 months ago) by bcook
Branch: MAIN
Changes since 1.162: +3 -3 lines
Diff to previous 1.162 (colored)

squash some possibly-used-uninitialized warnings

Revision 1.162 / (download) - annotate - [select for diffs], Sat Aug 13 13:09:10 2016 UTC (7 years, 9 months ago) by jsing
Branch: MAIN
Changes since 1.161: +15 -22 lines
Diff to previous 1.161 (colored)

Let libtls load the CA, certificate and key files for nc(1), now that it
does this at the time the tls_config_set_*_file() function is called.

ok bluhm@

Revision 1.161 / (download) - annotate - [select for diffs], Sat Jul 30 22:04:04 2016 UTC (7 years, 9 months ago) by halex
Branch: MAIN
Changes since 1.160: +19 -21 lines
Diff to previous 1.160 (colored)

use the style from the man page examples for getaddrinfo, which makes a
bit more sense

ok jung@ deraadt@

Revision 1.160 / (download) - annotate - [select for diffs], Wed Jul 13 16:35:47 2016 UTC (7 years, 10 months ago) by jsing
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.159: +2 -2 lines
Diff to previous 1.159 (colored)

Adjust existing tls_config_set_cipher() callers for TLS cipher group
changes - map the previous configuration to the equivalent in the new
groups. This will be revisited post release.

Discussed with beck@

Revision 1.159 / (download) - annotate - [select for diffs], Thu Jul 7 14:09:44 2016 UTC (7 years, 10 months ago) by jsing
Branch: MAIN
Changes since 1.158: +23 -15 lines
Diff to previous 1.158 (colored)

Revert previous since the libtls change has been reverted.

Revision 1.158 / (download) - annotate - [select for diffs], Wed Jul 6 16:31:18 2016 UTC (7 years, 10 months ago) by jsing
Branch: MAIN
Changes since 1.157: +16 -24 lines
Diff to previous 1.157 (colored)

Remove manual file loading (now that libtls does this for us) and adjust
pledge to match. Also use tls_config_error() to provide friendlier error
messages.

Revision 1.157 / (download) - annotate - [select for diffs], Fri Jul 1 00:29:14 2016 UTC (7 years, 10 months ago) by bcook
Branch: MAIN
Changes since 1.156: +26 -34 lines
Diff to previous 1.156 (colored)

Simplify IP proto-specific sockopt error handling.

This makes error messages more specific and simplifies
masking compatible sections for the portable version.

ok beck@

Revision 1.156 / (download) - annotate - [select for diffs], Tue Jun 28 17:35:14 2016 UTC (7 years, 10 months ago) by jca
Branch: MAIN
Changes since 1.155: +43 -7 lines
Diff to previous 1.155 (colored)

Add -M and -m options to specify the outgoing and incoming minimum TTL

Req by and ok blumh@

Revision 1.155 / (download) - annotate - [select for diffs], Tue Jun 28 00:01:10 2016 UTC (7 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.154: +13 -5 lines
Diff to previous 1.154 (colored)

If an error path if close() is called, save errno so that original error
is shown by errx
ok millert krw

Revision 1.154 / (download) - annotate - [select for diffs], Mon Jun 27 23:58:08 2016 UTC (7 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.153: +6 -7 lines
Diff to previous 1.153 (colored)

Be more careful initializing and tracking socket s through main, this is
so complicated that a future refactoring could easily in introduce a bug.
ok millert krw

Revision 1.153 / (download) - annotate - [select for diffs], Thu Jun 2 04:26:32 2016 UTC (7 years, 11 months ago) by beck
Branch: MAIN
Changes since 1.152: +30 -14 lines
Diff to previous 1.152 (colored)

Let netcat support the use of service names instead of port numbers.
based on a diff from Andras Farkas <deepbluemistake@gmail.com>
ok deraadt@

Revision 1.152 / (download) - annotate - [select for diffs], Sat May 28 20:14:58 2016 UTC (7 years, 11 months ago) by beck
Branch: MAIN
Changes since 1.151: +12 -3 lines
Diff to previous 1.151 (colored)

Fix pledge violation with -P s used and we need to supply a password
for an http proxy - we need tty in this case.  Found and fixed by
Anthony Coulter <bsd@anthonycoulter.name>.
ok tb@

Revision 1.151 / (download) - annotate - [select for diffs], Sat May 28 19:39:16 2016 UTC (7 years, 11 months ago) by beck
Branch: MAIN
Changes since 1.150: +11 -5 lines
Diff to previous 1.150 (colored)

Fix nc -verbose mode when used on a unix domain socket.
Noticed by and a modified version of fix from <attila@stalphonsos.com>

Revision 1.150 / (download) - annotate - [select for diffs], Mon Jan 4 02:18:31 2016 UTC (8 years, 4 months ago) by bcook
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.149: +5 -5 lines
Diff to previous 1.149 (colored)

Use the correct values for TLS certificate / private key flags.

fix from Andreas Bartelt <obsd at bartula.de>

Revision 1.149 / (download) - annotate - [select for diffs], Mon Dec 28 14:17:47 2015 UTC (8 years, 4 months ago) by bcook
Branch: MAIN
Changes since 1.148: +2 -2 lines
Diff to previous 1.148 (colored)

include time.h over sys/time.h for ctime(3)

ok beck@

Revision 1.148 / (download) - annotate - [select for diffs], Thu Dec 17 19:30:28 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
Changes since 1.147: +2 -2 lines
Diff to previous 1.147 (colored)

Add missing colon after "Peer name" in verbose output. Mentioned on the
lists recently.

Revision 1.147 / (download) - annotate - [select for diffs], Wed Dec 16 14:23:33 2015 UTC (8 years, 5 months ago) by beck
Branch: MAIN
Changes since 1.146: +7 -4 lines
Diff to previous 1.146 (colored)

clean up some unused variables, and add the printing of the certificate validity
to the verbose output when using tls - from rob@2keys.ca
ok mmcc@ jsing@ deraadt@

Revision 1.146 / (download) - annotate - [select for diffs], Tue Dec 8 15:33:33 2015 UTC (8 years, 5 months ago) by beck
Branch: MAIN
Changes since 1.145: +21 -5 lines
Diff to previous 1.145 (colored)

pledge nc better - Load the certificate into memory and then do the pledge,
this allows us to drop the rpath fromt the nc pledge.
ok deraadt@, tedu@

Revision 1.145 / (download) - annotate - [select for diffs], Mon Dec 7 02:38:54 2015 UTC (8 years, 5 months ago) by tb
Branch: MAIN
Changes since 1.144: +16 -20 lines
Diff to previous 1.144 (colored)

Get rid of modulo bias and replace the naive shuffle by the
Knuth-Fisher-Yates shuffle to make the random sequence of ports
less biased.  Based on the implementation in sys/netinet/ip_id.c.
With helpful input from daniel@ and beck@

ok beck@ despite eye twitching

Revision 1.144 / (download) - annotate - [select for diffs], Mon Nov 23 01:23:56 2015 UTC (8 years, 5 months ago) by bcook
Branch: MAIN
Changes since 1.143: +13 -13 lines
Diff to previous 1.143 (colored)

rename variable 'sun' to allow building on Solaris

ok deraadt@

Revision 1.143 / (download) - annotate - [select for diffs], Fri Nov 13 18:13:13 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.142: +7 -10 lines
Diff to previous 1.142 (colored)

Since rtable was hoisted to the top with setrtable, it should have no
bearing on the following pledge setups anymore.
ok benno

Revision 1.142 / (download) - annotate - [select for diffs], Thu Nov 12 20:33:52 2015 UTC (8 years, 6 months ago) by benno
Branch: MAIN
Changes since 1.141: +4 -15 lines
Diff to previous 1.141 (colored)

with -V argument, dont set rtable on the socket, instead set if for the whole
process, before pledge(). This way the rtable can be pledged too.
the discussion about removing -V is postponed.

diff from beck@, i wrote the same diff without seeing his, and various
people at u2k15 agreed this is the right thing to do.
ok phessler@

Revision 1.141 / (download) - annotate - [select for diffs], Sun Nov 1 01:05:31 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.140: +3 -3 lines
Diff to previous 1.140 (colored)

KNF; from Rob Pierce

Revision 1.140 / (download) - annotate - [select for diffs], Fri Oct 23 05:27:17 2015 UTC (8 years, 6 months ago) by beck
Branch: MAIN
Changes since 1.139: +27 -1 lines
Diff to previous 1.139 (colored)

Initial pledge of netcat - unfortunately flawed because fiddling the rtableid
in a socket option can be pretty scary and there is no better interface for this.
so if the -V option is used you get no pledge at all.. Otherwise, do what
works for the various options.  Still needs refinement for tls to drop rpath,
and a better solution for the routing table stuff

Revision 1.139 / (download) - annotate - [select for diffs], Sun Oct 11 00:26:23 2015 UTC (8 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.138: +3 -8 lines
Diff to previous 1.138 (colored)

Userspace doesn't need to use SUN_LEN(): connect() and bind() must accept
sizeof(struct sockaddr_un), so do the simple, portable thing

ok beck@ deraadt@

Revision 1.138 / (download) - annotate - [select for diffs], Sun Sep 13 11:12:09 2015 UTC (8 years, 8 months ago) by beck
Branch: MAIN
Changes since 1.137: +3 -2 lines
Diff to previous 1.137 (colored)

display negotiated TLS version and cipher suite in verbose mode.
ok jsing@

Revision 1.137 / (download) - annotate - [select for diffs], Sat Sep 12 21:01:14 2015 UTC (8 years, 8 months ago) by beck
Branch: MAIN
Changes since 1.136: +14 -21 lines
Diff to previous 1.136 (colored)

Adapt to just committed libtls api change

Revision 1.136 / (download) - annotate - [select for diffs], Sat Sep 12 08:38:33 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.135: +16 -12 lines
Diff to previous 1.135 (colored)

use SOCK_CLOEXEC instead of fnctl; ok guenther beck jsing

Revision 1.135 / (download) - annotate - [select for diffs], Sat Sep 12 07:56:56 2015 UTC (8 years, 8 months ago) by jmc
Branch: MAIN
Changes since 1.134: +17 -10 lines
Diff to previous 1.134 (colored)

fix previous;

Revision 1.134 / (download) - annotate - [select for diffs], Fri Sep 11 21:22:54 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.133: +18 -19 lines
Diff to previous 1.133 (colored)

spaces found during a read

Revision 1.133 / (download) - annotate - [select for diffs], Fri Sep 11 21:07:01 2015 UTC (8 years, 8 months ago) by beck
Branch: MAIN
Changes since 1.132: +298 -38 lines
Diff to previous 1.132 (colored)

Add TLS suppport to nc. Provides a useful little test and script tool.
ok jsing@ bluhm@

Revision 1.132 / (download) - annotate - [select for diffs], Tue Sep 8 17:28:47 2015 UTC (8 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.131: +6 -15 lines
Diff to previous 1.131 (colored)

Netcat could hang during write(2) although poll(2) reports that the
socket is writeable.  This happens because netcat tries to write
more than the low water mark of the socket write buffer.  With a
non-blocking socket you may get a short write, otherwise it blocks.
The latter could cause a total hang of the netcat process depending
on the upper protocol.  So make the network connection non-blocking.
OK claudio@ millert@

Revision 1.131 / (download) - annotate - [select for diffs], Thu Sep 3 23:06:28 2015 UTC (8 years, 8 months ago) by sobrado
Branch: MAIN
Changes since 1.130: +2 -2 lines
Diff to previous 1.130 (colored)

synchronize synopsis and usage.

Revision 1.130 / (download) - annotate - [select for diffs], Sun Jul 26 19:12:28 2015 UTC (8 years, 9 months ago) by chl
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.129: +2 -2 lines
Diff to previous 1.129 (colored)

remove unused variable

ok tedu@

Revision 1.129 / (download) - annotate - [select for diffs], Thu Mar 26 21:22:50 2015 UTC (9 years, 1 month ago) by tobias
Branch: MAIN
Changes since 1.128: +6 -3 lines
Diff to previous 1.128 (colored)

The code in socks.c writes multiple times in a row to a socket. If the
socket becomes invalid between these calls (e.g. connection closed), write
will throw SIGPIPE. With this patch, SIGPIPE is ignored so we can
handle write's -1 return value (errno will be EPIPE). Ultimately, it leads
to program exit, too -- but with nicer error message. :)

with input by and ok djm

Revision 1.128 / (download) - annotate - [select for diffs], Thu Mar 26 10:36:03 2015 UTC (9 years, 1 month ago) by tobias
Branch: MAIN
Changes since 1.127: +3 -4 lines
Diff to previous 1.127 (colored)

Check for short writes in fdpass(). Clean up while at it.

ok djm

Revision 1.127 / (download) - annotate - [select for diffs], Sat Feb 14 22:40:22 2015 UTC (9 years, 3 months ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.126: +16 -7 lines
Diff to previous 1.126 (colored)

Support for nc -T on IPv6 addresses.

ok sthen@

Revision 1.126 / (download) - annotate - [select for diffs], Thu Oct 30 16:08:31 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.125: +2 -2 lines
Diff to previous 1.125 (colored)

my mistake. we already did increase buffers to 16k; increasing to 64k
would be the next stage of embiggening. restore 16k.

Revision 1.125 / (download) - annotate - [select for diffs], Thu Oct 30 16:06:07 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.124: +211 -47 lines
Diff to previous 1.124 (colored)

rework the poll loop to poll in both directions so it doesn't get stuck
if one pipe stalls out. from a diff by Arne Becker.
(buffer size left alone for now)

Revision 1.124 / (download) - annotate - [select for diffs], Sun Oct 26 13:59:30 2014 UTC (9 years, 6 months ago) by millert
Branch: MAIN
Changes since 1.123: +3 -3 lines
Diff to previous 1.123 (colored)

POLLIN is not guaranteed to be set in revents for EOF so check for
POLLHUP too.  OK deraadt@

Revision 1.123 / (download) - annotate - [select for diffs], Fri Oct 24 02:01:20 2014 UTC (9 years, 6 months ago) by lteo
Branch: MAIN
Changes since 1.122: +1 -2 lines
Diff to previous 1.122 (colored)

Remove unnecessary include: netinet/in_systm.h is not needed by these
programs.

ok deraadt@ millert@

Revision 1.122 / (download) - annotate - [select for diffs], Sun Jul 20 01:38:40 2014 UTC (9 years, 10 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.121: +3 -2 lines
Diff to previous 1.121 (colored)

Make sure the correct errno is reported by warn* or err* and not
the errno of an intervening cleanup operation like close/unlink/etc.

Diff from Doug Hogan (doug (at) acyclic.org)

Revision 1.121 / (download) - annotate - [select for diffs], Tue Jun 10 16:35:42 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.120: +2 -2 lines
Diff to previous 1.120 (colored)

stick with 16k buffers for a little while to avoid bufferbloat.
atomicio writing out 64k in one direction will cause traffic in the other
direction to stall until it's complete. discussion with deraadt

Revision 1.120 / (download) - annotate - [select for diffs], Tue Jun 10 16:23:07 2014 UTC (9 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.119: +3 -3 lines
Diff to previous 1.119 (colored)

increase buffer size to 64k, and actually use it. ok deraadt
from John-Mark Gurney

Revision 1.119 / (download) - annotate - [select for diffs], Tue May 20 01:25:23 2014 UTC (10 years ago) by guenther
Branch: MAIN
Changes since 1.118: +2 -2 lines
Diff to previous 1.118 (colored)

Use errc/warnc to simplify code.
Also, in 'ftp', always put the error message last, after the hostname/ipaddr.

ok jsing@ krw@ millert@

Revision 1.118 / (download) - annotate - [select for diffs], Wed Mar 12 10:19:40 2014 UTC (10 years, 2 months ago) by jca
Branch: MAIN
Changes since 1.117: +2 -3 lines
Diff to previous 1.117 (colored)

Unbreak nc -6 -l.  Don't retrieve and thus later set the routing table
unless -V is passed (intent of the previous commit), and use SOL_SOCKET
instead of IPPROTO_IP to set the rtable in local_listen().  ok sthen@

Revision 1.117 / (download) - annotate - [select for diffs], Sat Oct 26 21:33:29 2013 UTC (10 years, 6 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.116: +7 -7 lines
Diff to previous 1.116 (colored)

Only use setsockopt(..SO_RTABLE..) if the -V flag is given to nc/telnet,
same style as traceroute6 (change to int and use -1 as a flag, so rtable 0
can still be used as an explicit parameter).

Revision 1.116 / (download) - annotate - [select for diffs], Mon Oct 21 09:12:55 2013 UTC (10 years, 7 months ago) by phessler
Branch: MAIN
Changes since 1.115: +2 -1 lines
Diff to previous 1.115 (colored)

Oups, a little bit overzealous.  If we "route -T4 exec telnet foo", then
make sure telnet runs in rdomain 4 as expected.  Same for nc.

Revision 1.115 / (download) - annotate - [select for diffs], Mon Oct 21 08:59:49 2013 UTC (10 years, 7 months ago) by phessler
Branch: MAIN
Changes since 1.114: +7 -11 lines
Diff to previous 1.114 (colored)

Set the requested rdomain on the socket instead of only on the IPv4 part.

Also, switching to rdomain zero is a legit option so we should allow that.

Revision 1.114 / (download) - annotate - [select for diffs], Tue Aug 20 21:04:40 2013 UTC (10 years, 9 months ago) by jmc
Branch: MAIN
Changes since 1.113: +3 -2 lines
Diff to previous 1.113 (colored)

add -F to usage() and help();
ok djm

Revision 1.113 / (download) - annotate - [select for diffs], Tue Aug 20 16:22:09 2013 UTC (10 years, 9 months ago) by djm
Branch: MAIN
Changes since 1.112: +71 -3 lines
Diff to previous 1.112 (colored)

add -F flag to enabled fd-pass mode: establish connection and pass
connected socket to stdout. This is useful in proxy mode to establish
a connection for use by ssh in conjunction with its new ProxyUseFDPass
option; ok markus@

Revision 1.112 / (download) - annotate - [select for diffs], Mon Apr 29 00:28:23 2013 UTC (11 years ago) by okan
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.111: +2 -2 lines
Diff to previous 1.111 (colored)

use FD_CLOEXEC instead of 1; from David Hill

ok otto

Revision 1.111 / (download) - annotate - [select for diffs], Wed Mar 20 09:27:56 2013 UTC (11 years, 2 months ago) by sthen
Branch: MAIN
Changes since 1.110: +10 -4 lines
Diff to previous 1.110 (colored)

Don't shutdown nc(1)'s network socket when stdin closes. Matches *Hobbit*'s
original netcat and GNU netcat; revert to old behaviour with the new -N flag
if needed. After much discussion with otto deraadt tedu and Martin Pelikan.
ok deraadt@

Revision 1.110 / (download) - annotate - [select for diffs], Tue Mar 12 02:57:37 2013 UTC (11 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.109: +5 -4 lines
Diff to previous 1.109 (colored)

All accept() errors are considered fatal, until someone gives a different
reason.  No code changed, just documenting it...

Revision 1.109 / (download) - annotate - [select for diffs], Sat Jul 7 15:33:02 2012 UTC (11 years, 10 months ago) by haesbaert
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.108: +11 -5 lines
Diff to previous 1.108 (colored)

Allow UDP server to receive datagrams from multiple socket pairs with -k
flag. Prompted by a question from dsp at 2f30 dot org, diff from Lazarom
Koromil with a few tweaks by me, many thanks.

ok mikeb@ nicm@ haesbaert@

Revision 1.108 / (download) - annotate - [select for diffs], Sat Jul 7 09:36:30 2012 UTC (11 years, 10 months ago) by haesbaert
Branch: MAIN
Changes since 1.107: +35 -1 lines
Diff to previous 1.107 (colored)

Report incoming connections when -l is specified with -v.

From Ricky Zhou with a few tweaks by me.

ok henning@ haesbaert@

Revision 1.107 / (download) - annotate - [select for diffs], Sun Apr 1 02:58:57 2012 UTC (12 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.106: +3 -1 lines
Diff to previous 1.106 (colored)

error out if accept() fails

Revision 1.106 / (download) - annotate - [select for diffs], Sat Mar 17 10:16:41 2012 UTC (12 years, 2 months ago) by dlg
Branch: MAIN
Changes since 1.105: +4 -13 lines
Diff to previous 1.105 (colored)

remove IP_JUMBO, SO_JUMBO, and RTF_JUMBO.

no objection from mcbride@ krw@ markus@ deraadt@

Revision 1.105 / (download) - annotate - [select for diffs], Thu Feb 9 06:25:35 2012 UTC (12 years, 3 months ago) by lum
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.104: +3 -4 lines
Diff to previous 1.104 (colored)

Update comments. ok deraadt@

Revision 1.104 / (download) - annotate - [select for diffs], Thu Feb 9 03:27:36 2012 UTC (12 years, 3 months ago) by lum
Branch: MAIN
Changes since 1.103: +1 -4 lines
Diff to previous 1.103 (colored)

Remove unused protocol value check. ok brynet@

Revision 1.103 / (download) - annotate - [select for diffs], Tue Oct 4 08:34:34 2011 UTC (12 years, 7 months ago) by fgsch
Branch: MAIN
Changes since 1.102: +40 -2 lines
Diff to previous 1.102 (colored)

change -w to apply to the connection as well. manpage bit from jmc@
nicm@ ok.

Revision 1.102 / (download) - annotate - [select for diffs], Sat Sep 17 14:10:05 2011 UTC (12 years, 8 months ago) by haesbaert
Branch: MAIN
Changes since 1.101: +58 -16 lines
Diff to previous 1.101 (colored)

Standarize the ToS option across nc/ping/traceroute so that they'll
accept the same values as pf.conf. It accepts decimal, hexadecimal and
the dscp/tos keywords. The ping option was ripped of in SMALL.

ok mcbride@ sthen@

Revision 1.101 / (download) - annotate - [select for diffs], Tue Jun 21 17:31:07 2011 UTC (12 years, 11 months ago) by mikeb
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.100: +2 -2 lines
Diff to previous 1.100 (colored)

Convert SO_RTABLE's protocol level to the SOL_SOCKET;  ok claudio

Revision 1.100 / (download) - annotate - [select for diffs], Sun Jan 9 22:16:46 2011 UTC (13 years, 4 months ago) by jeremy
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.99: +3 -3 lines
Diff to previous 1.99 (colored)

Minor tweaks to nc(1) man page and usage.

OK jmc@, nicm@, tedu@

Revision 1.99 / (download) - annotate - [select for diffs], Sat Jan 8 00:44:19 2011 UTC (13 years, 4 months ago) by jeremy
Branch: MAIN
Changes since 1.98: +67 -23 lines
Diff to previous 1.98 (colored)

Support unix domain sockets in nc(1) with -Uu.

Previously, using -U with -u was an error that was not documented
in the man page.  Now it will use a unix socket in datagram mode.

Bidirectional unix datagram communication requires a socket at
both ends, so in client mode (without -l), a temporary socket is
created so that responses from the server can be received.
If -s is specified with -U and -u, it specifies the location of
the temporary socket to create.

This was mostly written way back in 2007.  Since then, various
improvements implemented based on suggestions from guenther@,
tedu@, and nicm@. Man page help from nicm@ and jmc@.

Unix datagram support requires a small change to atomicio.c
in order to function correctly, this will be committed separately
shortly.

OK nicm@

Revision 1.98 / (download) - annotate - [select for diffs], Sat Jul 3 04:44:51 2010 UTC (13 years, 10 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.97: +14 -14 lines
Diff to previous 1.97 (colored)

Fix the naming of interfaces and variables for rdomains and rtables
and make it possible to bind sockets (including listening sockets!)
to rtables and not just rdomains.  This changes the name of the
system calls, socket option, and ioctl.  After building with this
you should remove the files /usr/share/man/cat2/[gs]etrdomain.0.

Since this removes the existing [gs]etrdomain() system calls, the
libc major is bumped.

Written by claudio@, criticized^Wcritiqued by me

Revision 1.97 / (download) - annotate - [select for diffs], Tue Apr 20 07:28:28 2010 UTC (14 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.96: +5 -5 lines
Diff to previous 1.96 (colored)

Bump the default buffer sizes to be larger than default MTUs, from Jan
Zeleny.

ok djm

Revision 1.96 / (download) - annotate - [select for diffs], Tue Apr 20 07:26:34 2010 UTC (14 years, 1 month ago) by nicm
Branch: MAIN
Changes since 1.95: +2 -3 lines
Diff to previous 1.95 (colored)

Allocate the port number properly (don't allocate space then ignore it),
and use %zu for size_t.

ok djm

Revision 1.95 / (download) - annotate - [select for diffs], Sat Feb 27 00:58:56 2010 UTC (14 years, 2 months ago) by nicm
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.94: +13 -13 lines
Diff to previous 1.94 (colored)

Fix the atelnet() function, which was wrong in several ways.

Pointed out by obsd at happyjack.org, fix based on a diff from kili@.

ok deraadt

Revision 1.94 / (download) - annotate - [select for diffs], Thu Oct 8 15:56:46 2009 UTC (14 years, 7 months ago) by mpf
Branch: MAIN
Changes since 1.93: +5 -3 lines
Diff to previous 1.93 (colored)

Do not write "Connection to ... succeeded" messages to stdout.
OK gilles, rainer, millert, deraadt.

Revision 1.93 / (download) - annotate - [select for diffs], Fri Jun 5 00:18:10 2009 UTC (14 years, 11 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6
Changes since 1.92: +24 -4 lines
Diff to previous 1.92 (colored)

The networking swissarmy knife needs to work on alternate domains as well.
Again -V can be used to specify the domain.

Revision 1.92 / (download) - annotate - [select for diffs], Fri Sep 19 13:24:41 2008 UTC (15 years, 8 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.91: +6 -5 lines
Diff to previous 1.91 (colored)

documentation tweaks; synchronize synopsis and usage.

written with help by jmc@

ok jmc@

Revision 1.91 / (download) - annotate - [select for diffs], Fri May 9 09:00:11 2008 UTC (16 years ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.90: +4 -2 lines
Diff to previous 1.90 (colored)

try SO_BINDANY for -s, but do not insist; ok bob, reyk

Revision 1.90 / (download) - annotate - [select for diffs], Tue May 6 05:47:39 2008 UTC (16 years ago) by djm
Branch: MAIN
Changes since 1.89: +30 -3 lines
Diff to previous 1.89 (colored)

allow setting of TCP send/receive buffer sizes; ok markus@

Revision 1.89 / (download) - annotate - [select for diffs], Tue Feb 20 14:11:17 2007 UTC (17 years, 3 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1
Changes since 1.88: +3 -3 lines
Diff to previous 1.88 (colored)

usage(): add -P and tweak -X; from Igor Sobrado

Revision 1.88 / (download) - annotate - [select for diffs], Fri Jun 2 03:46:38 2006 UTC (17 years, 11 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.87: +21 -23 lines
Diff to previous 1.87 (colored)

strtoul() -> strtonum().  Also change iflag to unsigned int, since
sleep takes an unsigned integer.

OK moritz@, jaredy@, and dhill@

Revision 1.87 / (download) - annotate - [select for diffs], Wed Feb 1 21:33:14 2006 UTC (18 years, 3 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.86: +1 -8 lines
Diff to previous 1.86 (colored)

remove obsolete code; from Ray Lai in PR 4998; ok tedu@ beck@

Revision 1.86 / (download) - annotate - [select for diffs], Wed Jan 25 23:21:37 2006 UTC (18 years, 3 months ago) by djm
Branch: MAIN
Changes since 1.85: +11 -5 lines
Diff to previous 1.85 (colored)

implement HTTP proxy authentication support, very useful in a ssh_config
ProxyCommand; ok beck@

Revision 1.85 / (download) - annotate - [select for diffs], Fri Jan 20 00:01:20 2006 UTC (18 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.84: +2 -1 lines
Diff to previous 1.84 (colored)

Explicitly include limits.h if we are going to use its contents.

Revision 1.84 / (download) - annotate - [select for diffs], Tue Oct 25 06:51:37 2005 UTC (18 years, 6 months ago) by dtucker
Branch: MAIN
Changes since 1.83: +3 -3 lines
Diff to previous 1.83 (colored)

Make set_common_sockopts() a void since it doesn't return anything anyway.
Makes netcat -Wall clean.  ok djm@

Revision 1.83 / (download) - annotate - [select for diffs], Tue Oct 25 03:51:06 2005 UTC (18 years, 6 months ago) by dtucker
Branch: MAIN
Changes since 1.82: +33 -3 lines
Diff to previous 1.82 (colored)

Add a -T option to nc to allow setting of IP type-of-service bits on
connections.  Man page corrections jmc@, code corrections and ok djm@

Revision 1.82 / (download) - annotate - [select for diffs], Sun Jul 24 09:33:56 2005 UTC (18 years, 9 months ago) by marius
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.81: +2 -2 lines
Diff to previous 1.81 (colored)

correct rval check for socket().  from alf schlichting.  ok markus@

Revision 1.81 / (download) - annotate - [select for diffs], Sat May 28 16:57:48 2005 UTC (18 years, 11 months ago) by marius
Branch: MAIN
Changes since 1.80: +29 -28 lines
Diff to previous 1.80 (colored)

set jumbo flag on the listener, too.  consolidate some common code.

ok mcbride@

Revision 1.80 / (download) - annotate - [select for diffs], Fri May 27 04:55:28 2005 UTC (18 years, 11 months ago) by mcbride
Branch: MAIN
Changes since 1.79: +22 -8 lines
Diff to previous 1.79 (colored)

Experimental support for opportunitic use of jumbograms where only some hosts
on the local network support them.

This adds a new socket option, SO_JUMBO, and a new route flag,
RTF_JUMBO. If _both_ the socket option is set and the route for the host
has RTF_JUMBO set, ip_output will fragment the packet to the largest
possible size for the link, ignoring the card's MTU.

The semantics of this feature will be evolving rapidly; talk to us
if you intend to use it.

ok deraadt@ marius@

Revision 1.79 / (download) - annotate - [select for diffs], Tue May 24 20:13:28 2005 UTC (18 years, 11 months ago) by avsm
Branch: MAIN
Changes since 1.78: +7 -10 lines
Diff to previous 1.78 (colored)

Switch atomicio to a simpler interface which returns size_t and uses
0 to signal errors.  should be no functional change in nc apart from
different error messages.

"groovy", said deraadt@

Revision 1.78 / (download) - annotate - [select for diffs], Sun Apr 10 19:43:34 2005 UTC (19 years, 1 month ago) by otto
Branch: MAIN
Changes since 1.77: +2 -1 lines
Diff to previous 1.77 (colored)

Initialize len before calling accept(2). from mpech@, ok millert@

Revision 1.77 / (download) - annotate - [select for diffs], Tue Feb 8 15:26:23 2005 UTC (19 years, 3 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.76: +5 -5 lines
Diff to previous 1.76 (colored)

Some extra strict warning cleanup. From Xin Li <delphij at FreeBSD
dot ORG> with a twist from myself. No binary change. ok djm@

Revision 1.76 / (download) - annotate - [select for diffs], Fri Dec 10 16:51:31 2004 UTC (19 years, 5 months ago) by hshoexer
Branch: MAIN
Changes since 1.75: +2 -2 lines
Diff to previous 1.75 (colored)

provide a valid sockaddr_storage structure to be used as second argument for
accept(2)

ok djm markus

Revision 1.75 / (download) - annotate - [select for diffs], Sun Oct 17 03:13:55 2004 UTC (19 years, 7 months ago) by djm
Branch: MAIN
Changes since 1.74: +12 -7 lines
Diff to previous 1.74 (colored)

http proxy CONNECT support; ok beck@

Revision 1.74 / (download) - annotate - [select for diffs], Wed Sep 15 18:44:45 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.73: +11 -15 lines
Diff to previous 1.73 (colored)

remove return error variables.. set but never used

Revision 1.73 / (download) - annotate - [select for diffs], Thu Jul 15 15:07:52 2004 UTC (19 years, 10 months ago) by markus
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.72: +18 -3 lines
Diff to previous 1.72 (colored)

add -D for sodebug; ok deraadt, jmc

Revision 1.72 / (download) - annotate - [select for diffs], Fri Mar 12 10:10:00 2004 UTC (20 years, 2 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.71: +4 -4 lines
Diff to previous 1.71 (colored)

add keeps to SYNOPSIS and sync usage();

Revision 1.71 / (download) - annotate - [select for diffs], Sun Mar 7 07:55:55 2004 UTC (20 years, 2 months ago) by mcbride
Branch: MAIN
Changes since 1.70: +4 -1 lines
Diff to previous 1.70 (colored)

Print error when connect() fails. ok markus@ deraadt@

Revision 1.70 / (download) - annotate - [select for diffs], Wed Mar 3 06:50:13 2004 UTC (20 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.69: +4 -4 lines
Diff to previous 1.69 (colored)

spaces, was reading code..

Revision 1.69 / (download) - annotate - [select for diffs], Wed Mar 3 06:45:54 2004 UTC (20 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.68: +3 -2 lines
Diff to previous 1.68 (colored)

add -d to usage too, from carson harding

Revision 1.68 / (download) - annotate - [select for diffs], Mon Mar 1 00:37:08 2004 UTC (20 years, 2 months ago) by tedu
Branch: MAIN
Changes since 1.67: +8 -4 lines
Diff to previous 1.67 (colored)

resolve pr3694.  add -d [etached] to ignore stdin.  ok henning@ mcbride@

Revision 1.67 / (download) - annotate - [select for diffs], Fri Feb 20 10:53:10 2004 UTC (20 years, 3 months ago) by jmc
Branch: MAIN
Changes since 1.66: +30 -30 lines
Diff to previous 1.66 (colored)

- sort options and SYNOPSIS
- better document which options do/don't work together
- add sections showing some possible uses of nc
- code (comment) typos
- sync usage() and help

suggestions/improvements from otto@
ok deraadt@

Revision 1.66 / (download) - annotate - [select for diffs], Sat Jan 31 21:09:15 2004 UTC (20 years, 3 months ago) by henning
Branch: MAIN
Changes since 1.65: +3 -3 lines
Diff to previous 1.65 (colored)

rename tcp sockopt TCP_SIGNATURE_ENABLE to TCP_MD5SIG
requested by theo
ok markus@ hshoexer@

Revision 1.65 / (download) - annotate - [select for diffs], Thu Jan 22 13:28:46 2004 UTC (20 years, 4 months ago) by markus
Branch: MAIN
Changes since 1.64: +21 -4 lines
Diff to previous 1.64 (colored)

-S enables tcp md5 signature option; ok deraadt@, mcbride@

Revision 1.64 / (download) - annotate - [select for diffs], Sun Oct 19 22:50:35 2003 UTC (20 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.63: +3 -2 lines
Diff to previous 1.63 (colored)

check alloca; pointed out by nimadeus@pandora.be

Revision 1.63 / (download) - annotate - [select for diffs], Mon Sep 22 21:39:40 2003 UTC (20 years, 8 months ago) by miod
Branch: MAIN
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (colored)

Off-by-ones, from aaron@

Revision 1.62 / (download) - annotate - [select for diffs], Fri Jul 25 21:35:16 2003 UTC (20 years, 9 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.61: +2 -5 lines
Diff to previous 1.61 (colored)

Kill dead code after errx(). From Andrey Matveev; ericj@ OK

Revision 1.61 / (download) - annotate - [select for diffs], Mon Jul 7 21:36:23 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.60: +1 -2 lines
Diff to previous 1.60 (colored)

protos

Revision 1.60 / (download) - annotate - [select for diffs], Mon Jul 7 14:12:18 2003 UTC (20 years, 10 months ago) by avsm
Branch: MAIN
Changes since 1.59: +17 -3 lines
Diff to previous 1.59 (colored)

in the unix domain socket case, give an ENAMETOOLONG error instead of
silently truncating the socket file
millert@ ok

Revision 1.59 / (download) - annotate - [select for diffs], Thu Jun 26 21:59:11 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.58: +11 -5 lines
Diff to previous 1.58 (colored)

more proto fixes

Revision 1.58 / (download) - annotate - [select for diffs], Tue Jun 10 22:20:48 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.57: +2 -2 lines
Diff to previous 1.57 (colored)

mostly ansi cleanup; pval ok

Revision 1.57 / (download) - annotate - [select for diffs], Mon Dec 30 18:00:18 2002 UTC (21 years, 4 months ago) by stevesk
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.56: +4 -4 lines
Diff to previous 1.56 (colored)

use err vs. errx and display function; from Owl.  ok fgsch@

Revision 1.56 / (download) - annotate - [select for diffs], Mon Dec 30 17:57:58 2002 UTC (21 years, 4 months ago) by stevesk
Branch: MAIN
Changes since 1.55: +4 -4 lines
Diff to previous 1.55 (colored)

include function in error; from Owl.  ok fgsch@

Revision 1.55 / (download) - annotate - [select for diffs], Sat Dec 28 10:24:09 2002 UTC (21 years, 4 months ago) by fgsch
Branch: MAIN
Changes since 1.54: +9 -4 lines
Diff to previous 1.54 (colored)

fix calloc's. also check for errors; fixes PR/3043.

Revision 1.54 / (download) - annotate - [select for diffs], Fri Dec 13 19:53:45 2002 UTC (21 years, 5 months ago) by aaron
Branch: MAIN
Changes since 1.53: +2 -2 lines
Diff to previous 1.53 (colored)

Recent modifications to netcat changed the behaviour to only exit when both
the read (network) and write (stdin) ends of the socket were both closed.
This is not how nc traditionally works. Instead, revert back to finishing up
when read() on the socket returns 0; deraadt@, vincent@ ok.

Revision 1.53 / (download) - annotate - [select for diffs], Wed Nov 13 22:26:15 2002 UTC (21 years, 6 months ago) by markus
Branch: MAIN
Changes since 1.52: +4 -3 lines
Diff to previous 1.52 (colored)

update usage; ok ericj@

Revision 1.52 / (download) - annotate - [select for diffs], Thu Jul 4 04:42:25 2002 UTC (21 years, 10 months ago) by vincent
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.51: +15 -11 lines
Diff to previous 1.51 (colored)

  correct handling of EOF on both tty input and network.  for example,
this allows stuff like nc -l 10101 < /dev/null to have nc exit
automatically when it gets EOF from the network.

 ok ericj@

Revision 1.51 / (download) - annotate - [select for diffs], Mon Jul 1 20:12:40 2002 UTC (21 years, 10 months ago) by vincent
Branch: MAIN
Changes since 1.50: +6 -1 lines
Diff to previous 1.50 (colored)

define SUN_LEN if it is not already for portability.

millert made the same suggestion, so i guess it's ok ;)

Revision 1.50 / (download) - annotate - [select for diffs], Mon Jul 1 15:40:40 2002 UTC (21 years, 10 months ago) by vincent
Branch: MAIN
Changes since 1.49: +18 -22 lines
Diff to previous 1.49 (colored)

use SUN_LEN to calculate AF_UNIX sockaddr's length.  + some style

ok ericj@

Revision 1.49 / (download) - annotate - [select for diffs], Thu May 30 09:37:38 2002 UTC (21 years, 11 months ago) by hugh
Branch: MAIN
Changes since 1.48: +9 -3 lines
Diff to previous 1.48 (colored)

Avoid spinning poll, and while we're at it more closely reproduce the
original netcat's timeout behaviour. Theo says go.

Revision 1.48 / (download) - annotate - [select for diffs], Wed May 29 09:23:25 2002 UTC (21 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored)

more snprintf

Revision 1.47 / (download) - annotate - [select for diffs], Sun Mar 10 20:26:09 2002 UTC (22 years, 2 months ago) by ericj
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.46: +2 -2 lines
Diff to previous 1.46 (colored)


check that we got the port before trying to listen
pr 2436; Alexander Yurchenko <grange@rt.mipt.ru>

Revision 1.46 / (download) - annotate - [select for diffs], Thu Feb 28 18:05:36 2002 UTC (22 years, 2 months ago) by markus
Branch: MAIN
Changes since 1.45: +11 -5 lines
Diff to previous 1.45 (colored)

add support for SOCKS4 with option -X socks_version, default is 5; ok ericj@

Revision 1.45 / (download) - annotate - [select for diffs], Tue Feb 19 22:42:04 2002 UTC (22 years, 3 months ago) by ericj
Branch: MAIN
Changes since 1.44: +5 -3 lines
Diff to previous 1.44 (colored)


-Wall cleanup.
from Kevin Steves <stevesk@pobox.com>

Revision 1.44 / (download) - annotate - [select for diffs], Sun Feb 17 19:42:31 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

Manual cleanup of remaining userland __P use (excluding packages maintained outside the tree)

Revision 1.43 / (download) - annotate - [select for diffs], Sun Feb 17 03:24:56 2002 UTC (22 years, 3 months ago) by ericj
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)


oops, add -U to usage

Revision 1.42 / (download) - annotate - [select for diffs], Sun Feb 17 03:03:06 2002 UTC (22 years, 3 months ago) by ericj
Branch: MAIN
Changes since 1.41: +103 -11 lines
Diff to previous 1.41 (colored)


add support for connecting too and listening on AF_UNIX sockets.
connect support from dave@arbor.net.. rest by me

Revision 1.41 / (download) - annotate - [select for diffs], Sun Feb 17 02:04:57 2002 UTC (22 years, 3 months ago) by ericj
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)


fix pr#2091. patch applied.
patch from Brian J. Kifiak <bk@rt.fm>
should be looked at closer..

Revision 1.40 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:50 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
Changes since 1.39: +9 -9 lines
Diff to previous 1.39 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Oct 28 19:52:04 2001 UTC (22 years, 6 months ago) by jakob
Branch: MAIN
Changes since 1.38: +1 -4 lines
Diff to previous 1.38 (colored)

remove bogus error-check, resolve pr#2147

Revision 1.38 / (download) - annotate - [select for diffs], Sun Oct 28 19:48:33 2001 UTC (22 years, 6 months ago) by jakob
Branch: MAIN
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

fix getaddrinfo error handling

Revision 1.37 / (download) - annotate - [select for diffs], Sun Sep 2 19:11:46 2001 UTC (22 years, 8 months ago) by jakob
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.36: +20 -34 lines
Diff to previous 1.36 (colored)

KNF + ansi

Revision 1.36 / (download) - annotate - [select for diffs], Sun Sep 2 19:07:17 2001 UTC (22 years, 8 months ago) by jakob
Branch: MAIN
Changes since 1.35: +4 -3 lines
Diff to previous 1.35 (colored)

update command summary

Revision 1.35 / (download) - annotate - [select for diffs], Sun Sep 2 19:04:23 2001 UTC (22 years, 8 months ago) by jakob
Branch: MAIN
Changes since 1.34: +1 -3 lines
Diff to previous 1.34 (colored)

remove unused variable

Revision 1.34 / (download) - annotate - [select for diffs], Sun Sep 2 18:45:41 2001 UTC (22 years, 8 months ago) by jakob
Branch: MAIN
Changes since 1.33: +49 -4 lines
Diff to previous 1.33 (colored)

add very basic proxy support using socks5 client code from niklas@.
ok ericj@.

Revision 1.33 / (download) - annotate - [select for diffs], Sat Aug 25 21:50:13 2001 UTC (22 years, 8 months ago) by ericj
Branch: MAIN
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)


use calloc

Revision 1.32 / (download) - annotate - [select for diffs], Thu Aug 2 21:00:14 2001 UTC (22 years, 9 months ago) by ericj
Branch: MAIN
Changes since 1.31: +3 -3 lines
Diff to previous 1.31 (colored)


fix diagnostic messages
from Dima Dorfman <dima@unixfreak.org>

Revision 1.31 / (download) - annotate - [select for diffs], Wed Jun 27 07:23:58 2001 UTC (22 years, 10 months ago) by ericj
Branch: MAIN
Changes since 1.30: +9 -8 lines
Diff to previous 1.30 (colored)


more magic stuff to define's

Revision 1.30 / (download) - annotate - [select for diffs], Wed Jun 27 03:14:28 2001 UTC (22 years, 10 months ago) by smart
Branch: MAIN
Changes since 1.29: +3 -3 lines
Diff to previous 1.29 (colored)

Spit out errno message instead of just exitting.  ericj@ ok.

Revision 1.29 / (download) - annotate - [select for diffs], Wed Jun 27 02:45:08 2001 UTC (22 years, 10 months ago) by smart
Branch: MAIN
Changes since 1.28: +23 -13 lines
Diff to previous 1.28 (colored)

Compile cleanly with -Wall

Revision 1.28 / (download) - annotate - [select for diffs], Tue Jun 26 23:25:22 2001 UTC (22 years, 10 months ago) by ericj
Branch: MAIN
Changes since 1.27: +2 -3 lines
Diff to previous 1.27 (colored)


remove some unused var's.
from jasoni@

Revision 1.27 / (download) - annotate - [select for diffs], Tue Jun 26 23:06:53 2001 UTC (22 years, 10 months ago) by ericj
Branch: MAIN
Changes since 1.26: +6 -5 lines
Diff to previous 1.26 (colored)


allow -k for udp and tcp

Revision 1.26 / (download) - annotate - [select for diffs], Tue Jun 26 21:57:35 2001 UTC (22 years, 10 months ago) by ericj
Branch: MAIN
Changes since 1.25: +19 -8 lines
Diff to previous 1.25 (colored)


be weary of atoi().
suggested by theo.. also do range checking on ports

Revision 1.25 / (download) - annotate - [select for diffs], Tue Jun 26 21:19:14 2001 UTC (22 years, 10 months ago) by ericj
Branch: MAIN
Changes since 1.24: +3 -2 lines
Diff to previous 1.24 (colored)


dont set the source address to 127.0.0.1 if a local port is specified
but no source address
reported by jakob@

Revision 1.24 / (download) - annotate - [select for diffs], Tue Jun 26 20:53:14 2001 UTC (22 years, 10 months ago) by ericj
Branch: MAIN
Changes since 1.23: +26 -33 lines
Diff to previous 1.23 (colored)


rewrite telnet negotiation

Revision 1.23 / (download) - annotate - [select for diffs], Tue Jun 26 19:31:10 2001 UTC (22 years, 10 months ago) by ericj
Branch: MAIN
Changes since 1.22: +6 -6 lines
Diff to previous 1.22 (colored)


rename variable, as not to conflict

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jun 26 07:38:05 2001 UTC (22 years, 10 months ago) by jasoni
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

type in usage: Surpress -> Suppress

Revision 1.21 / (download) - annotate - [select for diffs], Mon Jun 25 22:17:35 2001 UTC (22 years, 10 months ago) by ericj
Branch: MAIN
Changes since 1.20: +473 -1288 lines
Diff to previous 1.20 (colored)


Import completely re-written netcat w/ support for IPv6.
very little usage has changed, man page soon to come for it as well.
deraadt@ ok

Revision 1.20 / (download) - annotate - [select for diffs], Fri May 4 01:38:31 2001 UTC (23 years ago) by millert
Branch: MAIN
Changes since 1.19: +3 -4 lines
Diff to previous 1.19 (colored)

GAPING_SECURITY_HOLE was removed so there is no -e option.
Removed from man page and usage; closes PR 1808

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jan 16 20:20:48 2001 UTC (23 years, 4 months ago) by ericj
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.18: +7 -6 lines
Diff to previous 1.18 (colored)

fix verbosity levels. pointed out by J.D. Carlson <jd@noc7.uchsc.edu>

Revision 1.18 / (download) - annotate - [select for diffs], Fri Dec 1 02:25:58 2000 UTC (23 years, 5 months ago) by ericj
Branch: MAIN
Changes since 1.17: +6 -1 lines
Diff to previous 1.17 (colored)

-Wall cleanup

Revision 1.17 / (download) - annotate - [select for diffs], Tue Sep 26 18:53:13 2000 UTC (23 years, 7 months ago) by ericj
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.16: +24 -40 lines
Diff to previous 1.16 (colored)


more cleanup and have nlog() deal with errno now as well.

Revision 1.16 / (download) - annotate - [select for diffs], Tue Sep 26 17:46:40 2000 UTC (23 years, 7 months ago) by ericj
Branch: MAIN
Changes since 1.15: +22 -31 lines
Diff to previous 1.15 (colored)


no need to reset h_errno
do the cmdline correctly, deal with \n and \t
fix up nlog()
use arc4random instead of srandom()/random()

Revision 1.15 / (download) - annotate - [select for diffs], Tue Sep 26 05:19:37 2000 UTC (23 years, 7 months ago) by ericj
Branch: MAIN
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

fix minor typo

Revision 1.14 / (download) - annotate - [select for diffs], Tue Sep 26 05:16:00 2000 UTC (23 years, 7 months ago) by ericj
Branch: MAIN
Changes since 1.13: +22 -22 lines
Diff to previous 1.13 (colored)

no need to use goto..

Revision 1.13 / (download) - annotate - [select for diffs], Tue Sep 26 05:03:31 2000 UTC (23 years, 7 months ago) by ericj
Branch: MAIN
Changes since 1.12: +79 -62 lines
Diff to previous 1.12 (colored)


Implement a function for errors
it pays attention to h_error so we now have no need to handle
this ourselves.

Revision 1.12 / (download) - annotate - [select for diffs], Tue Sep 26 02:51:22 2000 UTC (23 years, 7 months ago) by ericj
Branch: MAIN
Changes since 1.11: +11 -10 lines
Diff to previous 1.11 (colored)

some warnings should only be shown with -v

Revision 1.11 / (download) - annotate - [select for diffs], Tue Sep 26 01:15:49 2000 UTC (23 years, 7 months ago) by ericj
Branch: MAIN
Changes since 1.10: +572 -831 lines
Diff to previous 1.10 (colored)


Alot of cleanups to netcat
use errx/warn instead of homegrown functions
indent properly to make the code readable
get rid of generic.h as its not used
dont declare optarg
register is depreciated
get rid of undocumented options -a and -e
throw out IP_OPTIONS code for now, its not on by default
and doesnt work properly
make usage more like other bsd commands

Revision 1.10 / (download) - annotate - [select for diffs], Tue Jul 25 19:25:40 2000 UTC (23 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.9: +2 -1 lines
Diff to previous 1.9 (colored)

a quick fix, and then i run away screaming in terror

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jul 7 15:34:02 2000 UTC (23 years, 10 months ago) by art
Branch: MAIN
Changes since 1.8: +8 -2 lines
Diff to previous 1.8 (colored)

If the timeout is not set, don't send a zeroed timeout to select.
This solves the problem with nc hogging all cpu.

Revision 1.8 / (download) - annotate - [select for diffs], Thu Jul 6 06:24:50 2000 UTC (23 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.7: +1 -1 lines
Diff to previous 1.7 (colored)

do not assume h_errs[] is clean, use %s

Revision 1.7 / (download) - annotate - [select for diffs], Mon Jan 31 19:31:42 2000 UTC (24 years, 3 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.6: +195 -262 lines
Diff to previous 1.6 (colored)

massive indent pass

Revision 1.6 / (download) - annotate - [select for diffs], Mon Jan 24 19:13:33 2000 UTC (24 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.5: +1186 -1137 lines
Diff to previous 1.5 (colored)

first cut at indent.. more to come

Revision 1.5 / (download) - annotate - [select for diffs], Mon Aug 16 20:13:54 1999 UTC (24 years, 9 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.4: +3 -0 lines
Diff to previous 1.4 (colored)

include unistd.h

Revision 1.4 / (download) - annotate - [select for diffs], Sat Jun 5 19:33:49 1999 UTC (24 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +3 -5 lines
Diff to previous 1.3 (colored)

buf oflow; and use inet_aton()

Revision 1.3 / (download) - annotate - [select for diffs], Mon Apr 7 19:55:26 1997 UTC (27 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2, OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.2: +12 -10 lines
Diff to previous 1.2 (colored)

paranoid about MAXHOSTNAMELEN

Revision 1.2 / (download) - annotate - [select for diffs], Wed Jan 15 23:43:43 1997 UTC (27 years, 4 months ago) by millert
Branch: MAIN
Changes since 1.1: +1 -1 lines
Diff to previous 1.1 (colored)

getopt(3) returns -1 when out of args, not EOF, whee!

Revision 1.1 / (download) - annotate - [select for diffs], Thu Sep 5 08:55:34 1996 UTC (27 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0

nc is *hobbit*'s netcat; let the sysadm have the same tools the crackers
have, so that he may learn what the network is about and protect it better.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.