openvpn plugin http-proxy support patch



Hi,

this is my first code after 8 years, I hope it's ok . Basically  it's only copy/paste :). Proxy auth is not implemented yet.

t.
diff -ru network-manager-openvpn-0.7~~svn20081015t024626/properties/auth-helpers.c network-manager-openvpn-0.7~~svn20081015t024626.patched/properties/auth-helpers.c
--- network-manager-openvpn-0.7~~svn20081015t024626/properties/auth-helpers.c	2008-10-02 21:41:09.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626.patched/properties/auth-helpers.c	2008-10-16 15:28:10.460824560 +0200
@@ -726,9 +726,14 @@
 	NM_OPENVPN_KEY_COMP_LZO,
 	NM_OPENVPN_KEY_TAP_DEV,
 	NM_OPENVPN_KEY_PROTO_TCP,
+	NM_OPENVPN_KEY_HTTP_PROXY,
+	NM_OPENVPN_KEY_HTTP_PROXY_PORT,
+	NM_OPENVPN_KEY_HTTP_PROXY_RETRY,
+	NM_OPENVPN_KEY_HTTP_PROXY_AUTH,
 	NM_OPENVPN_KEY_CIPHER,
 	NM_OPENVPN_KEY_TA_DIR,
 	NM_OPENVPN_KEY_TA,
+	NM_OPENVPN_KEY_VERBOSE,
 	NULL
 };
 
@@ -773,6 +778,52 @@
 	gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
 }
 
+
+static void
+http_proxy_toggled_cb (GtkWidget *check, gpointer user_data)
+{
+        GladeXML *xml = (GladeXML *) user_data;
+        GtkWidget *widget;
+
+        widget = glade_xml_get_widget (xml, "http_proxy_entry");
+        gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+
+        widget = glade_xml_get_widget (xml, "http_proxy_port_entry");
+        gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+
+        /*
+        http-proxy
+        depend:
+                tcp
+        options:
+                proxy retry (--http-proxy-retry)
+                proxy authentication
+        */
+        widget = glade_xml_get_widget (xml, "tcp_checkbutton");
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+        gtk_widget_set_sensitive (widget, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+        /*proxy auth*/
+	/* not implemented yet */
+	/*
+	widget = glade_xml_get_widget (xml, "http_proxy_auth_checkbutton");
+        gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+	*/
+        /*http-proxy-retry*/
+        widget = glade_xml_get_widget (xml, "http_proxy_retry_checkbutton");
+        gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+
+}
+
+static void
+verbose_toggled_cb (GtkWidget *check, gpointer user_data)
+{
+        GladeXML *xml = (GladeXML *) user_data;
+        GtkWidget *widget;
+
+        widget = glade_xml_get_widget (xml, "verbose_entry");
+        gtk_widget_set_sensitive (widget, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check)));
+}
+
 static const char *
 nm_find_openvpn (void)
 {
@@ -905,7 +956,7 @@
 	GtkWidget *dialog = NULL;
 	char *glade_file = NULL;
 	GtkWidget *widget;
-	const char *value;
+	const char *value, *value2;
 
 	g_return_val_if_fail (hash != NULL, NULL);
 
@@ -925,6 +976,55 @@
 	                        xml, (GDestroyNotify) g_object_unref);
 	g_object_set_data (G_OBJECT (dialog), "connection-type", GINT_TO_POINTER (contype));
 
