openvpn fixes against svn 3138



Attached is a patch with a number of fixes for openvpn against svn revision 3138. I'm still having some crashes creating/editing properties, but can consistently create new working settings by running /usr/bin/nm-vpn-properties directly. Connecting is working fine for me (X509 with password, TA and UDP).

I'm going to continue poking away at the property issues and see if I can eliminate the remaining issues.

-casey
Index: vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c
===================================================================
--- vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c	(revision 3138)
+++ vpn-daemons/openvpn/src/nm-openvpn-service-openvpn-helper.c	(working copy)
@@ -212,7 +212,7 @@
 		helper_failed (connection, "Tunnel Device");
 
 	/* IP address */
-	val = addr_to_gvalue (getenv ("ipconfig_local"));
+	val = addr_to_gvalue (getenv ("ifconfig_local"));
 	if (val)
 		g_hash_table_insert (config, NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS, val);
 	else
Index: vpn-daemons/openvpn/src/nm-openvpn-service.c
===================================================================
--- vpn-daemons/openvpn/src/nm-openvpn-service.c	(revision 3138)
+++ vpn-daemons/openvpn/src/nm-openvpn-service.c	(working copy)
@@ -99,6 +99,8 @@
 	{ NM_OPENVPN_KEY_TA,              G_TYPE_STRING },
 	{ NM_OPENVPN_KEY_TA_DIR,          G_TYPE_STRING },
 	{ NM_OPENVPN_KEY_USERNAME,        G_TYPE_STRING },
+	{ NM_OPENVPN_KEY_PASSWORD,        G_TYPE_STRING },
+	{ NM_OPENVPN_KEY_CERTPASS,        G_TYPE_STRING },
 	{ NULL,                           G_TYPE_NONE }
 };
 
@@ -386,7 +388,7 @@
 	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_REMOTE);
 	if (tmp) {
 		g_ptr_array_add (openvpn_argv, (gpointer) "--remote");
-		g_ptr_array_add (openvpn_argv, tmp);
+		g_ptr_array_add (openvpn_argv, (gpointer) g_value_get_string ((GValue *) tmp));
 	}
 
 	tmp = g_hash_table_lookup (properties, NM_OPENVPN_KEY_COMP_LZO);
@@ -635,7 +637,7 @@
 				   NM_VPN_PLUGIN_ERROR,
 				   NM_VPN_PLUGIN_ERROR_LAUNCH_FAILED,
 				   "%s",
-				   "Could not start vpnc binary.");
+				   "Could not start openvpn binary.");
 		goto out;
 	}
 
Index: vpn-daemons/openvpn/properties/nm-openvpn.c
===================================================================
--- vpn-daemons/openvpn/properties/nm-openvpn.c	(revision 3138)
+++ vpn-daemons/openvpn/properties/nm-openvpn.c	(working copy)
@@ -331,7 +331,7 @@
 		else
 			dir = "";
 
-		g_hash_table_insert (properties, NM_OPENVPN_KEY_TA, str_to_gvalue (dir));
+		g_hash_table_insert (properties, NM_OPENVPN_KEY_TA_DIR, str_to_gvalue (dir));
 	}
 }
 
@@ -1637,7 +1637,37 @@
 
 	impl->last_fc_dir = NULL;
 
+	/* advanced settings */
 	glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-openvpn-dialog.glade");
