Browse code

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().

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>

Heiko Hund authored on 2012/07/30 18:05:22
Showing 4 changed files
... ...
@@ -144,12 +144,11 @@ management_callback_proxy_cmd (void *arg, const char **p)
144 144
               msg (M_WARN, "HTTP proxy support only works for TCP based connections");
145 145
               return false;
146 146
             }
147
-          ho = init_http_proxy_options_once (ce->http_proxy_options, gc);
147
+          ho = init_http_proxy_options_once (&ce->http_proxy_options, gc);
148 148
           ho->server = string_alloc (p[2], gc);
149 149
           ho->port = port;
150 150
           ho->retry = true;
151 151
           ho->auth_retry = (p[4] && streq (p[4], "nct") ? PAR_NCT : PAR_ALL);
152
-          ce->http_proxy_options = ho;
153 152
           ret = true;
154 153
 #endif
155 154
         }
... ...
@@ -4879,7 +4879,7 @@ add_option (struct options *options,
4879 4879
 	    goto err;
4880 4880
 	  }
4881 4881
 	
4882
-	ho = init_http_proxy_options_once (options->ce.http_proxy_options, &options->gc);
4882
+	ho = init_http_proxy_options_once (&options->ce.http_proxy_options, &options->gc);
4883 4883
 	
4884 4884
 	ho->server = p[1];
4885 4885
 	ho->port = port;
... ...
@@ -4914,7 +4914,7 @@ add_option (struct options *options,
4914 4914
     {
4915 4915
       struct http_proxy_options *ho;
4916 4916
       VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
4917
-      ho = init_http_proxy_options_once (options->ce.http_proxy_options, &options->gc);
4917
+      ho = init_http_proxy_options_once (&options->ce.http_proxy_options, &options->gc);
4918 4918
       ho->retry = true;
4919 4919
     }
4920 4920
   else if (streq (p[0], "http-proxy-timeout") && p[1])
... ...
@@ -4922,7 +4922,7 @@ add_option (struct options *options,
4922 4922
       struct http_proxy_options *ho;
4923 4923
 
4924 4924
       VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
4925
-      ho = init_http_proxy_options_once (options->ce.http_proxy_options, &options->gc);
4925
+      ho = init_http_proxy_options_once (&options->ce.http_proxy_options, &options->gc);
4926 4926
       ho->timeout = positive_atoi (p[1]);
4927 4927
     }
4928 4928
   else if (streq (p[0], "http-proxy-option") && p[1])
... ...
@@ -4930,7 +4930,7 @@ add_option (struct options *options,
4930 4930
       struct http_proxy_options *ho;
4931 4931
 
4932 4932
       VERIFY_PERMISSION (OPT_P_GENERAL|OPT_P_CONNECTION);
4933
-      ho = init_http_proxy_options_once (options->ce.http_proxy_options, &options->gc);
4933
+      ho = init_http_proxy_options_once (&options->ce.http_proxy_options, &options->gc);
4934 4934
 
4935 4935
       if (streq (p[1], "VERSION") && p[2])
4936 4936
 	{
... ...
@@ -47,17 +47,17 @@
47 47
 #define UP_TYPE_PROXY        "HTTP Proxy"
48 48
 
49 49
 struct http_proxy_options *
50
-init_http_proxy_options_once (struct http_proxy_options *hpo,
50
+init_http_proxy_options_once (struct http_proxy_options **hpo,
51 51
                               struct gc_arena *gc)
52 52
 {
53
-  if (!hpo)
53
+  if (!*hpo)
54 54
     {
55
-      ALLOC_OBJ_CLEAR_GC (hpo, struct http_proxy_options, gc);
55
+      ALLOC_OBJ_CLEAR_GC (*hpo, struct http_proxy_options, gc);
56 56
       /* http proxy defaults */
57
-      hpo->timeout = 5;
58
-      hpo->http_version = "1.0";
57
+      (*hpo)->timeout = 5;
58
+      (*hpo)->http_version = "1.0";
59 59
     }
60
-  return hpo;
60
+  return *hpo;
61 61
 }
62 62
 
63 63
 
... ...
@@ -70,7 +70,7 @@ struct http_proxy_info {
70 70
   bool queried_creds;
71 71
 };
72 72
 
73
-struct http_proxy_options *init_http_proxy_options_once (struct http_proxy_options *hpo,
73
+struct http_proxy_options *init_http_proxy_options_once (struct http_proxy_options **hpo,
74 74
                                                          struct gc_arena *gc);
75 75
 
76 76
 struct http_proxy_info *http_proxy_new (const struct http_proxy_options *o);