+        widget = glade_xml_get_widget (xml, "verbose_checkbutton");
+        g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (verbose_toggled_cb), xml);
+
+        value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_VERBOSE);
+        if (value && strlen (value)) {
+                widget = glade_xml_get_widget (xml, "verbose_checkbutton");
+                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+
+                widget = glade_xml_get_widget (xml, "verbose_entry");
+                gtk_entry_set_text (GTK_ENTRY (widget), value);
+                gtk_widget_set_sensitive (widget, TRUE);
+
+        } else {
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+
+                widget = glade_xml_get_widget (xml, "verbose_entry");
+                gtk_widget_set_sensitive (widget, FALSE);
+
+	}
+	
+        widget = glade_xml_get_widget (xml, "http_proxy_checkbutton");
+        g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (http_proxy_toggled_cb), xml);
+
+        value = g_hash_table_lookup (hash, NM_OPENVPN_KEY_HTTP_PROXY);
+        value2 = g_hash_table_lookup (hash, NM_OPENVPN_KEY_HTTP_PROXY_PORT);
+        if (value && strlen (value) && value2 && strlen (value2)) {
+                        widget = glade_xml_get_widget (xml, "http_proxy_checkbutton");
+                        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE);
+
+                        widget = glade_xml_get_widget (xml, "http_proxy_entry");
+			gtk_entry_set_text (GTK_ENTRY (widget), value);
+                	gtk_widget_set_sensitive (widget, TRUE);
+
+                        widget = glade_xml_get_widget (xml, "http_proxy_port_entry");
+                        gtk_entry_set_text (GTK_ENTRY (widget), value2);
+                        gtk_widget_set_sensitive (widget, TRUE);
+
+
+        } else {
+                gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE);
+
+                widget = glade_xml_get_widget (xml, "http_proxy_entry");
+                gtk_widget_set_sensitive (widget, FALSE);
+
+                widget = glade_xml_get_widget (xml, "http_proxy_port_entry");
+                gtk_widget_set_sensitive (widget, FALSE);
+
+        }
+
 	widget = glade_xml_get_widget (xml, "port_checkbutton");
 	g_signal_connect (G_OBJECT (widget), "toggled", G_CALLBACK (port_toggled_cb), xml);
 
@@ -1034,6 +1134,7 @@
 	GtkWidget *widget;
 	GladeXML *xml;
 	const char *contype = NULL;
+	const char *value, *value2;
 
 	g_return_val_if_fail (dialog != NULL, NULL);
 	if (error)
@@ -1053,6 +1154,57 @@
 		g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_PORT), g_strdup_printf ("%d", port));
 	}
 
+       /* PROXY SUPPORT */
+
+        widget = glade_xml_get_widget (xml, "http_proxy_checkbutton");
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+
+                       widget = glade_xml_get_widget (xml, "http_proxy_entry");
+                       value = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+                        widget = glade_xml_get_widget (xml, "http_proxy_port_entry");
+                        value2 = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+
+                       if (value && strlen (value) && value2 && strlen (value2)) {
+                                               g_hash_table_insert (hash,
+                                               g_strdup (NM_OPENVPN_KEY_HTTP_PROXY),
+                                               g_strdup (value));
+
+                                                g_hash_table_insert (hash,
+                                                g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_PORT),
+                                                g_strdup (value2));
+
+                       } else {
+                                                g_hash_table_insert (hash,
+                                                g_strdup (NM_OPENVPN_KEY_HTTP_PROXY),
+                                                g_strdup ("no"));
+                       }
+
+                       widget = glade_xml_get_widget (xml, "http_proxy_retry_checkbutton");
+                       if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+                               g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_RETRY), g_strdup ("yes"));
+                       }
+
+			/* not implemented yet */
+                        /*
+			widget = glade_xml_get_widget (xml, "http_proxy_auth_checkbutton");
+                        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+                                g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_AUTH), g_strdup ("yes"));
+                        }
+                        */
+	}
+	/* VERBOSE SUPPORT */
+	widget = glade_xml_get_widget (xml, "verbose_checkbutton");
+        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))) {
+
+                       widget = glade_xml_get_widget (xml, "verbose_entry");
+                       value = (char *) gtk_entry_get_text (GTK_ENTRY (widget));
+			if (value && strlen (value)) {
+                                               g_hash_table_insert (hash,
+                                               g_strdup (NM_OPENVPN_KEY_VERBOSE),
+                                               g_strdup (value));
+			}
+	}
+
 	widget = glade_xml_get_widget (xml, "lzo_checkbutton");
 	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
 		g_hash_table_insert (hash, g_strdup (NM_OPENVPN_KEY_COMP_LZO), g_strdup ("yes"));
diff -ru network-manager-openvpn-0.7~~svn20081015t024626/properties/import-export.c network-manager-openvpn-0.7~~svn20081015t024626.patched/properties/import-export.c
--- network-manager-openvpn-0.7~~svn20081015t024626/properties/import-export.c	2008-08-19 13:59:36.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626.patched/properties/import-export.c	2008-10-16 14:27:06.827079001 +0200
@@ -55,6 +55,11 @@
 #define SECRET_TAG "secret"
 #define AUTH_USER_PASS_TAG "auth-user-pass"
 #define TLS_AUTH_TAG "tls-auth"
