NetworkManager r4224 - in trunk/vpn-daemons/openvpn: . properties



Author: dcbw
Date: Mon Oct 27 03:09:18 2008
New Revision: 4224
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4224&view=rev

Log:
2008-10-26  Dan Williams  <dcbw redhat com>

	* properties/auth-helpers.c
	  properties/import-export.c
	  properties/nm-openvpn.c
		- Update for setting accessor changes



Modified:
   trunk/vpn-daemons/openvpn/ChangeLog
   trunk/vpn-daemons/openvpn/properties/auth-helpers.c
   trunk/vpn-daemons/openvpn/properties/import-export.c
   trunk/vpn-daemons/openvpn/properties/nm-openvpn.c

Modified: trunk/vpn-daemons/openvpn/properties/auth-helpers.c
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/auth-helpers.c	(original)
+++ trunk/vpn-daemons/openvpn/properties/auth-helpers.c	Mon Oct 27 03:09:18 2008
@@ -85,9 +85,9 @@
 		gboolean unused;
 
 		s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
-		password = keyring_helpers_lookup_secret (s_con->uuid,
-												  priv_key_password ? NM_OPENVPN_KEY_CERTPASS : NM_OPENVPN_KEY_PASSWORD,
-												  &unused);
+		password = keyring_helpers_lookup_secret (nm_setting_connection_get_uuid (s_con),
+		                                          priv_key_password ? NM_OPENVPN_KEY_CERTPASS : NM_OPENVPN_KEY_PASSWORD,
+		                                          &unused);
 	}
 
 	if (password) {

Modified: trunk/vpn-daemons/openvpn/properties/import-export.c
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/import-export.c	(original)
+++ trunk/vpn-daemons/openvpn/properties/import-export.c	Mon Oct 27 03:09:18 2008
@@ -162,6 +162,7 @@
 	gboolean have_client = FALSE, have_remote = FALSE;
 	gboolean have_pass = FALSE, have_sk = FALSE;
 	const char *ctype = NULL;
+	const char *basename;
 
 	connection = nm_connection_new ();
 	s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
@@ -170,10 +171,12 @@
 	s_vpn = NM_SETTING_VPN (nm_setting_vpn_new ());
 	s_vpn->service_type = g_strdup (NM_DBUS_SERVICE_OPENVPN);
 
-	s_con->id = g_path_get_basename (path);
-	last_dot = strrchr (s_con->id, '.');
+	basename = g_path_get_basename (path);
+	last_dot = strrchr (basename, '.');
 	if (last_dot)
 		*last_dot = '\0';
+	g_object_set (s_con, NM_SETTING_CONNECTION_ID, basename, NULL);
+	g_free (basename);
 
 	for (line = lines; *line; line++) {
 		char *comment, **items, *leftover = NULL;

Modified: trunk/vpn-daemons/openvpn/properties/nm-openvpn.c
==============================================================================
--- trunk/vpn-daemons/openvpn/properties/nm-openvpn.c	(original)
+++ trunk/vpn-daemons/openvpn/properties/nm-openvpn.c	Mon Oct 27 03:09:18 2008
@@ -466,7 +466,7 @@
 {
 	OpenvpnPluginUiWidgetPrivate *priv = OPENVPN_PLUGIN_UI_WIDGET_GET_PRIVATE (iface);
 	NMSettingConnection *s_con;
-	const char *auth_type;
+	const char *auth_type, *uuid, *id;
 	gboolean ret = FALSE;
 
 	s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
@@ -478,9 +478,12 @@
 		return FALSE;
 	}
 
+	id = nm_setting_connection_get_id (s_con);
+	uuid = nm_setting_connection_get_uuid (s_con);
+
 	auth_type = get_auth_type (priv->xml);
 	if (auth_type)
-		ret = auth_widget_save_secrets (priv->xml, auth_type, s_con->uuid, s_con->id);
+		ret = auth_widget_save_secrets (priv->xml, auth_type, uuid, id);
 
 	if (!ret)
 		g_set_error (error, OPENVPN_PLUGIN_UI_ERROR,
@@ -649,14 +652,17 @@
 get_suggested_name (NMVpnPluginUiInterface *iface, NMConnection *connection)
 {
 	NMSettingConnection *s_con;
+	const char *id;
 
 	g_return_val_if_fail (connection != NULL, NULL);
 
 	s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
 	g_return_val_if_fail (s_con != NULL, NULL);
-	g_return_val_if_fail (s_con->id != NULL, NULL);
 
-	return g_strdup_printf ("%s (openvpn).conf", s_con->id);
+	id = nm_setting_connection_get_id (s_con);
+	g_return_val_if_fail (id != NULL, NULL);
+
+	return g_strdup_printf ("%s (openvpn).conf", id);
 }
 
 static guint32
@@ -671,6 +677,7 @@
                    GError **error)
 {
 	NMSettingConnection *s_con;
+	const char *uuid;
 
 	/* Remove any secrets in the keyring associated with this connection's UUID */
 	s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
@@ -682,8 +689,9 @@
 		return FALSE;
 	}
 
-	keyring_helpers_delete_secret (s_con->uuid, NM_OPENVPN_KEY_PASSWORD);
-	keyring_helpers_delete_secret (s_con->uuid, NM_OPENVPN_KEY_CERTPASS);
+	uuid = nm_setting_connection_get_uuid (s_con);
+	keyring_helpers_delete_secret (uuid, NM_OPENVPN_KEY_PASSWORD);
+	keyring_helpers_delete_secret (uuid, NM_OPENVPN_KEY_CERTPASS);
 
 	return TRUE;
 }



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