+	impl->xml = glade_xml_new (glade_file, "nm-openvpn-advanced-dialog", GETTEXT_PACKAGE);
+	g_free( glade_file );
+	if (impl->xml == NULL)
+		goto error;
+
+	impl->advanced = GTK_DIALOG (glade_xml_get_widget(impl->xml, "nm-openvpn-advanced-dialog"));
+
+	impl->w_port                  = GTK_ENTRY (glade_xml_get_widget (impl->xml, "openvpn-port"));
+	impl->w_use_routes             = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-routes"));
+	impl->w_routes                 = GTK_ENTRY (glade_xml_get_widget (impl->xml, "openvpn-routes"));
+
+	impl->w_use_lzo                = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-lzo"));
+	impl->w_use_tap                = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-tap"));
+	impl->w_use_tcp                = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-tcp"));
+
+	impl->w_use_cipher             = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-cipher"));
+	impl->w_cipher                 = GTK_COMBO_BOX( glade_xml_get_widget( impl->xml, "openvpn-cipher" ) );
+	populate_cipher(impl->w_cipher);
+
+	impl->w_use_ta                 = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-ta"));
+	impl->w_ta                     = GTK_ENTRY( glade_xml_get_widget( impl->xml, "openvpn-ta" ) );
+	impl->w_button_ta              = GTK_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-but-ta" ) );
+	impl->w_ta_dir_label           = GTK_LABEL( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-label" ) );
+	impl->w_ta_dir_none            = GTK_RADIO_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-none" ) );
+	impl->w_ta_dir_zero            = GTK_RADIO_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-zero" ) );
+	impl->w_ta_dir_one             = GTK_RADIO_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-one" ) );
+
+	/* normal settings */
+	glade_file = g_strdup_printf ("%s/%s", GLADEDIR, "nm-openvpn-dialog.glade");
 	impl->xml = glade_xml_new (glade_file, "nm-openvpn-widget", GETTEXT_PACKAGE);
 	g_free( glade_file );
 	if (impl->xml == NULL)
@@ -1646,18 +1676,13 @@
 	impl->widget = glade_xml_get_widget(impl->xml, "nm-openvpn-widget");
 	g_object_ref_sink (impl->widget);
 
-	impl->advanced = GTK_DIALOG (glade_xml_get_widget(impl->xml, "nm-openvpn-advanced-dialog"));
-
 	impl->w_connection_name        = GTK_ENTRY (glade_xml_get_widget (impl->xml, "openvpn-connection-name"));
 	impl->w_remote                = GTK_ENTRY (glade_xml_get_widget (impl->xml, "openvpn-remote"));
-	impl->w_port                  = GTK_ENTRY (glade_xml_get_widget (impl->xml, "openvpn-port"));
-	impl->w_use_routes             = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-routes"));
-	impl->w_routes                 = GTK_ENTRY (glade_xml_get_widget (impl->xml, "openvpn-routes"));
 	impl->w_opt_info_expander      = GTK_EXPANDER (glade_xml_get_widget (impl->xml,
 														    "openvpn-optional-information-expander"));
 	impl->w_advanced_button          = GTK_BUTTON (glade_xml_get_widget (impl->xml,
 														    "openvpn-advanced-button"));
-
+	
 	impl->w_import_button          = GTK_BUTTON (glade_xml_get_widget (impl->xml,
 														  "openvpn-import-button"));
 
@@ -1669,10 +1694,6 @@
 	impl->w_button_cert            = GTK_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-but-cert" ) );
 	impl->w_button_key             = GTK_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-but-key" ) );
 
-	impl->w_use_lzo                = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-lzo"));
-	impl->w_use_tap                = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-tap"));
-	impl->w_use_tcp                = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-tcp"));
-
 	impl->w_connection_type        = GTK_COMBO_BOX (glade_xml_get_widget (impl->xml, "openvpn-connection-type"));
 	impl->w_settings_notebook      = GTK_NOTEBOOK (glade_xml_get_widget (impl->xml, "openvpn-settings"));
 
@@ -1694,18 +1715,6 @@
 	impl->w_button_x509userpass_cert            = GTK_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-x509userpass-but-cert" ) );
 	impl->w_button_x509userpass_key             = GTK_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-x509userpass-but-key" ) );
 
-	impl->w_use_cipher             = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-cipher"));
-	impl->w_cipher                 = GTK_COMBO_BOX( glade_xml_get_widget( impl->xml, "openvpn-cipher" ) );
-	populate_cipher(impl->w_cipher);
-
-	impl->w_use_ta                 = GTK_CHECK_BUTTON (glade_xml_get_widget (impl->xml, "openvpn-use-ta"));
-	impl->w_ta                     = GTK_ENTRY( glade_xml_get_widget( impl->xml, "openvpn-ta" ) );
-	impl->w_button_ta              = GTK_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-but-ta" ) );
-	impl->w_ta_dir_label           = GTK_LABEL( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-label" ) );
-	impl->w_ta_dir_none            = GTK_RADIO_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-none" ) );
-	impl->w_ta_dir_zero            = GTK_RADIO_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-zero" ) );
-	impl->w_ta_dir_one             = GTK_RADIO_BUTTON( glade_xml_get_widget( impl->xml, "openvpn-ta-dir-one" ) );
-
 	impl->callback                 = NULL;
 
 
Index: vpn-daemons/openvpn/auth-dialog/main.c
===================================================================
--- vpn-daemons/openvpn/auth-dialog/main.c	(revision 3138)
+++ vpn-daemons/openvpn/auth-dialog/main.c	(working copy)
@@ -264,7 +264,7 @@
 		return FALSE;
 
 	for (iter = conf_list; iter; iter = iter->next) {
-		key = g_strconcat ((char *) iter->data, "connection/type", NULL);
+		key = g_strconcat ((char *) iter->data, "/connection/type", NULL);
 		str = gconf_client_get_string (gconf_client, key, NULL);
 		g_free (key);
 
@@ -273,7 +273,7 @@
 			continue;
 		}
 
-		key = g_strconcat ((char *) iter->data, "connection/name", NULL);
+		key = g_strconcat ((char *) iter->data, "/connection/id", NULL);
 		str = gconf_client_get_string (gconf_client, key, NULL);
 		g_free (key);
 
@@ -293,7 +293,7 @@
 	if (connection_path) {
 		int connection_type;
 
-		key = g_strconcat (connection_path, "vpn-properties/connection-type", NULL);
+		key = g_strconcat (connection_path, "/vpn-properties/connection-type", NULL);
 		connection_type = gconf_client_get_int (gconf_client, key, NULL);
 		g_free (key);
 
@@ -304,7 +304,7 @@
 		case NM_OPENVPN_CONTYPE_X509:
 			success = TRUE;
 
-			key = g_strconcat (connection_path, "vpn-properties/", NM_OPENVPN_KEY_KEY, NULL);
+			key = g_strconcat (connection_path, "/vpn-properties/", NM_OPENVPN_KEY_KEY, NULL);
 			str = gconf_client_get_string (gconf_client, key, NULL);
 			g_free (key);
 			if (str) {
@@ -324,9 +324,6 @@
 			break;
 		}
 
-		info->need_password = TRUE;
-		info->need_certpass = TRUE;
-
 		g_free (connection_path);
 	}
 
@@ -394,9 +391,9 @@
 
 	if (get_passwords (&info, retry)) {
 		if (info.need_password)
-			printf ("%s\n", info.password);
+			printf ("%s\n%s\n", NM_OPENVPN_KEY_PASSWORD, info.password);
 		if (info.need_certpass)
-			printf ("%s\n", info.certpass);
+			printf ("%s\n%s\n", NM_OPENVPN_KEY_CERTPASS, info.certpass);
 	}
 	printf ("\n\n");
 	/* for good measure, flush stdout since Kansas is going Bye-Bye */


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