+#define PROXY_TAG "http-proxy"
+#define PROXY_RETRY_TAG "http-retry-proxy"
+#define PORT_TAG "port"
+#define VERBOSE_TAG "verb"
+
 
 static gboolean
 handle_path_item (const char *line,
@@ -221,6 +226,79 @@
 			continue;
 		}
 
+                if (!strncmp (*line, PROXY_RETRY_TAG, strlen (PROXY_RETRY_TAG))) {
+                        g_hash_table_insert (s_vpn->data,
+                                             g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_RETRY),
+                                             g_strdup ("yes"));
+                        continue;
+                }
+
+
+                if (!strncmp (*line, PROXY_TAG, strlen (PROXY_TAG))) {
+                        items = get_args (*line + strlen (PROXY_TAG));
+                        if (!items)
+                                continue;
+
+                        if (g_strv_length (items) >= 1) {
+                                g_hash_table_insert (s_vpn->data,
+                                                     g_strdup (NM_OPENVPN_KEY_HTTP_PROXY),
+                                                     g_strdup (items[0]));
+                                if (g_strv_length (items) >= 2) {
+                                        glong port;
+
+                                        errno = 0;
+                                        port = strtol (items[1], NULL, 10);
+                                        if ((errno == 0) && (port > 0) && (port < 65536)) {
+                                                g_hash_table_insert (s_vpn->data,
+                                                                     g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_PORT),
+                                                                  // g_strdup (items[1]));
+                                                                     g_strdup_printf ("%d", (guint32) port));
+					if (g_strv_length (items) >= 3) {
+						g_hash_table_insert (s_vpn->data,
+			                                             g_strdup (NM_OPENVPN_KEY_HTTP_PROXY_AUTH),
+                        			                     g_strdup ("yes"));
+						/*save http proxy usename/password*/
+					}
+                                        } else
+                                                g_warning ("%s: invalid http proxy port in option '%s'", __func__, *line);
+                                }
+                        }
+
+                        g_strfreev (items);
+                        continue;
+                }
+
+                if (!strncmp (*line, PORT_TAG, strlen (PORT_TAG))) {
+                        items = get_args (*line + strlen (PORT_TAG));
+                        if (!items)
+                                continue;
+
+                        if (g_strv_length (items)) {
+                                g_hash_table_insert (s_vpn->data,
+                                                     g_strdup (NM_OPENVPN_KEY_PORT),
+                                                     g_strdup (items[0]));
+                        }
+                        g_strfreev (items);
+                        continue;
+
+                }
+
+                if (!strncmp (*line, VERBOSE_TAG, strlen (VERBOSE_TAG))) {
+                        items = get_args (*line + strlen (VERBOSE_TAG));
+                        if (!items)
+                                continue;
+
+                        if (g_strv_length (items)) {
+                                g_hash_table_insert (s_vpn->data,
+                                                     g_strdup (NM_OPENVPN_KEY_VERBOSE),
+                                                     g_strdup (items[0]));
+                        }
+                        g_strfreev (items);
+                        continue;
+
+                }
+
+
 		if (!strncmp (*line, REMOTE_TAG, strlen (REMOTE_TAG))) {
 			items = get_args (*line + strlen (REMOTE_TAG));
 			if (!items)
diff -ru network-manager-openvpn-0.7~~svn20081015t024626/properties/nm-openvpn-dialog.glade network-manager-openvpn-0.7~~svn20081015t024626.patched/properties/nm-openvpn-dialog.glade
--- network-manager-openvpn-0.7~~svn20081015t024626/properties/nm-openvpn-dialog.glade	2008-10-02 21:41:09.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626.patched/properties/nm-openvpn-dialog.glade	2008-10-16 13:22:10.928876435 +0200
@@ -893,6 +893,170 @@
                     <property name="expand">False</property>
                   </packing>
                 </child>
+              <child>
+                <widget class="GtkHBox" id="hbox3">
+                  <property name="visible">True</property>
+                  <property name="homogeneous">False</property>
+                  <property name="spacing">6</property>
+
+                  <child>
+                    <widget class="GtkCheckButton" id="http_proxy_checkbutton">
+                      <property name="visible">True</property>
+                      <property name="can_focus">True</property>
+                      <property name="label" translatable="yes">Use _http proxy:</property>
+                      <property name="use_underline">True</property>
+                      <property name="relief">GTK_RELIEF_NORMAL</property>
+                      <property name="focus_on_click">True</property>
+                      <property name="active">False</property>
+                      <property name="inconsistent">False</property>
+                      <property name="draw_indicator">True</property>
+                    </widget>
+                    <packing>
+                      <property name="padding">0</property>
+                      <property name="expand">False</property>
+                      <property name="fill">True</property>
+                    </packing>
+                  </child>
+
+                  <child>
+                    <widget class="GtkEntry" id="http_proxy_entry">
+                      <property name="width_request">110</property>
+                      <property name="visible">True</property>
+                      <property name="can_focus">True</property>
+                      <property name="editable">True</property>
+                      <property name="visibility">True</property>
+                      <property name="max_length">0</property>
+                      <property name="text" translatable="yes"></property>
+                      <property name="has_frame">True</property>
+                      <property name="invisible_char">â??</property>
+                      <property name="activates_default">False</property>
+                    </widget>
+                    <packing>
+                      <property name="padding">0</property>
+                      <property name="expand">False</property>
+                      <property name="fill">False</property>
+                    </packing>
+                  </child>
+
+                  <child>
+                    <widget class="GtkLabel" id="label31">
+                      <property name="visible">True</property>
+                      <property name="label" translatable="yes">:</property>
+                      <property name="use_underline">True</property>
+                      <property name="use_markup">True</property>
+                      <property name="justify">GTK_JUSTIFY_LEFT</property>
+                      <property name="wrap">True</property>
+                      <property name="selectable">False</property>
+                      <property name="xalign">0</property>
+                      <property name="yalign">0.5</property>
+                      <property name="xpad">0</property>
+                      <property name="ypad">0</property>
+                      <property name="mnemonic_widget">http_proxy_port_entry</property>
+                      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                      <property name="width_chars">-1</property>
+                      <property name="single_line_mode">False</property>
+                      <property name="angle">0</property>
+                    </widget>
+                    <packing>
+                      <property name="padding">0</property>
+                      <property name="expand">False</property>
+                      <property name="fill">False</property>
+                    </packing>
+                  </child>
+
+                  <child>
+                    <widget class="GtkLabel" id="label31">
+                      <property name="visible">True</property>
+                      <property name="label" translatable="yes">:</property>
+                      <property name="use_underline">True</property>
+                      <property name="use_markup">True</property>
+                      <property name="justify">GTK_JUSTIFY_LEFT</property>
+                      <property name="wrap">True</property>
+                      <property name="selectable">False</property>
+                      <property name="xalign">0</property>
+                      <property name="yalign">0.5</property>
+                      <property name="xpad">0</property>
+                      <property name="ypad">0</property>
+                      <property name="mnemonic_widget">http_proxy_port_entry</property>
+                      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+                      <property name="width_chars">-1</property>
+                      <property name="single_line_mode">False</property>
+                      <property name="angle">0</property>
+                    </widget>
+                    <packing>
+                      <property name="padding">0</property>
+                      <property name="expand">False</property>
+                      <property name="fill">False</property>
+                    </packing>
+                  </child>
+
+                  <child>
+                    <widget class="GtkEntry" id="http_proxy_port_entry">
+                      <property name="width_request">40</property>
+                      <property name="visible">True</property>
+                      <property name="can_focus">True</property>
+                      <property name="editable">True</property>
+                      <property name="visibility">True</property>
+                      <property name="max_length">4</property>
+                      <property name="text" translatable="yes"></property>
+                      <property name="has_frame">True</property>
+                      <property name="invisible_char">â??</property>
+                      <property name="activates_default">False</property>
+                    </widget>
+                    <packing>
+                      <property name="padding">0</property>
+                      <property name="expand">False</property>
+                      <property name="fill">True</property>
+                    </packing>
+                  </child>
+                </widget>
+                <packing>
+                  <property name="padding">0</property>
+                  <property name="expand">False</property>
+                  <property name="fill">True</property>
+                </packing>
+              </child>
+
+              <child>
+                <widget class="GtkCheckButton" id="http_proxy_retry_checkbutton">
+                  <property name="visible">True</property>
+                  <property name="sensitive">False</property>
+                  <property name="can_focus">True</property>
+                  <property name="label" translatable="yes">Use _http proxy retry</property>
+                  <property name="use_underline">True</property>
+                  <property name="relief">GTK_RELIEF_NORMAL</property>
+                  <property name="focus_on_click">True</property>
+                  <property name="active">True</property>
+                  <property name="inconsistent">False</property>
+                  <property name="draw_indicator">True</property>
+                </widget>
+                <packing>
+                  <property name="padding">0</property>
+                  <property name="expand">False</property>
+                  <property name="fill">False</property>
+                </packing>
+              </child>
+
+              <child>
+                <widget class="GtkCheckButton" id="http_proxy_auth_checkbutton">
+                  <property name="visible">True</property>
+                  <property name="sensitive">False</property>
+                  <property name="can_focus">True</property>
+                  <property name="label" translatable="yes">Use http proxy _authentication</property>
+                  <property name="use_underline">True</property>
+                  <property name="relief">GTK_RELIEF_NORMAL</property>
+                  <property name="focus_on_click">True</property>
+                  <property name="active">False</property>
+                  <property name="inconsistent">False</property>
+                  <property name="draw_indicator">True</property>
+                </widget>
+                <packing>
+                  <property name="padding">0</property>
+                  <property name="expand">False</property>
+                  <property name="fill">False</property>
+                </packing>
+              </child>
+		
                 <child>
                   <widget class="GtkCheckButton" id="lzo_checkbutton">
                     <property name="visible">True</property>
@@ -935,6 +1099,58 @@
                     <property name="position">3</property>
                   </packing>
                 </child>
+              <child>
+                <widget class="GtkHBox" id="hbox4">
+                  <property name="visible">True</property>
+                  <property name="homogeneous">False</property>
+                  <property name="spacing">6</property>
+
+                  <child>
+                    <widget class="GtkCheckButton" id="verbose_checkbutton">
+                      <property name="visible">True</property>
+                      <property name="can_focus">True</property>
+                      <property name="label" translatable="yes">Be verbose:</property>
+                      <property name="use_underline">True</property>
+                      <property name="relief">GTK_RELIEF_NORMAL</property>
+                      <property name="focus_on_click">True</property>
+                      <property name="active">False</property>
+                      <property name="inconsistent">False</property>
+                      <property name="draw_indicator">True</property>
+                    </widget>
+                    <packing>
+                      <property name="padding">0</property>
+                      <property name="expand">False</property>
+                      <property name="fill">True</property>
+                    </packing>
+                  </child>
+
+                  <child>
+                    <widget class="GtkEntry" id="verbose_entry">
+                      <property name="width_request">110</property>
+                      <property name="visible">True</property>
+                      <property name="can_focus">True</property>
+                      <property name="editable">True</property>
+                      <property name="visibility">True</property>
+                      <property name="max_length">0</property>
+                      <property name="text" translatable="yes"></property>
+                      <property name="has_frame">True</property>
+                      <property name="invisible_char">â??</property>
+                      <property name="activates_default">False</property>
+                    </widget>
+                    <packing>
+                      <property name="padding">0</property>
+                      <property name="expand">False</property>
+                      <property name="fill">False</property>
+                    </packing>
+                  </child>
+                </widget>
+                <packing>
+                  <property name="padding">0</property>
+                  <property name="expand">False</property>
+                  <property name="fill">False</property>
+                </packing>
+              </child>
+
               </widget>
             </child>
             <child>
diff -ru network-manager-openvpn-0.7~~svn20081015t024626/src/nm-openvpn-service.c network-manager-openvpn-0.7~~svn20081015t024626.patched/src/nm-openvpn-service.c
--- network-manager-openvpn-0.7~~svn20081015t024626/src/nm-openvpn-service.c	2008-10-02 21:41:09.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626.patched/src/nm-openvpn-service.c	2008-10-16 14:20:41.721106873 +0200
@@ -103,6 +103,11 @@
 	{ NM_OPENVPN_KEY_PASSWORD,             G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_CERTPASS,             G_TYPE_STRING, 0, 0, FALSE },
 	{ NM_OPENVPN_KEY_NOSECRET,             G_TYPE_STRING, 0, 0, FALSE },
+	{ NM_OPENVPN_KEY_HTTP_PROXY,           G_TYPE_STRING, 0, 0, FALSE },
+	{ NM_OPENVPN_KEY_HTTP_PROXY_PORT,      G_TYPE_STRING, 0, 65535, FALSE },
+	{ NM_OPENVPN_KEY_HTTP_PROXY_RETRY,     G_TYPE_BOOLEAN, 0, 0, FALSE },
+	{ NM_OPENVPN_KEY_HTTP_PROXY_AUTH,      G_TYPE_BOOLEAN, 0, 0, FALSE },
+	{ NM_OPENVPN_KEY_VERBOSE,      G_TYPE_STRING, 0, 255, FALSE },
 	{ NULL,                                G_TYPE_NONE, FALSE }
 };
 
