12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- Index: netcat-openbsd-1.89/netcat.c
- ===================================================================
- --- netcat-openbsd-1.89.orig/netcat.c 2007-02-20 09:11:17.000000000 -0500
- +++ netcat-openbsd-1.89/netcat.c 2008-01-21 18:48:23.000000000 -0500
- @@ -55,6 +55,8 @@
- #include <limits.h>
- #include "atomicio.h"
-
- +#include <glib.h>
- +
- #ifndef SUN_LEN
- #define SUN_LEN(su) \
- (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))
- @@ -414,7 +416,7 @@
- memset(&sun, 0, sizeof(struct sockaddr_un));
- sun.sun_family = AF_UNIX;
-
- - if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
- + if (g_strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
- sizeof(sun.sun_path)) {
- close(s);
- errno = ENAMETOOLONG;
- @@ -445,7 +447,7 @@
- memset(&sun, 0, sizeof(struct sockaddr_un));
- sun.sun_family = AF_UNIX;
-
- - if (strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
- + if (g_strlcpy(sun.sun_path, path, sizeof(sun.sun_path)) >=
- sizeof(sun.sun_path)) {
- close(s);
- errno = ENAMETOOLONG;
- @@ -549,11 +551,11 @@
- if ((s = socket(res0->ai_family, res0->ai_socktype,
- res0->ai_protocol)) < 0)
- continue;
- -
- + #ifdef SO_REUSEPORT
- ret = setsockopt(s, SOL_SOCKET, SO_REUSEPORT, &x, sizeof(x));
- if (ret == -1)
- err(1, NULL);
- -
- + #endif
- set_common_sockopts(s);
-
- if (bind(s, (struct sockaddr *)res0->ai_addr,
- @@ -719,7 +721,8 @@
- char *c;
-
- for (x = 0; x <= (hi - lo); x++) {
- - y = (arc4random() & 0xFFFF) % (hi - lo);
- + /* use random instead of arc4random */
- + y = (random() & 0xFFFF) % (hi - lo);
- c = portlist[x];
- portlist[x] = portlist[y];
- portlist[y] = c;
- @@ -761,21 +764,25 @@
- {
- int x = 1;
-
- +#ifdef TCP_MD5SIG
- if (Sflag) {
- if (setsockopt(s, IPPROTO_TCP, TCP_MD5SIG,
- &x, sizeof(x)) == -1)
- err(1, NULL);
- }
- +#endif
- if (Dflag) {
- if (setsockopt(s, SOL_SOCKET, SO_DEBUG,
- &x, sizeof(x)) == -1)
- err(1, NULL);
- }
- +#ifdef SO_JUMBO
- if (jflag) {
- if (setsockopt(s, SOL_SOCKET, SO_JUMBO,
- &x, sizeof(x)) == -1)
- err(1, NULL);
- }
- +#endif
- if (Tflag != -1) {
- if (setsockopt(s, IPPROTO_IP, IP_TOS,
- &Tflag, sizeof(Tflag)) == -1)
- @@ -816,9 +823,11 @@
- \t-n Suppress name/port resolutions\n\
- \t-P proxyuser\tUsername for proxy authentication\n\
- \t-p port\t Specify local port for remote connects\n\
- - \t-r Randomize remote ports\n\
- - \t-S Enable the TCP MD5 signature option\n\
- - \t-s addr\t Local source address\n\
- + \t-r Randomize remote ports\n "
- +#ifdef TCP_MD5SIG
- +" \t-S Enable the TCP MD5 signature option\n"
- +#endif
- +" \t-s addr\t Local source address\n\
- \t-T ToS\t Set IP Type of Service\n\
- \t-t Answer TELNET negotiation\n\
- \t-U Use UNIX domain socket\n\
|