summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-07-30 11:29:40 +0200
committerArne Schwabe <arne@rfc2549.org>2012-07-30 11:29:40 +0200
commitaa222a0434ad2c270e94fc2370e71e49d6b5331f (patch)
treed93f0187d585166a878bac570e45ee11915370fe
parent02c364271bc75cae5c00faf3b01d2f4b85113d07 (diff)
Apply upstream openvpn fix for http-proxy from Heiko Hund
-rw-r--r--openvpn/src/openvpn/init.c3
-rw-r--r--openvpn/src/openvpn/options.c8
-rw-r--r--openvpn/src/openvpn/proxy.c12
-rw-r--r--openvpn/src/openvpn/proxy.h2
4 files changed, 12 insertions, 13 deletions
diff --git a/openvpn/src/openvpn/init.c b/openvpn/src/openvpn/init.c
index 993a1f27..cd5ebd3d 100644
--- a/openvpn/src/openvpn/init.c
+++ b/openvpn/src/openvpn/init.c
@@ -144,12 +144,11 @@ management_callback_proxy_cmd (void *arg, const char **p)
msg (M_WARN, "HTTP proxy support only works for TCP based connections");
return false;
}
- ho = init_http_proxy_options_once (ce->http_proxy_options, gc);
+ ho = init_http_proxy_options_once (&ce->http_proxy_options, gc);
ho->server = string_alloc (p[2], gc);
ho->port = port;
ho->retry = true;
ho->auth_retry = (p[4] && streq (p[4], "nct") ? PAR_NCT : PAR_ALL);
- ce->http_proxy_options = ho;
ret = true;
#endif
}
diff --git a/openvpn/src/openvpn/options.c b/openvpn/src/openvpn/options.c
index 0e7d971a..a3029fc2 100644
--- a/openvpn/src/openvpn/options.c
+++ b/openvpn/src/openvpn/options.c
@@ -4891,7 +4891,7 @@ add_option (struct options *options,
goto err;
}
- ho = init_http_proxy_options_once (options->ce.http_proxy_options, &options->gc);
+ ho = init_http_proxy_options_once (&options->ce.http_proxy_options, &options->gc);
ho->server = p[1];
ho->port = port;
@@ -4926,7 +4926,7 @@ add_option (struct options *options,
{
struct http_proxy_options *ho;
VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
- ho = init_http_proxy_options_once (options->ce.http_proxy_options, &options->gc);
+ ho = init_http_proxy_options_once (&options->ce.http_proxy_options, &options->gc);
ho->retry = true;
}
else if (streq (p[0], "http-proxy-timeout") && p[1])
@@ -4934,7 +4934,7 @@ add_option (struct options *options,
struct http_proxy_options *ho;
VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
- ho = init_http_proxy_options_once (options->ce.http_proxy_options, &options->gc);
+ ho = init_http_proxy_options_once (&options->ce.http_proxy_options, &options->gc);
ho->timeout = positive_atoi (p[1]);
}
else if (streq (p[0], "http-proxy-option") && p[1])
@@ -4942,7 +4942,7 @@ add_option (struct options *options,
struct http_proxy_options *ho;
VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
- ho = init_http_proxy_options_once (options->ce.http_proxy_options, &options->gc);
+ ho = init_http_proxy_options_once (&options->ce.http_proxy_options, &options->gc);
if (streq (p[1], "VERSION") && p[2])
{
diff --git a/openvpn/src/openvpn/proxy.c b/openvpn/src/openvpn/proxy.c
index 28ce019c..363d8a73 100644
--- a/openvpn/src/openvpn/proxy.c
+++ b/openvpn/src/openvpn/proxy.c
@@ -47,17 +47,17 @@
#define UP_TYPE_PROXY "HTTP Proxy"
struct http_proxy_options *
-init_http_proxy_options_once (struct http_proxy_options *hpo,
+init_http_proxy_options_once (struct http_proxy_options **hpo,
struct gc_arena *gc)
{
- if (!hpo)
+ if (!*hpo)
{
- ALLOC_OBJ_CLEAR_GC (hpo, struct http_proxy_options, gc);
+ ALLOC_OBJ_CLEAR_GC (*hpo, struct http_proxy_options, gc);
/* http proxy defaults */
- hpo->timeout = 5;
- hpo->http_version = "1.0";
+ (*hpo)->timeout = 5;
+ (*hpo)->http_version = "1.0";
}
- return hpo;
+ return *hpo;
}
diff --git a/openvpn/src/openvpn/proxy.h b/openvpn/src/openvpn/proxy.h
index dc62261c..5e476f16 100644
--- a/openvpn/src/openvpn/proxy.h
+++ b/openvpn/src/openvpn/proxy.h
@@ -70,7 +70,7 @@ struct http_proxy_info {
bool queried_creds;
};
-struct http_proxy_options *init_http_proxy_options_once (struct http_proxy_options *hpo,
+struct http_proxy_options *init_http_proxy_options_once (struct http_proxy_options **hpo,
struct gc_arena *gc);
struct http_proxy_info *http_proxy_new (const struct http_proxy_options *o);