You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
--- a/netcat.c
|
|
|
|
+++ b/netcat.c
|
|
|
|
@@ -43,11 +43,13 @@
|
|
|
|
#include <arpa/telnet.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
|
|
|
+#ifndef IPTOS_LOWCOST
|
|
|
|
+# define IPTOS_LOWCOST 0x02
|
|
|
|
+#endif
|
|
|
|
#ifndef IPTOS_LOWDELAY
|
|
|
|
# define IPTOS_LOWDELAY 0x10
|
|
|
|
# define IPTOS_THROUGHPUT 0x08
|
|
|
|
# define IPTOS_RELIABILITY 0x04
|
|
|
|
-# define IPTOS_LOWCOST 0x02
|
|
|
|
# define IPTOS_MINCOST IPTOS_LOWCOST
|
|
|
|
#endif /* IPTOS_LOWDELAY */
|
|
|
|
|
|
|
|
@@ -96,8 +98,9 @@
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <limits.h>
|
|
|
|
-#include <bsd/stdlib.h>
|
|
|
|
-#include <bsd/string.h>
|
|
|
|
+#include <stdlib.h>
|
|
|
|
+#include <string.h>
|
|
|
|
+#include <ctype.h>
|
|
|
|
#include "atomicio.h"
|
|
|
|
|
|
|
|
#ifndef SUN_LEN
|
|
|
|
@@ -169,6 +172,43 @@
|
|
|
|
socklen_t salen, int ctimeout);
|
|
|
|
static void quit();
|
|
|
|
|
|
|
|
+static char* strtonumerrs[] = {
|
|
|
|
+ "too large",
|
|
|
|
+ "too small",
|
|
|
|
+ "invalid"
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static long long
|
|
|
|
+strtonum(
|
|
|
|
+ const char *nptr,
|
|
|
|
+ long long minval,
|
|
|
|
+ long long maxval,
|
|
|
|
+ const char **errstr)
|
|
|
|
+{
|
|
|
|
+ long long val;
|
|
|
|
+
|
|
|
|
+ while (*nptr != '\0' && isspace(*nptr))
|
|
|
|
+ nptr++;
|
|
|
|
+ if (*nptr == '\0') {
|
|
|
|
+ if (errstr != NULL)
|
|
|
|
+ *errstr = strtonumerrs[2];
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ val = atoll(nptr);
|
|
|
|
+ if (val < minval) {
|
|
|
|
+ if (errstr != NULL)
|
|
|
|
+ *errstr = strtonumerrs[1];
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ if (val > maxval) {
|
|
|
|
+ if (errstr != NULL)
|
|
|
|
+ *errstr = strtonumerrs[0];
|
|
|
|
+ return 0;
|
|
|
|
+ }
|
|
|
|
+ *errstr = NULL;
|
|
|
|
+ return val;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
--- a/socks.c
|
|
|
|
+++ b/socks.c
|
|
|
|
@@ -38,7 +38,7 @@
|
|
|
|
#include <string.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <resolv.h>
|
|
|
|
-#include <bsd/readpassphrase.h>
|
|
|
|
+#include <readpassphrase.h>
|
|
|
|
#include "atomicio.h"
|
|
|
|
|
|
|
|
#define SOCKS_PORT "1080"
|