Skip to contentSkip to conversation

fix regression with --http-proxy[-*] options

PATCH Applied Heiko Hund 3 participants 3 messages Jul 30, 2012

lore
Share & tools
lore

Heiko Hund

author
#0 lore raw

PATCH 1/1 fix regression with --http-proxy[-*] options

Commit af1bf85a introducing the --management-query-proxy option broke the initialization of HTTP proxy options by not assigning the allocated object to the options element in the function init_http_proxy_options_once().

---
 src/openvpn/init.c    |    3 +--
 src/openvpn/options.c |    8 ++++----
 src/openvpn/proxy.c   |   12 ++++++------
 src/openvpn/proxy.h   |    2 +-
 4 files changed, 12 insertions(+), 13 deletions(-)
src/openvpn/init.c +1 -2
index 2f84375..270ee6a 100644
@@ -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
         }
src/openvpn/options.c +4 -4
index cd1cb1c..9f4ddbb 100644
@@ -4879,7 +4879,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;
@@ -4914,7 +4914,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])
@@ -4922,7 +4922,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])
@@ -4930,7 +4930,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])
 	{
src/openvpn/proxy.c +6 -6
index 28ce019..363d8a7 100644
@@ -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;
 }
 
 
src/openvpn/proxy.h +1 -1
index dc62261..5e476f1 100644
@@ -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);
Signature · 1 line
1.7.9.5
#1 lore raw

Am 30.07.12 11:05, schrieb Heiko Hund:

Quoted 7 lines

Commit af1bf85a introducing the --management-query-proxy option broke the initialization of HTTP proxy options by not assigning the allocated object to the options element in the function init_http_proxy_options_once().

In my test this patch worked. It also worked for reporting user. So ACK from me.

Arne

#2 lore raw
In reply to Heiko Hund

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 11 lines · Heiko Hund

Commit af1bf85a introducing the --management-query-proxy option broke the initialization of HTTP proxy options by not assigning the allocated object to the options element in the function init_http_proxy_options_once().

src/openvpn/init.c | 3 +-- src/openvpn/options.c | 8
++++---- src/openvpn/proxy.c | 12 ++++++------
src/openvpn/proxy.h | 2 +- 4 files changed, 12 insertions(+),
13 deletions(-)

Applied to master.

commit 4f879daeb9b1b709c80d01e4872b30e23747c4a8

Author: Heiko Hund <[email protected]...>
Date:   Mon Jul 30 11:05:22 2012 +0200
    fix regression with --http-proxy[-*] options

    Signed-off-by: Heiko Hund <[email protected]...>
    Acked-by: Arne Schwabe <[email protected]...>
    Message-Id: [email protected]...
    URL: http://article.gmane.org/gmane.network.openvpn.devel/6913
    Signed-off-by: David Sommerseth <[email protected]...>

kind regards,

David Sommerseth
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAlAWkZMACgkQDC186MBRfroVPQCfUbhvHxx9O+TqdCJ7suLK5c5f 3ZgAnjlNdrw9oxJPN5AtEoBTcUtC+ZCD
=rKlw
-----END PGP SIGNATURE-----