]> git.ipfire.org Git - thirdparty/openvpn.git/commitdiff
Fixed bug in proxy fallback capability where openvpn.exe could
authorJames Yonan <james@openvpn.net>
Sat, 10 Jul 2010 03:04:27 +0000 (03:04 +0000)
committerJames Yonan <james@openvpn.net>
Sat, 10 Jul 2010 03:04:27 +0000 (03:04 +0000)
core dump if http-proxy-fallback-disable command was issued in
response to ">PROXY:NEED_NOW management" interface notification.

git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@6284 e7ae566f-a301-0410-adde-c780ea21d3b5

init.c
options.c

diff --git a/init.c b/init.c
index 5e45ccd42d7c05c9a077978c31e150d19104a7aa..90b253f64facba1eaebdbf3d564b35652ff82430 100644 (file)
--- a/init.c
+++ b/init.c
@@ -122,7 +122,8 @@ ce_http_proxy_fallback_defined(const struct context *c)
       int i;
       for (i = 0; i < l->len; ++i)
        {
-         if (l->array[i]->flags & CE_HTTP_PROXY_FALLBACK)
+         const struct connection_entry *ce = l->array[i];
+         if (ce->flags & CE_HTTP_PROXY_FALLBACK)
            return true;
        }
     }
@@ -193,12 +194,9 @@ management_callback_http_proxy_fallback_cmd (void *arg, const char *server, cons
          struct connection_entry *ce = l->array[i];
          if (ce->flags & CE_HTTP_PROXY_FALLBACK)
            {
-             if (ho)
-               {
-                 ce->http_proxy_options = ho;
-                 ret = true;
-               }
+             ce->http_proxy_options = ho;
              ce->ce_http_proxy_fallback_timestamp = now;
+             ret = true;
            }
        }
     }
@@ -278,7 +276,7 @@ next_connection_entry (struct context *c)
 
       do {
        const char *remote_ip_hint = NULL;
-       bool advanced = false;
+       bool newcycle = false;
 
        ce_defined = true;
        if (l->no_advance && l->current >= 0)
@@ -295,7 +293,8 @@ next_connection_entry (struct context *c)
                  msg (M_FATAL, "No usable connection profiles are present");
              }
 
-           advanced = true;
+           if (l->current == 0)
+             newcycle = true;
            show_connection_list(l);
          }
 
@@ -305,7 +304,7 @@ next_connection_entry (struct context *c)
          remote_ip_hint = c->options.remote_ip_hint;
 
 #if HTTP_PROXY_FALLBACK
-       if (advanced && ce_http_proxy_fallback_defined(c))
+       if (newcycle && ce_http_proxy_fallback_defined(c))
          ce_http_proxy_fallback_start(c, remote_ip_hint);
 
        if (ce->flags & CE_HTTP_PROXY_FALLBACK)
index bb377f6579901b1668d9581904fc4b55825566d4..305704fa379f871119b796ca61daad85bf03f9f1 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1464,19 +1464,24 @@ parse_http_proxy_fallback (struct context *c,
                           const char *flags,
                           const int msglevel)
 {
-  struct gc_arena gc = gc_new ();  
+  struct gc_arena gc = gc_new ();
+  struct http_proxy_options *ret = NULL;
   struct http_proxy_options *hp = parse_http_proxy_override(server, port, flags, msglevel, &gc);
-  struct hpo_store *hpos = c->options.hpo_store;
-  if (!hpos)
+  if (hp)
     {
-      ALLOC_OBJ_CLEAR_GC (hpos, struct hpo_store, &c->options.gc);
-      c->options.hpo_store = hpos;
+      struct hpo_store *hpos = c->options.hpo_store;
+      if (!hpos)
+       {
+         ALLOC_OBJ_CLEAR_GC (hpos, struct hpo_store, &c->options.gc);
+         c->options.hpo_store = hpos;
+       }
+      hpos->hpo = *hp;
+      hpos->hpo.server = hpos->server;
+      strncpynt(hpos->server, hp->server, sizeof(hpos->server));
+      ret = &hpos->hpo;
     }
-  hpos->hpo = *hp;
-  hpos->hpo.server = hpos->server;
-  strncpynt(hpos->server, hp->server, sizeof(hpos->server));
   gc_free (&gc);
-  return &hpos->hpo;
+  return ret;
 }
 
 static void