@@ -549,7 +554,7 @@
                                  GError **error)
 {
 	NMOpenvpnPluginPrivate *priv = NM_OPENVPN_PLUGIN_GET_PRIVATE (plugin);
-	const char *openvpn_binary, *connection_type, *tmp;
+	const char *openvpn_binary, *connection_type, *tmp, *tmp2;
 	GPtrArray *args;
 	GSource *openvpn_watch;
 	GPid pid;
@@ -584,6 +589,19 @@
 		add_openvpn_arg (args, tmp);
 	}
 
+        tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_HTTP_PROXY);
+	tmp2 = g_hash_table_lookup (properties, NM_OPENVPN_KEY_HTTP_PROXY_PORT);
+        if (tmp && strlen (tmp) && tmp2 && strlen (tmp2)) {
+                add_openvpn_arg (args, "--http-proxy");
+                add_openvpn_arg (args, tmp);
+                add_openvpn_arg (args, tmp2);
+	}
+
+        tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_HTTP_PROXY_RETRY);
+	if (tmp && strlen (tmp)){
+                add_openvpn_arg (args, "--http-proxy-retry");
+        }
+
 	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_COMP_LZO);
 	if (tmp && !strcmp (tmp, "yes"))
 		add_openvpn_arg (args, "--comp-lzo");
