Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <1404735142-31420-2-git-send-email-arne@rfc2549.org>
URL: http://article.gmane.org/gmane.network.openvpn.devel/8840
Signed-off-by: Gert Doering <gert@greenie.muc.de>
... | ... |
@@ -128,20 +128,6 @@ AC_ARG_ENABLE( |
128 | 128 |
) |
129 | 129 |
|
130 | 130 |
AC_ARG_ENABLE( |
131 |
- [socks], |
|
132 |
- [AS_HELP_STRING([--disable-socks], [disable Socks support @<:@default=yes@:>@])], |
|
133 |
- , |
|
134 |
- [enable_socks="yes"] |
|
135 |
-) |
|
136 |
- |
|
137 |
-AC_ARG_ENABLE( |
|
138 |
- [http-proxy], |
|
139 |
- [AS_HELP_STRING([--disable-http-proxy], [disable HTTP proxy support @<:@default=yes@:>@])], |
|
140 |
- , |
|
141 |
- [enable_http_proxy="yes"] |
|
142 |
-) |
|
143 |
- |
|
144 |
-AC_ARG_ENABLE( |
|
145 | 131 |
[fragment], |
146 | 132 |
[AS_HELP_STRING([--disable-fragment], [disable internal fragmentation support (--fragment) @<:@default=yes@:>@])], |
147 | 133 |
, |
... | ... |
@@ -1039,8 +1025,6 @@ test "${ac_cv_header_sys_uio_h}" = "yes" && AC_DEFINE([HAVE_IOVEC], [1], [struct |
1039 | 1039 |
test "${enable_multi}" = "yes" && AC_DEFINE([ENABLE_CLIENT_SERVER], [1], [Enable client/server capability]) |
1040 | 1040 |
test "${enable_server}" = "no" && AC_DEFINE([ENABLE_CLIENT_ONLY], [1], [Enable client capability only]) |
1041 | 1041 |
test "${enable_management}" = "yes" && AC_DEFINE([ENABLE_MANAGEMENT], [1], [Enable management server capability]) |
1042 |
-test "${enable_socks}" = "yes" && AC_DEFINE([ENABLE_SOCKS], [1], [Enable Socks proxy support]) |
|
1043 |
-test "${enable_http_proxy}" = "yes" && AC_DEFINE([ENABLE_HTTP_PROXY], [1], [Enable HTTP proxy support]) |
|
1044 | 1042 |
test "${enable_multihome}" = "yes" && AC_DEFINE([ENABLE_MULTIHOME], [1], [Enable multi-homed UDP server capability]) |
1045 | 1043 |
test "${enable_debug}" = "yes" && AC_DEFINE([ENABLE_DEBUG], [1], [Enable debugging support]) |
1046 | 1044 |
test "${enable_small}" = "yes" && AC_DEFINE([ENABLE_SMALL], [1], [Enable smaller executable size]) |
... | ... |
@@ -39,8 +39,6 @@ |
39 | 39 |
|
40 | 40 |
#include "syshead.h" |
41 | 41 |
|
42 |
-#if defined(ENABLE_HTTP_PROXY) || defined(ENABLE_PKCS11) || defined(ENABLE_CLIENT_CR) || defined(MANAGMENT_EXTERNAL_KEY) |
|
43 |
- |
|
44 | 42 |
#include "base64.h" |
45 | 43 |
|
46 | 44 |
#include "memdbg.h" |
... | ... |
@@ -163,7 +161,3 @@ openvpn_base64_decode(const char *str, void *data, int size) |
163 | 163 |
} |
164 | 164 |
return q - (unsigned char *) data; |
165 | 165 |
} |
166 |
- |
|
167 |
-#else |
|
168 |
-static void dummy(void) {} |
|
169 |
-#endif /* ENABLE_HTTP_PROXY, ENABLE_PKCS11, ENABLE_CLIENT_CR */ |
... | ... |
@@ -34,11 +34,7 @@ |
34 | 34 |
#ifndef _BASE64_H_ |
35 | 35 |
#define _BASE64_H_ |
36 | 36 |
|
37 |
-#if defined(ENABLE_HTTP_PROXY) || defined(ENABLE_PKCS11) || defined(ENABLE_CLIENT_CR) || defined(MANAGMENT_EXTERNAL_KEY) |
|
38 |
- |
|
39 | 37 |
int openvpn_base64_encode(const void *data, int size, char **str); |
40 | 38 |
int openvpn_base64_decode(const char *str, void *data, int size); |
41 | 39 |
|
42 | 40 |
#endif |
43 |
- |
|
44 |
-#endif |
... | ... |
@@ -611,8 +611,6 @@ check_timeout_random_component (struct context *c) |
611 | 611 |
tv_add (&c->c2.timeval, &c->c2.timeout_random_component); |
612 | 612 |
} |
613 | 613 |
|
614 |
-#ifdef ENABLE_SOCKS |
|
615 |
- |
|
616 | 614 |
/* |
617 | 615 |
* Handle addition and removal of the 10-byte Socks5 header |
618 | 616 |
* in UDP packets. |
... | ... |
@@ -650,7 +648,6 @@ link_socket_write_post_size_adjust (int *size, |
650 | 650 |
*size = 0; |
651 | 651 |
} |
652 | 652 |
} |
653 |
-#endif |
|
654 | 653 |
|
655 | 654 |
/* |
656 | 655 |
* Output: c->c2.buf |
... | ... |
@@ -719,10 +716,8 @@ read_incoming_link (struct context *c) |
719 | 719 |
/* check recvfrom status */ |
720 | 720 |
check_status (status, "read", c->c2.link_socket, NULL); |
721 | 721 |
|
722 |
-#ifdef ENABLE_SOCKS |
|
723 | 722 |
/* Remove socks header if applicable */ |
724 | 723 |
socks_postprocess_incoming_link (c); |
725 |
-#endif |
|
726 | 724 |
|
727 | 725 |
perf_pop (); |
728 | 726 |
} |
... | ... |
@@ -1131,23 +1126,18 @@ process_outgoing_link (struct context *c) |
1131 | 1131 |
/* Packet send complexified by possible Socks5 usage */ |
1132 | 1132 |
{ |
1133 | 1133 |
struct link_socket_actual *to_addr = c->c2.to_link_addr; |
1134 |
-#ifdef ENABLE_SOCKS |
|
1135 | 1134 |
int size_delta = 0; |
1136 |
-#endif |
|
1137 | 1135 |
|
1138 |
-#ifdef ENABLE_SOCKS |
|
1139 | 1136 |
/* If Socks5 over UDP, prepend header */ |
1140 | 1137 |
socks_preprocess_outgoing_link (c, &to_addr, &size_delta); |
1141 |
-#endif |
|
1138 |
+ |
|
1142 | 1139 |
/* Send packet */ |
1143 | 1140 |
size = link_socket_write (c->c2.link_socket, |
1144 | 1141 |
&c->c2.to_link, |
1145 | 1142 |
to_addr); |
1146 | 1143 |
|
1147 |
-#ifdef ENABLE_SOCKS |
|
1148 | 1144 |
/* Undo effect of prepend */ |
1149 | 1145 |
link_socket_write_post_size_adjust (&size, size_delta, &c->c2.to_link); |
1150 |
-#endif |
|
1151 | 1146 |
} |
1152 | 1147 |
|
1153 | 1148 |
if (size > 0) |
... | ... |
@@ -128,9 +128,6 @@ management_callback_proxy_cmd (void *arg, const char **p) |
128 | 128 |
{ |
129 | 129 |
if (streq (p[1], "HTTP")) |
130 | 130 |
{ |
131 |
-#ifndef ENABLE_HTTP_PROXY |
|
132 |
- msg (M_WARN, "HTTP proxy support is not available"); |
|
133 |
-#else |
|
134 | 131 |
struct http_proxy_options *ho; |
135 | 132 |
if (ce->proto != PROTO_TCP && ce->proto != PROTO_TCP_CLIENT ) |
136 | 133 |
{ |
... | ... |
@@ -143,17 +140,12 @@ management_callback_proxy_cmd (void *arg, const char **p) |
143 | 143 |
ho->retry = true; |
144 | 144 |
ho->auth_retry = (p[4] && streq (p[4], "nct") ? PAR_NCT : PAR_ALL); |
145 | 145 |
ret = true; |
146 |
-#endif |
|
147 | 146 |
} |
148 | 147 |
else if (streq (p[1], "SOCKS")) |
149 | 148 |
{ |
150 |
-#ifndef ENABLE_SOCKS |
|
151 |
- msg (M_WARN, "SOCKS proxy support is not available"); |
|
152 |
-#else |
|
153 | 149 |
ce->socks_proxy_server = string_alloc (p[2], gc); |
154 | 150 |
ce->socks_proxy_port = p[3]; |
155 | 151 |
ret = true; |
156 |
-#endif |
|
157 | 152 |
} |
158 | 153 |
} |
159 | 154 |
else |
... | ... |
@@ -441,41 +433,30 @@ init_query_passwords (struct context *c) |
441 | 441 |
* Initialize/Uninitialize HTTP or SOCKS proxy |
442 | 442 |
*/ |
443 | 443 |
|
444 |
-#ifdef GENERAL_PROXY_SUPPORT |
|
445 |
- |
|
446 | 444 |
static void |
447 | 445 |
uninit_proxy_dowork (struct context *c) |
448 | 446 |
{ |
449 |
-#ifdef ENABLE_HTTP_PROXY |
|
450 | 447 |
if (c->c1.http_proxy_owned && c->c1.http_proxy) |
451 | 448 |
{ |
452 | 449 |
http_proxy_close (c->c1.http_proxy); |
453 | 450 |
c->c1.http_proxy = NULL; |
454 | 451 |
c->c1.http_proxy_owned = false; |
455 | 452 |
} |
456 |
-#endif |
|
457 |
-#ifdef ENABLE_SOCKS |
|
458 | 453 |
if (c->c1.socks_proxy_owned && c->c1.socks_proxy) |
459 | 454 |
{ |
460 | 455 |
socks_proxy_close (c->c1.socks_proxy); |
461 | 456 |
c->c1.socks_proxy = NULL; |
462 | 457 |
c->c1.socks_proxy_owned = false; |
463 | 458 |
} |
464 |
-#endif |
|
465 | 459 |
} |
466 | 460 |
|
467 | 461 |
static void |
468 | 462 |
init_proxy_dowork (struct context *c) |
469 | 463 |
{ |
470 |
-#ifdef ENABLE_HTTP_PROXY |
|
471 | 464 |
bool did_http = false; |
472 |
-#else |
|
473 |
- const bool did_http = false; |
|
474 |
-#endif |
|
475 | 465 |
|
476 | 466 |
uninit_proxy_dowork (c); |
477 | 467 |
|
478 |
-#ifdef ENABLE_HTTP_PROXY |
|
479 | 468 |
if (c->options.ce.http_proxy_options) |
480 | 469 |
{ |
481 | 470 |
/* Possible HTTP proxy user/pass input */ |
... | ... |
@@ -486,10 +467,8 @@ init_proxy_dowork (struct context *c) |
486 | 486 |
c->c1.http_proxy_owned = true; |
487 | 487 |
} |
488 | 488 |
} |
489 |
-#endif |
|
490 | 489 |
|
491 |
-#ifdef ENABLE_SOCKS |
|
492 |
- if (!did_http && c->options.ce.socks_proxy_server) |
|
490 |
+ if (!did_http && c->options.ce.socks_proxy_server) |
|
493 | 491 |
{ |
494 | 492 |
c->c1.socks_proxy = socks_proxy_new (c->options.ce.socks_proxy_server, |
495 | 493 |
c->options.ce.socks_proxy_port, |
... | ... |
@@ -500,7 +479,6 @@ init_proxy_dowork (struct context *c) |
500 | 500 |
c->c1.socks_proxy_owned = true; |
501 | 501 |
} |
502 | 502 |
} |
503 |
-#endif |
|
504 | 503 |
} |
505 | 504 |
|
506 | 505 |
static void |
... | ... |
@@ -515,20 +493,6 @@ uninit_proxy (struct context *c) |
515 | 515 |
uninit_proxy_dowork (c); |
516 | 516 |
} |
517 | 517 |
|
518 |
-#else |
|
519 |
- |
|
520 |
-static inline void |
|
521 |
-init_proxy (struct context *c, const int scope) |
|
522 |
-{ |
|
523 |
-} |
|
524 |
- |
|
525 |
-static inline void |
|
526 |
-uninit_proxy (struct context *c) |
|
527 |
-{ |
|
528 |
-} |
|
529 |
- |
|
530 |
-#endif |
|
531 |
- |
|
532 | 518 |
void |
533 | 519 |
context_init_1 (struct context *c) |
534 | 520 |
{ |
... | ... |
@@ -2412,13 +2376,11 @@ do_init_frame (struct context *c) |
2412 | 2412 |
} |
2413 | 2413 |
#endif /* USE_COMP */ |
2414 | 2414 |
|
2415 |
-#ifdef ENABLE_SOCKS |
|
2416 | 2415 |
/* |
2417 | 2416 |
* Adjust frame size for UDP Socks support. |
2418 | 2417 |
*/ |
2419 | 2418 |
if (c->options.ce.socks_proxy_server) |
2420 | 2419 |
socks_adjust_frame_parameters (&c->c2.frame, c->options.ce.proto); |
2421 |
-#endif |
|
2422 | 2420 |
|
2423 | 2421 |
/* |
2424 | 2422 |
* Adjust frame size based on the --tun-mtu-extra parameter. |
... | ... |
@@ -2690,12 +2652,8 @@ do_init_socket_1 (struct context *c, const int mode) |
2690 | 2690 |
c->options.ce.bind_ipv6_only, |
2691 | 2691 |
mode, |
2692 | 2692 |
c->c2.accept_from, |
2693 |
-#ifdef ENABLE_HTTP_PROXY |
|
2694 | 2693 |
c->c1.http_proxy, |
2695 |
-#endif |
|
2696 |
-#ifdef ENABLE_SOCKS |
|
2697 | 2694 |
c->c1.socks_proxy, |
2698 |
-#endif |
|
2699 | 2695 |
#ifdef ENABLE_DEBUG |
2700 | 2696 |
c->options.gremlin, |
2701 | 2697 |
#endif |
... | ... |
@@ -188,17 +188,13 @@ struct context_1 |
188 | 188 |
struct status_output *status_output; |
189 | 189 |
bool status_output_owned; |
190 | 190 |
|
191 |
-#ifdef ENABLE_HTTP_PROXY |
|
192 | 191 |
/* HTTP proxy object */ |
193 | 192 |
struct http_proxy_info *http_proxy; |
194 | 193 |
bool http_proxy_owned; |
195 |
-#endif |
|
196 | 194 |
|
197 |
-#ifdef ENABLE_SOCKS |
|
198 | 195 |
/* SOCKS proxy object */ |
199 | 196 |
struct socks_proxy_info *socks_proxy; |
200 | 197 |
bool socks_proxy_owned; |
201 |
-#endif |
|
202 | 198 |
|
203 | 199 |
#if P2MP |
204 | 200 |
|
... | ... |
@@ -140,7 +140,6 @@ static const char usage_message[] = |
140 | 140 |
" between connection retries (default=%d).\n" |
141 | 141 |
"--connect-timeout n : For --proto tcp-client, connection timeout (in seconds).\n" |
142 | 142 |
"--connect-retry-max n : Maximum connection attempt retries, default infinite.\n" |
143 |
-#ifdef ENABLE_HTTP_PROXY |
|
144 | 143 |
"--http-proxy s p [up] [auth] : Connect to remote host\n" |
145 | 144 |
" through an HTTP proxy at address s and port p.\n" |
146 | 145 |
" If proxy authentication is required,\n" |
... | ... |
@@ -156,15 +155,12 @@ static const char usage_message[] = |
156 | 156 |
" Repeat to set multiple options.\n" |
157 | 157 |
" VERSION version (default=1.0)\n" |
158 | 158 |
" AGENT user-agent\n" |
159 |
-#endif |
|
160 |
-#ifdef ENABLE_SOCKS |
|
161 | 159 |
"--socks-proxy s [p] [up] : Connect to remote host through a Socks5 proxy at\n" |
162 | 160 |
" address s and port p (default port = 1080).\n" |
163 | 161 |
" If proxy authentication is required,\n" |
164 | 162 |
" up is a file containing username/password on 2 lines, or\n" |
165 | 163 |
" 'stdin' to prompt for console.\n" |
166 | 164 |
"--socks-proxy-retry : Retry indefinitely on Socks proxy errors.\n" |
167 |
-#endif |
|
168 | 165 |
"--resolv-retry n: If hostname resolve fails for --remote, retry\n" |
169 | 166 |
" resolve for n seconds before failing (disabled by default).\n" |
170 | 167 |
" Set n=\"infinite\" to retry indefinitely.\n" |
... | ... |
@@ -177,12 +173,8 @@ static const char usage_message[] = |
177 | 177 |
"--rport port : TCP/UDP port # for remote (default=%s).\n" |
178 | 178 |
"--bind : Bind to local address and port. (This is the default unless\n" |
179 | 179 |
" --proto tcp-client" |
180 |
-#ifdef ENABLE_HTTP_PROXY |
|
181 | 180 |
" or --http-proxy" |
182 |
-#endif |
|
183 |
-#ifdef ENABLE_SOCKS |
|
184 | 181 |
" or --socks-proxy" |
185 |
-#endif |
|
186 | 182 |
" is used).\n" |
187 | 183 |
"--nobind : Do not bind to local address and port.\n" |
188 | 184 |
"--dev tunX|tapX : tun/tap device (X can be omitted for dynamic device.\n" |
... | ... |
@@ -912,20 +904,16 @@ setenv_connection_entry (struct env_set *es, |
912 | 912 |
setenv_str_i (es, "remote", e->remote, i); |
913 | 913 |
setenv_str_i (es, "remote_port", e->remote_port, i); |
914 | 914 |
|
915 |
-#ifdef ENABLE_HTTP_PROXY |
|
916 | 915 |
if (e->http_proxy_options) |
917 | 916 |
{ |
918 | 917 |
setenv_str_i (es, "http_proxy_server", e->http_proxy_options->server, i); |
919 | 918 |
setenv_str_i (es, "http_proxy_port", e->http_proxy_options->port, i); |
920 | 919 |
} |
921 |
-#endif |
|
922 |
-#ifdef ENABLE_SOCKS |
|
923 | 920 |
if (e->socks_proxy_server) |
924 | 921 |
{ |
925 | 922 |
setenv_str_i (es, "socks_proxy_server", e->socks_proxy_server, i); |
926 | 923 |
setenv_str_i (es, "socks_proxy_port", e->socks_proxy_port, i); |
927 | 924 |
} |
928 |
-#endif |
|
929 | 925 |
} |
930 | 926 |
|
931 | 927 |
void |
... | ... |
@@ -1290,7 +1278,7 @@ option_iroute_ipv6 (struct options *o, |
1290 | 1290 |
#endif /* P2MP_SERVER */ |
1291 | 1291 |
#endif /* P2MP */ |
1292 | 1292 |
|
1293 |
-#if defined(ENABLE_HTTP_PROXY) && !defined(ENABLE_SMALL) |
|
1293 |
+#ifndef ENABLE_SMALL |
|
1294 | 1294 |
static void |
1295 | 1295 |
show_http_proxy_options (const struct http_proxy_options *o) |
1296 | 1296 |
{ |
... | ... |
@@ -1369,15 +1357,11 @@ show_connection_entry (const struct connection_entry *o) |
1369 | 1369 |
SHOW_INT (connect_retry_seconds); |
1370 | 1370 |
SHOW_INT (connect_timeout); |
1371 | 1371 |
|
1372 |
-#ifdef ENABLE_HTTP_PROXY |
|
1373 | 1372 |
if (o->http_proxy_options) |
1374 | 1373 |
show_http_proxy_options (o->http_proxy_options); |
1375 |
-#endif |
|
1376 |
-#ifdef ENABLE_SOCKS |
|
1377 | 1374 |
SHOW_STR (socks_proxy_server); |
1378 | 1375 |
SHOW_STR (socks_proxy_port); |
1379 | 1376 |
SHOW_BOOL (socks_proxy_retry); |
1380 |
-#endif |
|
1381 | 1377 |
SHOW_INT (tun_mtu); |
1382 | 1378 |
SHOW_BOOL (tun_mtu_defined); |
1383 | 1379 |
SHOW_INT (link_mtu); |
... | ... |
@@ -1697,7 +1681,7 @@ show_settings (const struct options *o) |
1697 | 1697 |
#undef SHOW_INT |
1698 | 1698 |
#undef SHOW_BOOL |
1699 | 1699 |
|
1700 |
-#if HTTP_PROXY_OVERRIDE |
|
1700 |
+#ifdef ENABLE_MANAGEMENT |
|
1701 | 1701 |
|
1702 | 1702 |
static struct http_proxy_options * |
1703 | 1703 |
parse_http_proxy_override (const char *server, |
... | ... |
@@ -1986,22 +1970,16 @@ options_postprocess_verify_ce (const struct options *options, const struct conne |
1986 | 1986 |
if (!ce->remote && ce->proto == PROTO_TCP_CLIENT) |
1987 | 1987 |
msg (M_USAGE, "--remote MUST be used in TCP Client mode"); |
1988 | 1988 |
|
1989 |
-#ifdef ENABLE_HTTP_PROXY |
|
1990 | 1989 |
if ((ce->http_proxy_options) && ce->proto != PROTO_TCP_CLIENT) |
1991 | 1990 |
msg (M_USAGE, "--http-proxy MUST be used in TCP Client mode (i.e. --proto tcp-client)"); |
1992 | 1991 |
if ((ce->http_proxy_options) && !ce->http_proxy_options->server) |
1993 | 1992 |
msg (M_USAGE, "--http-proxy not specified but other http proxy options present"); |
1994 |
-#endif |
|
1995 | 1993 |
|
1996 |
-#if defined(ENABLE_HTTP_PROXY) && defined(ENABLE_SOCKS) |
|
1997 | 1994 |
if (ce->http_proxy_options && ce->socks_proxy_server) |
1998 | 1995 |
msg (M_USAGE, "--http-proxy can not be used together with --socks-proxy"); |
1999 |
-#endif |
|
2000 | 1996 |
|
2001 |
-#ifdef ENABLE_SOCKS |
|
2002 | 1997 |
if (ce->socks_proxy_server && ce->proto == PROTO_TCP_SERVER) |
2003 | 1998 |
msg (M_USAGE, "--socks-proxy can not be used in TCP Server mode"); |
2004 |
-#endif |
|
2005 | 1999 |
|
2006 | 2000 |
if (ce->proto == PROTO_TCP_SERVER && (options->connection_list->len > 1)) |
2007 | 2001 |
msg (M_USAGE, "TCP server mode allows at most one --remote address"); |
... | ... |
@@ -2032,14 +2010,10 @@ options_postprocess_verify_ce (const struct options *options, const struct conne |
2032 | 2032 |
msg (M_USAGE, "--remote cannot be used with --mode server"); |
2033 | 2033 |
if (!ce->bind_local) |
2034 | 2034 |
msg (M_USAGE, "--nobind cannot be used with --mode server"); |
2035 |
-#ifdef ENABLE_HTTP_PROXY |
|
2036 | 2035 |
if (ce->http_proxy_options) |
2037 | 2036 |
msg (M_USAGE, "--http-proxy cannot be used with --mode server"); |
2038 |
-#endif |
|
2039 |
-#ifdef ENABLE_SOCKS |
|
2040 | 2037 |
if (ce->socks_proxy_server) |
2041 | 2038 |
msg (M_USAGE, "--socks-proxy cannot be used with --mode server"); |
2042 |
-#endif |
|
2043 | 2039 |
/* <connection> blocks force to have a remote embedded, so we check for the |
2044 | 2040 |
* --remote and bail out if it is present */ |
2045 | 2041 |
if (options->connection_list->len >1 || |
... | ... |
@@ -2380,10 +2354,8 @@ options_postprocess_mutate_ce (struct options *o, struct connection_entry *ce) |
2380 | 2380 |
if (ce->proto == PROTO_TCP_CLIENT && !ce->local && !ce->local_port_defined && !ce->bind_defined) |
2381 | 2381 |
ce->bind_local = false; |
2382 | 2382 |
|
2383 |
-#ifdef ENABLE_SOCKS |
|
2384 | 2383 |
if (ce->proto == PROTO_UDP && ce->socks_proxy_server && !ce->local && !ce->local_port_defined && !ce->bind_defined) |
2385 | 2384 |
ce->bind_local = false; |
2386 |
-#endif |
|
2387 | 2385 |
|
2388 | 2386 |
if (!ce->bind_local) |
2389 | 2387 |
ce->local_port = NULL; |
... | ... |
@@ -2532,7 +2504,7 @@ options_postprocess_mutate (struct options *o) |
2532 | 2532 |
for (i = 0; i < o->connection_list->len; ++i) |
2533 | 2533 |
options_postprocess_mutate_ce (o, o->connection_list->array[i]); |
2534 | 2534 |
|
2535 |
-#if HTTP_PROXY_OVERRIDE |
|
2535 |
+#if ENABLE_MANAGEMENT |
|
2536 | 2536 |
if (o->http_proxy_override) |
2537 | 2537 |
options_postprocess_http_proxy_override(o); |
2538 | 2538 |
#endif |
... | ... |
@@ -4508,7 +4480,7 @@ add_option (struct options *options, |
4508 | 4508 |
|
4509 | 4509 |
options->ignore_unknown_option[i] = NULL; |
4510 | 4510 |
} |
4511 |
-#if HTTP_PROXY_OVERRIDE |
|
4511 |
+#if ENABLE_MANAGEMENT |
|
4512 | 4512 |
else if (streq (p[0], "http-proxy-override") && p[1] && p[2]) |
4513 | 4513 |
{ |
4514 | 4514 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
... | ... |
@@ -5020,7 +4992,6 @@ add_option (struct options *options, |
5020 | 5020 |
} |
5021 | 5021 |
options->proto_force = proto_force; |
5022 | 5022 |
} |
5023 |
-#ifdef ENABLE_HTTP_PROXY |
|
5024 | 5023 |
else if (streq (p[0], "http-proxy") && p[1]) |
5025 | 5024 |
{ |
5026 | 5025 |
struct http_proxy_options *ho; |
... | ... |
@@ -5127,8 +5098,6 @@ add_option (struct options *options, |
5127 | 5127 |
msg (msglevel, "Bad http-proxy-option or missing parameter: '%s'", p[1]); |
5128 | 5128 |
} |
5129 | 5129 |
} |
5130 |
-#endif |
|
5131 |
-#ifdef ENABLE_SOCKS |
|
5132 | 5130 |
else if (streq (p[0], "socks-proxy") && p[1]) |
5133 | 5131 |
{ |
5134 | 5132 |
VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION); |
... | ... |
@@ -5149,7 +5118,6 @@ add_option (struct options *options, |
5149 | 5149 |
VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION); |
5150 | 5150 |
options->ce.socks_proxy_retry = true; |
5151 | 5151 |
} |
5152 |
-#endif |
|
5153 | 5152 |
else if (streq (p[0], "keepalive") && p[1] && p[2]) |
5154 | 5153 |
{ |
5155 | 5154 |
VERIFY_PERMISSION (OPT_P_GENERAL); |
... | ... |
@@ -100,15 +100,11 @@ struct connection_entry |
100 | 100 |
int connect_retry_seconds; |
101 | 101 |
int connect_timeout; |
102 | 102 |
bool connect_timeout_defined; |
103 |
-#ifdef ENABLE_HTTP_PROXY |
|
104 | 103 |
struct http_proxy_options *http_proxy_options; |
105 |
-#endif |
|
106 |
-#ifdef ENABLE_SOCKS |
|
107 | 104 |
const char *socks_proxy_server; |
108 | 105 |
const char *socks_proxy_port; |
109 | 106 |
const char *socks_proxy_authfile; |
110 | 107 |
bool socks_proxy_retry; |
111 |
-#endif |
|
112 | 108 |
|
113 | 109 |
int tun_mtu; /* MTU of tun device */ |
114 | 110 |
bool tun_mtu_defined; /* true if user overriding parm with command line option */ |
... | ... |
@@ -217,7 +213,7 @@ struct options |
217 | 217 |
/* Counts the number of unsuccessful connection attempts */ |
218 | 218 |
unsigned int unsuccessful_attempts; |
219 | 219 |
|
220 |
-#if HTTP_PROXY_OVERRIDE |
|
220 |
+#if ENABLE_MANAGEMENT |
|
221 | 221 |
struct http_proxy_options *http_proxy_override; |
222 | 222 |
#endif |
223 | 223 |
|
... | ... |
@@ -42,8 +42,6 @@ |
42 | 42 |
#include "ntlm.h" |
43 | 43 |
#include "memdbg.h" |
44 | 44 |
|
45 |
-#ifdef ENABLE_HTTP_PROXY |
|
46 |
- |
|
47 | 45 |
#define UP_TYPE_PROXY "HTTP Proxy" |
48 | 46 |
|
49 | 47 |
struct http_proxy_options * |
... | ... |
@@ -945,8 +943,3 @@ establish_http_proxy_passthru (struct http_proxy_info *p, |
945 | 945 |
gc_free (&gc); |
946 | 946 |
return ret; |
947 | 947 |
} |
948 |
- |
|
949 |
-#else |
|
950 |
-static void dummy(void) {} |
|
951 |
-#endif /* ENABLE_HTTP_PROXY */ |
|
952 |
- |
... | ... |
@@ -28,8 +28,6 @@ |
28 | 28 |
#include "buffer.h" |
29 | 29 |
#include "misc.h" |
30 | 30 |
|
31 |
-#ifdef ENABLE_HTTP_PROXY |
|
32 |
- |
|
33 | 31 |
/* HTTP CONNECT authentication methods */ |
34 | 32 |
#define HTTP_AUTH_NONE 0 |
35 | 33 |
#define HTTP_AUTH_BASIC 1 |
... | ... |
@@ -94,6 +92,4 @@ bool establish_http_proxy_passthru (struct http_proxy_info *p, |
94 | 94 |
uint8_t *make_base64_string2 (const uint8_t *str, int str_len, struct gc_arena *gc); |
95 | 95 |
uint8_t *make_base64_string (const uint8_t *str, struct gc_arena *gc); |
96 | 96 |
|
97 |
-#endif /* ENABLE_HTTP_PROXY */ |
|
98 |
- |
|
99 | 97 |
#endif /* PROXY_H */ |
... | ... |
@@ -841,12 +841,10 @@ static void bind_local (struct link_socket *sock, const sa_family_t ai_family) |
841 | 841 |
/* bind to local address/port */ |
842 | 842 |
if (sock->bind_local) |
843 | 843 |
{ |
844 |
-#ifdef ENABLE_SOCKS |
|
845 | 844 |
if (sock->socks_proxy && sock->info.proto == PROTO_UDP) |
846 | 845 |
socket_bind (sock->ctrl_sd, sock->info.lsa->bind_local, |
847 | 846 |
ai_family, "SOCKS", false); |
848 | 847 |
else |
849 |
-#endif |
|
850 | 848 |
socket_bind (sock->sd, sock->info.lsa->bind_local, |
851 | 849 |
ai_family, |
852 | 850 |
"TCP/UDP", sock->info.bind_ipv6_only); |
... | ... |
@@ -861,7 +859,6 @@ create_socket (struct link_socket* sock, struct addrinfo* addr) |
861 | 861 |
sock->sd = create_socket_udp (addr, sock->sockflags); |
862 | 862 |
sock->sockflags |= SF_GETADDRINFO_DGRAM; |
863 | 863 |
|
864 |
-#ifdef ENABLE_SOCKS |
|
865 | 864 |
/* Assume that control socket and data socket to the socks proxy |
866 | 865 |
* are using the same IP family */ |
867 | 866 |
if (sock->socks_proxy) |
... | ... |
@@ -874,7 +871,6 @@ create_socket (struct link_socket* sock, struct addrinfo* addr) |
874 | 874 |
addrinfo_tmp.ai_protocol = IPPROTO_TCP; |
875 | 875 |
sock->ctrl_sd = create_socket_tcp (&addrinfo_tmp); |
876 | 876 |
} |
877 |
-#endif |
|
878 | 877 |
} |
879 | 878 |
else if (addr->ai_protocol == IPPROTO_TCP || addr->ai_socktype == SOCK_STREAM) |
880 | 879 |
{ |
... | ... |
@@ -1494,9 +1490,7 @@ link_socket_new (void) |
1494 | 1494 |
|
1495 | 1495 |
ALLOC_OBJ_CLEAR (sock, struct link_socket); |
1496 | 1496 |
sock->sd = SOCKET_UNDEFINED; |
1497 |
-#ifdef ENABLE_SOCKS |
|
1498 | 1497 |
sock->ctrl_sd = SOCKET_UNDEFINED; |
1499 |
-#endif |
|
1500 | 1498 |
return sock; |
1501 | 1499 |
} |
1502 | 1500 |
|
... | ... |
@@ -1512,12 +1506,8 @@ link_socket_init_phase1 (struct link_socket *sock, |
1512 | 1512 |
bool bind_ipv6_only, |
1513 | 1513 |
int mode, |
1514 | 1514 |
const struct link_socket *accept_from, |
1515 |
-#ifdef ENABLE_HTTP_PROXY |
|
1516 | 1515 |
struct http_proxy_info *http_proxy, |
1517 |
-#endif |
|
1518 |
-#ifdef ENABLE_SOCKS |
|
1519 | 1516 |
struct socks_proxy_info *socks_proxy, |
1520 |
-#endif |
|
1521 | 1517 |
#ifdef ENABLE_DEBUG |
1522 | 1518 |
int gremlin, |
1523 | 1519 |
#endif |
... | ... |
@@ -1542,15 +1532,8 @@ link_socket_init_phase1 (struct link_socket *sock, |
1542 | 1542 |
sock->remote_host = remote_host; |
1543 | 1543 |
sock->remote_port = remote_port; |
1544 | 1544 |
sock->dns_cache = dns_cache; |
1545 |
- |
|
1546 |
-#ifdef ENABLE_HTTP_PROXY |
|
1547 | 1545 |
sock->http_proxy = http_proxy; |
1548 |
-#endif |
|
1549 |
- |
|
1550 |
-#ifdef ENABLE_SOCKS |
|
1551 | 1546 |
sock->socks_proxy = socks_proxy; |
1552 |
-#endif |
|
1553 |
- |
|
1554 | 1547 |
sock->bind_local = bind_local; |
1555 | 1548 |
sock->inetd = inetd; |
1556 | 1549 |
sock->resolve_retry_seconds = resolve_retry_seconds; |
... | ... |
@@ -1586,7 +1569,6 @@ link_socket_init_phase1 (struct link_socket *sock, |
1586 | 1586 |
|
1587 | 1587 |
if (false) |
1588 | 1588 |
; |
1589 |
-#ifdef ENABLE_HTTP_PROXY |
|
1590 | 1589 |
/* are we running in HTTP proxy mode? */ |
1591 | 1590 |
else if (sock->http_proxy) |
1592 | 1591 |
{ |
... | ... |
@@ -1601,8 +1583,6 @@ link_socket_init_phase1 (struct link_socket *sock, |
1601 | 1601 |
sock->proxy_dest_host = remote_host; |
1602 | 1602 |
sock->proxy_dest_port = remote_port; |
1603 | 1603 |
} |
1604 |
-#endif |
|
1605 |
-#ifdef ENABLE_SOCKS |
|
1606 | 1604 |
/* or in Socks proxy mode? */ |
1607 | 1605 |
else if (sock->socks_proxy) |
1608 | 1606 |
{ |
... | ... |
@@ -1616,7 +1596,6 @@ link_socket_init_phase1 (struct link_socket *sock, |
1616 | 1616 |
sock->proxy_dest_host = remote_host; |
1617 | 1617 |
sock->proxy_dest_port = remote_port; |
1618 | 1618 |
} |
1619 |
-#endif |
|
1620 | 1619 |
else |
1621 | 1620 |
{ |
1622 | 1621 |
sock->remote_host = remote_host; |
... | ... |
@@ -1702,10 +1681,8 @@ phase2_set_socket_flags (struct link_socket* sock) |
1702 | 1702 |
scripts don't have access to it */ |
1703 | 1703 |
set_cloexec (sock->sd); |
1704 | 1704 |
|
1705 |
-#ifdef ENABLE_SOCKS |
|
1706 | 1705 |
if (socket_defined (sock->ctrl_sd)) |
1707 | 1706 |
set_cloexec (sock->ctrl_sd); |
1708 |
-#endif |
|
1709 | 1707 |
|
1710 | 1708 |
/* set Path MTU discovery options on the socket */ |
1711 | 1709 |
set_mtu_discover_type (sock->sd, sock->mtu_discover_type); |
... | ... |
@@ -1798,11 +1775,7 @@ phase2_tcp_server (struct link_socket *sock, const char *remote_dynamic, |
1798 | 1798 |
static void |
1799 | 1799 |
phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) |
1800 | 1800 |
{ |
1801 |
-#ifdef GENERAL_PROXY_SUPPORT |
|
1802 | 1801 |
bool proxy_retry = false; |
1803 |
-#else |
|
1804 |
- const bool proxy_retry = false; |
|
1805 |
-#endif |
|
1806 | 1802 |
do { |
1807 | 1803 |
socket_connect (&sock->sd, |
1808 | 1804 |
sock->info.lsa->current_remote->ai_addr, |
... | ... |
@@ -1814,7 +1787,6 @@ phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) |
1814 | 1814 |
|
1815 | 1815 |
if (false) |
1816 | 1816 |
; |
1817 |
-#ifdef ENABLE_HTTP_PROXY |
|
1818 | 1817 |
else if (sock->http_proxy) |
1819 | 1818 |
{ |
1820 | 1819 |
proxy_retry = establish_http_proxy_passthru (sock->http_proxy, |
... | ... |
@@ -1824,8 +1796,6 @@ phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) |
1824 | 1824 |
&sock->stream_buf.residual, |
1825 | 1825 |
&sig_info->signal_received); |
1826 | 1826 |
} |
1827 |
-#endif |
|
1828 |
-#ifdef ENABLE_SOCKS |
|
1829 | 1827 |
else if (sock->socks_proxy) |
1830 | 1828 |
{ |
1831 | 1829 |
establish_socks_proxy_passthru (sock->socks_proxy, |
... | ... |
@@ -1834,7 +1804,6 @@ phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) |
1834 | 1834 |
sock->proxy_dest_port, |
1835 | 1835 |
&sig_info->signal_received); |
1836 | 1836 |
} |
1837 |
-#endif |
|
1838 | 1837 |
if (proxy_retry) |
1839 | 1838 |
{ |
1840 | 1839 |
openvpn_close_socket (sock->sd); |
... | ... |
@@ -1845,7 +1814,6 @@ phase2_tcp_client (struct link_socket *sock, struct signal_info *sig_info) |
1845 | 1845 |
|
1846 | 1846 |
} |
1847 | 1847 |
|
1848 |
-#ifdef ENABLE_SOCKS |
|
1849 | 1848 |
static void |
1850 | 1849 |
phase2_socks_client (struct link_socket *sock, struct signal_info *sig_info) |
1851 | 1850 |
{ |
... | ... |
@@ -1879,7 +1847,6 @@ phase2_socks_client (struct link_socket *sock, struct signal_info *sig_info) |
1879 | 1879 |
|
1880 | 1880 |
resolve_remote (sock, 1, NULL, &sig_info->signal_received); |
1881 | 1881 |
} |
1882 |
-#endif |
|
1883 | 1882 |
|
1884 | 1883 |
/* finalize socket initialization */ |
1885 | 1884 |
void |
... | ... |
@@ -1965,11 +1932,9 @@ link_socket_init_phase2 (struct link_socket *sock, |
1965 | 1965 |
phase2_tcp_client (sock, sig_info); |
1966 | 1966 |
|
1967 | 1967 |
} |
1968 |
-#ifdef ENABLE_SOCKS |
|
1969 | 1968 |
else if (sock->info.proto == PROTO_UDP && sock->socks_proxy) |
1970 | 1969 |
{ |
1971 | 1970 |
phase2_socks_client (sock, sig_info); |
1972 |
-#endif |
|
1973 | 1971 |
} |
1974 | 1972 |
#ifdef TARGET_ANDROID |
1975 | 1973 |
if (sock->sd != -1) |
... | ... |
@@ -2022,14 +1987,12 @@ link_socket_close (struct link_socket *sock) |
2022 | 2022 |
#endif |
2023 | 2023 |
} |
2024 | 2024 |
|
2025 |
-#ifdef ENABLE_SOCKS |
|
2026 | 2025 |
if (socket_defined (sock->ctrl_sd)) |
2027 | 2026 |
{ |
2028 | 2027 |
if (openvpn_close_socket (sock->ctrl_sd)) |
2029 | 2028 |
msg (M_WARN | M_ERRNO, "TCP/UDP: Close Socket (ctrl_sd) failed"); |
2030 | 2029 |
sock->ctrl_sd = SOCKET_UNDEFINED; |
2031 | 2030 |
} |
2032 |
-#endif |
|
2033 | 2031 |
|
2034 | 2032 |
stream_buf_close (&sock->stream_buf); |
2035 | 2033 |
free_buf (&sock->stream_buf_data); |
... | ... |
@@ -172,10 +172,7 @@ struct link_socket |
172 | 172 |
struct link_socket_info info; |
173 | 173 |
|
174 | 174 |
socket_descriptor_t sd; |
175 |
- |
|
176 |
-#ifdef ENABLE_SOCKS |
|
177 | 175 |
socket_descriptor_t ctrl_sd; /* only used for UDP over Socks */ |
178 |
-#endif |
|
179 | 176 |
|
180 | 177 |
#ifdef WIN32 |
181 | 178 |
struct overlapped_io reads; |
... | ... |
@@ -228,22 +225,16 @@ struct link_socket |
228 | 228 |
struct buffer stream_buf_data; |
229 | 229 |
bool stream_reset; |
230 | 230 |
|
231 |
-#ifdef ENABLE_HTTP_PROXY |
|
232 | 231 |
/* HTTP proxy */ |
233 | 232 |
struct http_proxy_info *http_proxy; |
234 |
-#endif |
|
235 | 233 |
|
236 |
-#ifdef ENABLE_SOCKS |
|
237 | 234 |
/* Socks proxy */ |
238 | 235 |
struct socks_proxy_info *socks_proxy; |
239 | 236 |
struct link_socket_actual socks_relay; /* Socks UDP relay address */ |
240 |
-#endif |
|
241 | 237 |
|
242 |
-#if defined(ENABLE_HTTP_PROXY) || defined(ENABLE_SOCKS) |
|
243 | 238 |
/* The OpenVPN server we will use the proxy to connect to */ |
244 | 239 |
const char *proxy_dest_host; |
245 | 240 |
const char *proxy_dest_port; |
246 |
-#endif |
|
247 | 241 |
|
248 | 242 |
#if PASSTOS_CAPABILITY |
249 | 243 |
/* used to get/set TOS. */ |
... | ... |
@@ -321,12 +312,8 @@ link_socket_init_phase1 (struct link_socket *sock, |
321 | 321 |
bool bind_ipv6_only, |
322 | 322 |
int mode, |
323 | 323 |
const struct link_socket *accept_from, |
324 |
-#ifdef ENABLE_HTTP_PROXY |
|
325 | 324 |
struct http_proxy_info *http_proxy, |
326 |
-#endif |
|
327 |
-#ifdef ENABLE_SOCKS |
|
328 | 325 |
struct socks_proxy_info *socks_proxy, |
329 |
-#endif |
|
330 | 326 |
#ifdef ENABLE_DEBUG |
331 | 327 |
int gremlin, |
332 | 328 |
#endif |
... | ... |
@@ -38,8 +38,6 @@ |
38 | 38 |
|
39 | 39 |
#include "syshead.h" |
40 | 40 |
|
41 |
-#ifdef ENABLE_SOCKS |
|
42 |
- |
|
43 | 41 |
#include "common.h" |
44 | 42 |
#include "misc.h" |
45 | 43 |
#include "win32.h" |
... | ... |
@@ -574,7 +572,3 @@ socks_process_outgoing_udp (struct buffer *buf, |
574 | 574 |
|
575 | 575 |
return 10; |
576 | 576 |
} |
577 |
- |
|
578 |
-#else |
|
579 |
-static void dummy(void) {} |
|
580 |
-#endif /* ENABLE_SOCKS */ |
... | ... |
@@ -30,8 +30,6 @@ |
30 | 30 |
#ifndef SOCKS_H |
31 | 31 |
#define SOCKS_H |
32 | 32 |
|
33 |
-#ifdef ENABLE_SOCKS |
|
34 |
- |
|
35 | 33 |
#include "buffer.h" |
36 | 34 |
|
37 | 35 |
struct openvpn_sockaddr; |
... | ... |
@@ -74,4 +72,3 @@ int socks_process_outgoing_udp (struct buffer *buf, |
74 | 74 |
const struct link_socket_actual *to); |
75 | 75 |
|
76 | 76 |
#endif |
77 |
-#endif |
... | ... |
@@ -603,7 +603,7 @@ socket_defined (const socket_descriptor_t sd) |
603 | 603 |
/* |
604 | 604 |
* Should we include NTLM proxy functionality |
605 | 605 |
*/ |
606 |
-#if defined(ENABLE_CRYPTO) && defined(ENABLE_HTTP_PROXY) |
|
606 |
+#if defined(ENABLE_CRYPTO) |
|
607 | 607 |
#define NTLM 1 |
608 | 608 |
#else |
609 | 609 |
#define NTLM 0 |
... | ... |
@@ -612,20 +612,13 @@ socket_defined (const socket_descriptor_t sd) |
612 | 612 |
/* |
613 | 613 |
* Should we include proxy digest auth functionality |
614 | 614 |
*/ |
615 |
-#if defined(ENABLE_CRYPTO) && defined(ENABLE_HTTP_PROXY) |
|
615 |
+#if defined(ENABLE_CRYPTO) |
|
616 | 616 |
#define PROXY_DIGEST_AUTH 1 |
617 | 617 |
#else |
618 | 618 |
#define PROXY_DIGEST_AUTH 0 |
619 | 619 |
#endif |
620 | 620 |
|
621 | 621 |
/* |
622 |
- * Should we include code common to all proxy methods? |
|
623 |
- */ |
|
624 |
-#if defined(ENABLE_HTTP_PROXY) || defined(ENABLE_SOCKS) |
|
625 |
-#define GENERAL_PROXY_SUPPORT |
|
626 |
-#endif |
|
627 |
- |
|
628 |
-/* |
|
629 | 622 |
* Do we have CryptoAPI capability? |
630 | 623 |
*/ |
631 | 624 |
#if defined(WIN32) && defined(ENABLE_CRYPTO) && defined(ENABLE_SSL) && defined(ENABLE_CRYPTO_OPENSSL) |
... | ... |
@@ -664,15 +657,6 @@ socket_defined (const socket_descriptor_t sd) |
664 | 664 |
#endif |
665 | 665 |
|
666 | 666 |
/* |
667 |
- * Should we include http proxy override functionality |
|
668 |
- */ |
|
669 |
-#if defined(ENABLE_MANAGEMENT) && defined(ENABLE_HTTP_PROXY) |
|
670 |
-#define HTTP_PROXY_OVERRIDE 1 |
|
671 |
-#else |
|
672 |
-#define HTTP_PROXY_OVERRIDE 0 |
|
673 |
-#endif |
|
674 |
- |
|
675 |
-/* |
|
676 | 667 |
* Reduce sensitivity to system clock instability |
677 | 668 |
* and backtracks. |
678 | 669 |
*/ |