aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2018-12-03 10:11:35 +0100
committerToni Uhlig <matzeton@googlemail.com>2018-12-03 10:11:35 +0100
commit476d6b28848f952c09a094e2227f20d69d4f1482 (patch)
treef1337e320359e40998d390fed2f0e938d17aae96 /src
parentb0e7eea08b6289075e3518e78fe451cb78c19c5e (diff)
parentabea0f617f6339f3eeedcc849ef690289d5bad80 (diff)
Merge branch 'master' into release
Diffstat (limited to 'src')
-rw-r--r--src/options.c12
-rw-r--r--src/ptunnel.h2
-rw-r--r--src/utils.c1
3 files changed, 15 insertions, 0 deletions
diff --git a/src/options.c b/src/options.c
index b52c1ac..beecd39 100644
--- a/src/options.c
+++ b/src/options.c
@@ -385,15 +385,21 @@ int parse_options(int argc, char **argv) {
switch (c) {
case 'm':
+ if (!optarg)
+ break;
opts.magic = strtoul(optarg, NULL, 16);
break;
case 'p':
+ if (!optarg)
+ break;
opts.mode = kMode_forward;
if (opts.given_proxy_hostname)
free(opts.given_proxy_hostname);
opts.given_proxy_hostname = strdup(optarg);
break;
case 'l':
+ if (!optarg)
+ break;
opts.tcp_listen_port = strtoul(optarg, NULL, 10);
break;
case 'r':
@@ -410,11 +416,15 @@ int parse_options(int argc, char **argv) {
opts.given_dst_port = strtoul(optarg, NULL, 10);
break;
case 'c':
+ if (!optarg)
+ break;
opts.max_tunnels = strtoul(optarg, NULL,10);
if (opts.max_tunnels > kMax_tunnels)
opts.max_tunnels = kMax_tunnels;
break;
case 'v':
+ if (!optarg)
+ break;
opts.log_level = strtol(optarg, NULL, 10);
break;
case 'L':
@@ -442,6 +452,8 @@ int parse_options(int argc, char **argv) {
opts.print_stats = !opts.print_stats;
break;
case 'P':
+ if (!optarg)
+ break;
if (opts.password)
free(opts.password);
opts.password = strdup(optarg);
diff --git a/src/ptunnel.h b/src/ptunnel.h
index 966f5ba..7566f92 100644
--- a/src/ptunnel.h
+++ b/src/ptunnel.h
@@ -45,7 +45,9 @@
#define PING_TUNNEL_H 1
#ifndef WIN32
+#ifdef HAVE_SYS_UNISTD_H
#include <sys/unistd.h>
+#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
diff --git a/src/utils.c b/src/utils.c
index 2cbebc4..66ed4c0 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -51,6 +51,7 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
+#include <netinet/in.h>
#else
#include <ws2tcpip.h>
#endif