]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
fix regression with --http-proxy[-*] options
authorHeiko Hund <heiko.hund@sophos.com>
Mon, 30 Jul 2012 09:05:22 +0000 (11:05 +0200)
committerDavid Sommerseth <dazo@users.sourceforge.net>
Mon, 30 Jul 2012 13:49:55 +0000 (15:49 +0200)
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().

Signed-off-by: Heiko Hund <heiko.hund@sophos.com>
Acked-by: Arne Schwabe <arne@rfc2549.org>
Message-Id: 1343639122-8658-1-git-send-email-heiko.hund@sophos.com
URL: http://article.gmane.org/gmane.network.openvpn.devel/6913
Signed-off-by: David Sommerseth <dazo@users.sourceforge.net>
src/openvpn/init.c
src/openvpn/options.c
src/openvpn/proxy.c
src/openvpn/proxy.h

index 2f8437549251dac8ba0488b9276efe20969b5ca1..270ee6a63d72cec3182b0bdeb6b77f023083a064 100644 (file)
@@ -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
         }
index cd1cb1c42c7ccbc4ffb14cfbeec90fa86520f34b..9f4ddbb924c653e3c39ea2aaefb3d8baf0d2ec85 100644 (file)
@@ -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])
        {
index 28ce019c384c3382daaecc15255609ab80101323..363d8a735f4db11df423de102fb0d1fc3823bf70 100644 (file)
 #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;
 }
 
 
index dc62261cd54bb25fecc74f45249b54fb3b24e462..5e476f16e5ea6a0de59932bd461e6a933a32fe5e 100644 (file)
@@ -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);