@@ -645,6 +663,12 @@
 	/* Syslog */
 	add_openvpn_arg (args, "--syslog");
 	add_openvpn_arg (args, "nm-openvpn");
+	
+	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_VERBOSE);
+        if (tmp && strlen (tmp)) {
+                add_openvpn_arg (args, "--verb");
+                add_openvpn_arg (args, tmp);
+        }	
 
 	/* Punch script security in the face; this option was added to OpenVPN 2.1-rc9
 	 * and defaults to disallowing any scripts, a behavior change from previous
diff -ru network-manager-openvpn-0.7~~svn20081015t024626/src/nm-openvpn-service.h network-manager-openvpn-0.7~~svn20081015t024626.patched/src/nm-openvpn-service.h
--- network-manager-openvpn-0.7~~svn20081015t024626/src/nm-openvpn-service.h	2008-09-08 21:55:33.000000000 +0200
+++ network-manager-openvpn-0.7~~svn20081015t024626.patched/src/nm-openvpn-service.h	2008-10-16 14:18:09.048910405 +0200
@@ -55,6 +55,11 @@
 #define NM_OPENVPN_KEY_TA "ta"
 #define NM_OPENVPN_KEY_TA_DIR "ta-dir"
 #define NM_OPENVPN_KEY_USERNAME "username"
+#define NM_OPENVPN_KEY_HTTP_PROXY "http-proxy"
+#define NM_OPENVPN_KEY_HTTP_PROXY_PORT "http-proxy-port"
+#define NM_OPENVPN_KEY_HTTP_PROXY_RETRY "http-proxy-retry"
+#define NM_OPENVPN_KEY_HTTP_PROXY_AUTH "http-proxy-auth"
+#define NM_OPENVPN_KEY_VERBOSE "verb"
 
 #define NM_OPENVPN_KEY_PASSWORD "password"
 #define NM_OPENVPN_KEY_CERTPASS "cert-pass"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]