network-manager-applet r601 - in trunk: . src src/gconf-helpers src/utils src/wireless-security



Author: dcbw
Date: Mon Mar 17 19:52:49 2008
New Revision: 601
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=601&view=rev

Log:
2008-03-17  Dan Williams  <dcbw redhat com>

	* src/applet-dialogs.c
		- (set_eap_info_label, info_dialog_update): handle spit-out 802.1x

	* src/gconf-helpers/gconf-upgrade.c
	  src/gconf-helpers/gconf-upgrade.h
		- (nm_gconf_read_0_6_eap_settings): copy to 802.1x, not wireless-security
		- (nm_gconf_read_0_6_leap_settings): fixup for new LEAP layout
		- (nm_gconf_read_0_6_wireless_connection): handle split-out 802.1x
		- (unset_ws_key, copy_stringlist_to_8021x, copy_string_to_8021x,
		   copy_bool_to_8021x): new functions
		- (try_convert_leap): convert a pre-split LEAP config
		- (copy_keyring_to_8021x): convert pre-split keyring items
		- (nm_gconf_migrate_0_7_wireless_security): split up wireless-security
			into 802.1x and wireless-security

	* src/gconf-helpers/gconf-helpers.c
	  src/gconf-helpers/gconf-helpers.h
		- (nm_gconf_get_all_connections): update GConf for split 802.1x
		- (read_one_setting_value_from_gconf,
		   read_applet_private_values_from_gconf,
		   copy_one_setting_value_to_gconf,
		   write_ignore_ca_cert_helper, write_one_private_string_value,
		   write_one_password, write_applet_private_values_to_gconf): update for
			split 802.1x
		- (nm_gconf_add_keyring_item): export

	* src/utils/utils.c
		- (utils_fill_connection_certs, utils_clear_filled_connection_certs):
			use 802.1x setting, not wireless-security

	* src/applet-device-wireless.c
		- (get_security_for_ap, wireless_new_auto_connection): handle split 802.1x
		- (add_one_setting): new function; add one setting to returned hash for
			GetSecrets response
		- (get_secrets_dialog_response_cb): update for returning multiple
			settings in GetSecrets response

	* src/wireless-security/eap-method-leap.c
	  src/wireless-security/eap-method-peap.c
	  src/wireless-security/eap-method-ttls.c
	  src/wireless-security/ws-leap.c
	  src/wireless-security/eap-method-simple.c
	  src/wireless-security/eap-method-tls.c
		- Update for 802.1x split; these don't need to know _anything_ about
			wireless-security

	* src/wireless-security/wireless-security.c
		- (ws_802_1x_auth_combo_init, ws_802_1x_fill_connection): 802.1x, not
			wireless-security

	* src/applet-dbus-settings.c
		- (get_one_private_key, extract_secrets,
		   applet_exported_connection_get_secrets): update for 802.1x and
			new return signature of GetSecrets



Modified:
   trunk/ChangeLog
   trunk/src/applet-dbus-settings.c
   trunk/src/applet-device-wireless.c
   trunk/src/applet-dialogs.c
   trunk/src/gconf-helpers/gconf-helpers.c
   trunk/src/gconf-helpers/gconf-helpers.h
   trunk/src/gconf-helpers/gconf-upgrade.c
   trunk/src/gconf-helpers/gconf-upgrade.h
   trunk/src/utils/utils.c
   trunk/src/wireless-security/eap-method-leap.c
   trunk/src/wireless-security/eap-method-peap.c
   trunk/src/wireless-security/eap-method-simple.c
   trunk/src/wireless-security/eap-method-tls.c
   trunk/src/wireless-security/eap-method-ttls.c
   trunk/src/wireless-security/wireless-security.c
   trunk/src/wireless-security/ws-leap.c

Modified: trunk/src/applet-dbus-settings.c
==============================================================================
--- trunk/src/applet-dbus-settings.c	(original)
+++ trunk/src/applet-dbus-settings.c	Mon Mar 17 19:52:49 2008
@@ -25,7 +25,8 @@
 #include <nm-connection.h>
 #include <nm-setting-connection.h>
 #include <nm-setting-vpn.h>
-#include <nm-setting-wireless.h>
+#include <nm-setting-wireless-security.h>
+#include <nm-setting-8021x.h>
 
 #include "applet.h"
 #include "applet-dbus-settings.h"
@@ -1093,10 +1094,10 @@
 
 	if (!strcmp (tag, NMA_PRIVATE_KEY_PASSWORD_TAG)) {
 		privkey_tag = NMA_PATH_PRIVATE_KEY_TAG;
-		secret_name = NM_SETTING_WIRELESS_SECURITY_PRIVATE_KEY;
+		secret_name = NM_SETTING_802_1X_PRIVATE_KEY;
 	} else if (!strcmp (tag, NMA_PHASE2_PRIVATE_KEY_PASSWORD_TAG)) {
 		privkey_tag = NMA_PATH_PHASE2_PRIVATE_KEY_TAG;
-		secret_name = NM_SETTING_WIRELESS_SECURITY_PHASE2_PRIVATE_KEY;
+		secret_name = NM_SETTING_802_1X_PHASE2_PRIVATE_KEY;
 	} else {
 		g_warning ("Unknown private key password type '%s'", tag);
 		return FALSE;
@@ -1165,7 +1166,7 @@
 			break;
 		}
 
-		if (   !strcmp (setting_name, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)
+		if (   !strcmp (setting_name, NM_SETTING_802_1X_SETTING_NAME)
 		    && (   !strcmp (key_name, NMA_PRIVATE_KEY_PASSWORD_TAG)
 		        || !strcmp (key_name, NMA_PHASE2_PRIVATE_KEY_PASSWORD_TAG))) {
 			/* Private key passwords aren't passed to NM, they are used
@@ -1218,6 +1219,7 @@
 	AppletExportedConnection *exported = APPLET_EXPORTED_CONNECTION (parent);
 	NMConnection *connection;
 	GError *error = NULL;
+	GHashTable *settings = NULL;
 	GHashTable *secrets = NULL;
 	GList *found_list = NULL;
 	GnomeKeyringResult ret;
@@ -1280,6 +1282,13 @@
 		goto get_secrets;
 	}
 
+	/* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that
+	 * will contain all the individual settings hashes.
+	 */
+	settings = g_hash_table_new_full (g_str_hash, g_str_equal,
+	                                  g_free, (GDestroyNotify) g_hash_table_destroy);
+
+	/* Inner a{sv} hash of one setting */
 	secrets = extract_secrets (connection, found_list, s_con->id, setting_name, &error);
 	if (error) {
 		g_warning (error->message);
@@ -1291,11 +1300,13 @@
 			g_warning ("%s.%d - Secrets were found for setting '%s' but none"
 		               " were valid.", __FILE__, __LINE__, setting_name);
 			goto get_secrets;
+		} else {
+			g_hash_table_insert (settings, g_strdup (setting_name), secrets);
+			dbus_g_method_return (context, settings);
 		}
-		dbus_g_method_return (context, secrets);
-		g_hash_table_destroy (secrets);
 	}
 
+	g_hash_table_destroy (settings);
 	gnome_keyring_found_list_free (found_list);
 	return;
 

Modified: trunk/src/applet-device-wireless.c
==============================================================================
--- trunk/src/applet-device-wireless.c	(original)
+++ trunk/src/applet-device-wireless.c	Mon Mar 17 19:52:49 2008
@@ -38,6 +38,7 @@
 #include <nm-setting-connection.h>
 #include <nm-setting-wireless.h>
 #include <nm-device-802-11-wireless.h>
+#include <nm-setting-8021x.h>
 #include <nm-utils.h>
 
 #include "applet.h"
@@ -200,7 +201,10 @@
 }
 
 static NMSettingWirelessSecurity *
-get_security_for_ap (NMAccessPoint *ap, guint32 dev_caps, gboolean *supported)
+get_security_for_ap (NMAccessPoint *ap,
+                     guint32 dev_caps,
+                     gboolean *supported,
+                     NMSetting8021x **s_8021x)
 {
 	NMSettingWirelessSecurity *sec;
 	int mode;
@@ -211,6 +215,8 @@
 	g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL);
 	g_return_val_if_fail (supported != NULL, NULL);
 	g_return_val_if_fail (*supported == TRUE, NULL);
+	g_return_val_if_fail (s_8021x != NULL, NULL);
+	g_return_val_if_fail (*s_8021x == NULL, NULL);
 
 	sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
 
@@ -267,8 +273,10 @@
 		sec->proto = g_slist_append (sec->proto, g_strdup ("rsn"));
 		sec->pairwise = add_ciphers_from_flags (rsn_flags, TRUE);
 		sec->group = add_ciphers_from_flags (rsn_flags, FALSE);
-		sec->eap = g_slist_append (sec->eap, g_strdup ("ttls"));
-		sec->phase2_auth = g_strdup ("mschapv2");
+
+		*s_8021x = NM_SETTING_802_1X (nm_setting_802_1x_new ());
+		(*s_8021x)->eap = g_slist_append ((*s_8021x)->eap, g_strdup ("ttls"));
+		(*s_8021x)->phase2_auth = g_strdup ("mschapv2");
 		return sec;
 	}
 
@@ -279,8 +287,10 @@
 		sec->proto = g_slist_append (sec->proto, g_strdup ("wpa"));
 		sec->pairwise = add_ciphers_from_flags (wpa_flags, TRUE);
 		sec->group = add_ciphers_from_flags (wpa_flags, FALSE);
-		sec->eap = g_slist_append (sec->eap, g_strdup ("ttls"));
-		sec->phase2_auth = g_strdup ("mschapv2");
+
+		*s_8021x = NM_SETTING_802_1X (nm_setting_802_1x_new ());
+		(*s_8021x)->eap = g_slist_append ((*s_8021x)->eap, g_strdup ("ttls"));
+		(*s_8021x)->phase2_auth = g_strdup ("mschapv2");
 		return sec;
 	}
 
@@ -301,6 +311,7 @@
 	NMSettingConnection *s_con = NULL;
 	NMSettingWireless *s_wireless = NULL;
 	NMSettingWirelessSecurity *s_wireless_sec = NULL;
+	NMSetting8021x *s_8021x = NULL;
 	const GByteArray *ap_ssid;
 	char buf[33];
 	int buf_len;
@@ -328,7 +339,7 @@
 		g_assert_not_reached ();
 
 	dev_caps = nm_device_802_11_wireless_get_capabilities (NM_DEVICE_802_11_WIRELESS (device));
-	s_wireless_sec = get_security_for_ap (info->ap, dev_caps, &supported);
+	s_wireless_sec = get_security_for_ap (info->ap, dev_caps, &supported, &s_8021x);
 	if (!supported) {
 		g_object_unref (s_wireless);
 		goto out;
@@ -340,6 +351,8 @@
 	nm_connection_add_setting (connection, NM_SETTING (s_wireless));
 	if (s_wireless_sec)
 		nm_connection_add_setting (connection, NM_SETTING (s_wireless_sec));
+	if (s_8021x)
+		nm_connection_add_setting (connection, NM_SETTING (s_8021x));
 
 	s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
 	s_con->type = g_strdup (NM_SETTING (s_wireless)->name);
@@ -1209,6 +1222,35 @@
 	gtk_window_present (GTK_WINDOW (dialog));
 }
 
+static gboolean
+add_one_setting (GHashTable *settings,
+                 NMConnection *connection,
+                 NMSetting *setting,
+                 GError **error)
+{
+	GHashTable *secrets;
+
+	g_return_val_if_fail (settings != NULL, FALSE);
+	g_return_val_if_fail (connection != NULL, FALSE);
+	g_return_val_if_fail (setting != NULL, FALSE);
+	g_return_val_if_fail (error != NULL, FALSE);
+	g_return_val_if_fail (*error == NULL, FALSE);
+
+	utils_fill_connection_certs (connection);
+	secrets = nm_setting_to_hash (setting);
+	utils_clear_filled_connection_certs (connection);
+
+	if (secrets) {
+		g_hash_table_insert (settings, g_strdup (setting->name), secrets);
+	} else {
+		g_set_error (error, NM_SETTINGS_ERROR, 1,
+		             "%s.%d (%s): failed to hash setting '%s'.",
+		             __FILE__, __LINE__, __func__, setting->name);
+	}
+
+	return secrets ? TRUE : FALSE;
+}
+
 static void
 get_secrets_dialog_response_cb (GtkDialog *dialog,
                                 gint response,
@@ -1218,10 +1260,10 @@
 	DBusGMethodInvocation *context;
 	AppletExportedConnection *exported;
 	NMConnection *connection = NULL;
+	NMSettingWirelessSecurity *s_wireless_sec;
 	NMDevice *device = NULL;
-	GHashTable *setting_hash;
+	GHashTable *settings = NULL;
 	const char *setting_name;
-	NMSetting *setting;
 	GError *error = NULL;
 	gboolean ignored;
 
@@ -1266,28 +1308,60 @@
 		goto done;
 	}
 
-	setting = nm_connection_get_setting_by_name (connection, setting_name);
-	if (!setting) {
+	/* Second-guess which setting NM wants secrets for. */
+	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY));
+	if (!s_wireless_sec) {
 		g_set_error (&error, NM_SETTINGS_ERROR, 1,
-		             "%s.%d (%s): requested setting '%s' didn't exist in the "
-		             " connection.",
-		             __FILE__, __LINE__, __func__, setting_name);
-		goto done;
+		             "%s.%d (%s): requested setting '802-11-wireless-security'"
+		             " didn't exist in the connection.",
+		             __FILE__, __LINE__, __func__);
+		goto done;  /* Unencrypted */
 	}
 
-	utils_fill_connection_certs (connection);
-	setting_hash = nm_setting_to_hash (setting);
-	utils_clear_filled_connection_certs (connection);
-
-	if (!setting_hash) {
+	/* Returned secrets are a{sa{sv}}; this is the outer a{s...} hash that
+	 * will contain all the individual settings hashes.
+	 */
+	settings = g_hash_table_new_full (g_str_hash, g_str_equal,
+	                                  g_free, (GDestroyNotify) g_hash_table_destroy);
+	if (!settings) {
 		g_set_error (&error, NM_SETTINGS_ERROR, 1,
-		             "%s.%d (%s): failed to hash setting '%s'.",
-		             __FILE__, __LINE__, __func__, setting_name);
+		             "%s.%d (%s): not enough memory to return secrets.",
+		             __FILE__, __LINE__, __func__);
 		goto done;
 	}
 
-	dbus_g_method_return (context, setting_hash);
-	g_hash_table_destroy (setting_hash);
+	/* If the user chose an 802.1x-based auth method, return 802.1x secrets,
+	 * not wireless secrets.  Can happen with Dynamic WEP, because NM doesn't
+	 * know the capabilities of the AP (since Dynamic WEP APs don't broadcast
+	 * beacons), and therefore defaults to requesting WEP secrets from the
+	 * wireless-security setting, not the 802.1x setting.
+	 */
+	if (   !strcmp (s_wireless_sec->key_mgmt, "ieee8021x")
+	    || !strcmp (s_wireless_sec->key_mgmt, "wpa-eap")) {
+		/* LEAP secrets aren't in the 802.1x setting */
+		if (!s_wireless_sec->auth_alg || strcmp (s_wireless_sec->auth_alg, "leap")) {
+			NMSetting8021x *s_8021x;
+
+			s_8021x = (NMSetting8021x *) nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
+			if (!s_8021x) {
+				g_set_error (&error, NM_SETTINGS_ERROR, 1,
+				             "%s.%d (%s): requested setting '802-1x' didn't"
+				             " exist in the connection.",
+				             __FILE__, __LINE__, __func__);
+				goto done;
+			}
+
+			/* Add the 802.1x setting */
+			if (!add_one_setting (settings, connection, NM_SETTING (s_8021x), &error))
+				goto done;
+		}
+	}
+
+	/* Add the 802-11-wireless-security setting no matter what */
+	if (!add_one_setting (settings, connection, NM_SETTING (s_wireless_sec), &error))
+		goto done;
+
+	dbus_g_method_return (context, settings);
 
 	/* Save the connection back to GConf _after_ hashing it, because
 	 * saving to GConf might trigger the GConf change notifiers, resulting
@@ -1298,6 +1372,9 @@
 		applet_exported_connection_save (exported);
 
 done:
+	if (settings)
+		g_hash_table_destroy (settings);
+
 	if (error) {
 		g_warning (error->message);
 		dbus_g_method_return_error (context, error);
@@ -1306,6 +1383,7 @@
 
 	if (connection)
 		nm_connection_clear_secrets (connection);
+
 	gtk_widget_hide (GTK_WIDGET (dialog));
 	gtk_widget_destroy (GTK_WIDGET (dialog));
 }

Modified: trunk/src/applet-dialogs.c
==============================================================================
--- trunk/src/applet-dialogs.c	(original)
+++ trunk/src/applet-dialogs.c	Mon Mar 17 19:52:49 2008
@@ -31,6 +31,7 @@
 
 #include <nm-setting-wireless.h>
 #include <nm-setting-wireless-security.h>
+#include <nm-setting-8021x.h>
 
 #include <gtk/gtk.h>
 #include <gtk/gtkwidget.h>
@@ -64,31 +65,39 @@
 }
 
 static void
-set_eap_info_label (GtkWidget *label, NMSettingWirelessSecurity *sec)
+set_eap_info_label (GtkWidget *label,
+                    NMSettingWirelessSecurity *sec,
+                    NMSetting8021x *s_8021x)
 {
 	GString *str = NULL;
 	char *phase2_str = NULL;
 
-	if (!strcmp (sec->key_mgmt, "ieee8021x"))
-		str = g_string_new (_("Dynamic WEP"));
-	else if (!strcmp (sec->key_mgmt, "wpa-eap"))
+	if (!strcmp (sec->key_mgmt, "ieee8021x")) {
+		if (sec->auth_alg && !strcmp (sec->auth_alg, "leap"))
+			str = g_string_new (_("LEAP"));
+		else
+			str = g_string_new (_("Dynamic WEP"));
+	} else if (!strcmp (sec->key_mgmt, "wpa-eap"))
 		str = g_string_new (_("WPA/WPA2"));
 	else {
 		str = g_string_new (_("Unknown"));
 		goto out;
 	}
 
-	if (sec->eap && sec->eap->data) {
-		char *eap_str = g_ascii_strup (sec->eap->data, -1);
+	if (!s_8021x)
+		goto out;
+
+	if (s_8021x->eap && s_8021x->eap->data) {
+		char *eap_str = g_ascii_strup (s_8021x->eap->data, -1);
 		g_string_append (str, ", EAP-");
 		g_string_append (str, eap_str);
 		g_free (eap_str);
 	}
 
-	if (sec->phase2_auth)
-		phase2_str = g_ascii_strup (sec->phase2_auth, -1);
-	else if (sec->phase2_autheap)
-		phase2_str = g_ascii_strup (sec->phase2_autheap, -1);
+	if (s_8021x->phase2_auth)
+		phase2_str = g_ascii_strup (s_8021x->phase2_auth, -1);
+	else if (s_8021x->phase2_autheap)
+		phase2_str = g_ascii_strup (s_8021x->phase2_autheap, -1);
 
 	if (phase2_str) {
 		g_string_append (str, ", ");
@@ -170,9 +179,11 @@
 	if (NM_IS_DEVICE_802_11_WIRELESS (device)) {
 		NMSettingWireless *s_wireless;
 		NMSettingWirelessSecurity *s_wireless_sec;
+		NMSetting8021x *s_8021x;
 
 		s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
 		s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY));
+		s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
 		if (   s_wireless
 		    && s_wireless->security
 		    && !strcmp (s_wireless->security, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)
@@ -185,7 +196,7 @@
 			} else if (!strcmp (s_wireless_sec->key_mgmt, "wpa-psk")) {
 				gtk_label_set_text (GTK_LABEL (label), _("WPA/WPA2"));
 			} else {
-				set_eap_info_label (label, s_wireless_sec);
+				set_eap_info_label (label, s_wireless_sec, s_8021x);
 			}
 		} else {
 			gtk_label_set_text (GTK_LABEL (label), _("None"));

Modified: trunk/src/gconf-helpers/gconf-helpers.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.c	(original)
+++ trunk/src/gconf-helpers/gconf-helpers.c	Mon Mar 17 19:52:49 2008
@@ -29,13 +29,14 @@
 #include <dbus/dbus-glib.h>
 #include <nm-setting-connection.h>
 #include <nm-setting-wireless-security.h>
+#include <nm-setting-8021x.h>
 #include <nm-setting-vpn.h>
 #include <nm-utils.h>
 
 #include "gconf-helpers.h"
 #include "gconf-upgrade.h"
 
-const char *wireless_security_ignore_keys[] = {
+const char *applet_8021x_ignore_keys[] = {
 	"ca-cert",
 	"client-cert",
 	"private-key",
@@ -564,6 +565,7 @@
 
 	nm_gconf_migrate_0_7_connection_names (client);
 	nm_gconf_migrate_0_7_vpn_connections (client);
+	nm_gconf_migrate_0_7_wireless_security (client);
 
 	connections = gconf_client_all_dirs (client, GCONF_PATH_CONNECTIONS, NULL);
 	if (!connections) {
@@ -600,8 +602,8 @@
 	/* Some keys (like certs) aren't read directly from GConf but are handled
 	 * separately.
 	 */
-	if (NM_IS_SETTING_WIRELESS_SECURITY (setting)) {
-		if (nm_utils_string_in_list (key, wireless_security_ignore_keys))
+	if (NM_IS_SETTING_802_1X (setting)) {
+		if (nm_utils_string_in_list (key, applet_8021x_ignore_keys))
 			return;
 	} else if (NM_IS_SETTING_VPN (setting)) {
 		if (nm_utils_string_in_list (key, vpn_ignore_keys))
@@ -698,7 +700,7 @@
 read_applet_private_values_from_gconf (NMSetting *setting,
                                        ReadFromGConfInfo *info)
 {
-	if (NM_IS_SETTING_WIRELESS_SECURITY (setting)) {
+	if (NM_IS_SETTING_802_1X (setting)) {
 		gboolean value;
 
 		if (nm_gconf_get_bool_helper (info->client, info->dir,
@@ -785,11 +787,11 @@
 }
 
 
-static void
-add_keyring_item (const char *connection_id,
-                  const char *setting_name,
-                  const char *setting_key,
-                  const char *secret)
+void
+nm_gconf_add_keyring_item (const char *connection_id,
+                           const char *setting_name,
+                           const char *setting_key,
+                           const char *secret)
 {
 	GnomeKeyringResult ret;
 	char *display_name = NULL;
@@ -855,8 +857,8 @@
 	/* Some keys (like certs) aren't written directly to GConf but are handled
 	 * separately.
 	 */
-	if (NM_IS_SETTING_WIRELESS_SECURITY (setting)) {
-		if (nm_utils_string_in_list (key, wireless_security_ignore_keys))
+	if (NM_IS_SETTING_802_1X (setting)) {
+		if (nm_utils_string_in_list (key, applet_8021x_ignore_keys))
 			return;
 	} else if (NM_IS_SETTING_VPN (setting)) {
 		if (nm_utils_string_in_list (key, vpn_ignore_keys))
@@ -868,7 +870,7 @@
 		if (str_val) {
 			if (secret) {
 				if (strlen (str_val))
-					add_keyring_item (info->connection_id, setting->name, key, str_val);
+					nm_gconf_add_keyring_item (info->connection_id, setting->name, key, str_val);
 			} else
 				nm_gconf_set_string_helper (info->client, info->dir, key, setting->name, str_val);
 		}
@@ -923,12 +925,12 @@
 	if (cert) {
 		char *key;
 
-		key = g_strdup_printf ("%s/%s/%s", info->dir, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, tag);
+		key = g_strdup_printf ("%s/%s/%s", info->dir, NM_SETTING_802_1X_SETTING_NAME, tag);
 		gconf_client_unset (info->client, key, NULL);
 		g_free (key);
 	} else {
 		if (GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (info->connection), tag)))
-			nm_gconf_set_bool_helper (info->client, info->dir, tag, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, TRUE);
+			nm_gconf_set_bool_helper (info->client, info->dir, tag, NM_SETTING_802_1X_SETTING_NAME, TRUE);
 	}
 }
 
@@ -943,12 +945,12 @@
 	value = g_object_get_data (G_OBJECT (info->connection), tag);
 	if (value) {
 		nm_gconf_set_string_helper (info->client, info->dir, tag,
-		                            NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+		                            NM_SETTING_802_1X_SETTING_NAME,
 		                            value);
 	} else {
 		char *key;
 
-		key = g_strdup_printf ("%s/%s/%s", info->dir, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, tag);
+		key = g_strdup_printf ("%s/%s/%s", info->dir, NM_SETTING_802_1X_SETTING_NAME, tag);
 		gconf_client_unset (info->client, key, NULL);
 		g_free (key);
 	}
@@ -964,10 +966,10 @@
 
 	value = g_object_get_data (G_OBJECT (info->connection), tag);
 	if (value) {
-		add_keyring_item (info->connection_id,
-		                  NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
-		                  tag,
-		                  value);
+		nm_gconf_add_keyring_item (info->connection_id,
+		                           NM_SETTING_802_1X_SETTING_NAME,
+		                           tag,
+		                           value);
 
 		/* Try not to leave the password lying around in memory */
 		g_object_set_data (G_OBJECT (info->connection), tag, NULL);
@@ -977,17 +979,17 @@
 static void
 write_applet_private_values_to_gconf (CopyOneSettingValueInfo *info)
 {
-	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x;
 
 	g_return_if_fail (info != NULL);
 
 	/* Handle values private to the applet that are not supposed to
 	 * be sent to NetworkManager.
 	 */
-	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (info->connection, NM_TYPE_SETTING_WIRELESS_SECURITY));
-	if (s_wireless_sec) {
-		write_ignore_ca_cert_helper (info, NMA_CA_CERT_IGNORE_TAG, s_wireless_sec->ca_cert);
-		write_ignore_ca_cert_helper (info, NMA_PHASE2_CA_CERT_IGNORE_TAG, s_wireless_sec->phase2_ca_cert);
+	s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (info->connection, NM_TYPE_SETTING_802_1X));
+	if (s_8021x) {
+		write_ignore_ca_cert_helper (info, NMA_CA_CERT_IGNORE_TAG, s_8021x->ca_cert);
+		write_ignore_ca_cert_helper (info, NMA_PHASE2_CA_CERT_IGNORE_TAG, s_8021x->phase2_ca_cert);
 
 		/* Binary certificate and key data doesn't get stored in GConf.  Instead,
 		 * the path to the certificate gets stored in a special key and the

Modified: trunk/src/gconf-helpers/gconf-helpers.h
==============================================================================
--- trunk/src/gconf-helpers/gconf-helpers.h	(original)
+++ trunk/src/gconf-helpers/gconf-helpers.h	Mon Mar 17 19:52:49 2008
@@ -153,5 +153,11 @@
                            GConfClient *client,
                            const char *dir);
 
+void
+nm_gconf_add_keyring_item (const char *connection_id,
+                           const char *setting_name,
+                           const char *setting_key,
+                           const char *secret);
+
 #endif	/* GCONF_HELPERS_H */
 

Modified: trunk/src/gconf-helpers/gconf-upgrade.c
==============================================================================
--- trunk/src/gconf-helpers/gconf-upgrade.c	(original)
+++ trunk/src/gconf-helpers/gconf-upgrade.c	Mon Mar 17 19:52:49 2008
@@ -28,8 +28,11 @@
 #include <iwlib.h>
 #include <wireless.h>
 
+#include <gnome-keyring.h>
 #include <nm-setting-connection.h>
 #include <nm-setting-wireless.h>
+#include <nm-setting-wireless-security.h>
+#include <nm-setting-8021x.h>
 #include <nm-setting-vpn.h>
 #include <nm-setting-vpn-properties.h>
 #include "gconf-upgrade.h"
@@ -252,7 +255,9 @@
 
 static NMSettingWirelessSecurity *
 nm_gconf_read_0_6_eap_settings (GConfClient *client,
-						  const char *path, const char *network)
+                                const char *path,
+                                const char *network,
+                                NMSetting8021x **s_8021x)
 {
 	NMSettingWirelessSecurity *s_wireless_sec;
 	GSList *eap = NULL, *key_type = NULL, *proto = NULL;
@@ -271,16 +276,17 @@
 		goto fail;
 	nm_gconf_get_string_helper (client, path, "wpa_eap_anon_identity", network, &anon_identity);
 
-	s_wireless_sec = (NMSettingWirelessSecurity *)nm_setting_wireless_security_new ();
+	s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
 	/* AFAICT, 0.6 reads this value from gconf, and then ignores it and always uses IW_AUTH_KEY_MGMT_802_1X */
 	s_wireless_sec->key_mgmt = g_strdup ("ieee8021x"); /* FIXME? wpa-eap? */
 	s_wireless_sec->proto = proto;
-	s_wireless_sec->eap = eap;
 	s_wireless_sec->group = key_type; /* FIXME? */
-	s_wireless_sec->phase2_auth = phase2_type; /* FIXME? phase2_autheap? */
-	s_wireless_sec->identity = identity;
-	s_wireless_sec->password = g_strdup ("");
-	s_wireless_sec->anonymous_identity = anon_identity;
+
+	*s_8021x = (NMSetting8021x *) nm_setting_802_1x_new ();
+	(*s_8021x)->eap = eap;
+	(*s_8021x)->phase2_auth = phase2_type; /* FIXME? phase2_autheap? */
+	(*s_8021x)->identity = identity;
+	(*s_8021x)->anonymous_identity = anon_identity;
 
 	return s_wireless_sec;
 
@@ -309,9 +315,9 @@
 		return NULL;
 	}
 
-	s_wireless_sec = (NMSettingWirelessSecurity *)nm_setting_wireless_security_new ();
+	s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
 	s_wireless_sec->key_mgmt = key_mgmt;
-	s_wireless_sec->identity = username;
+	s_wireless_sec->leap_username = username;
 
 	return s_wireless_sec;
 }
@@ -324,6 +330,7 @@
 	NMSettingConnection *s_con;
 	NMSettingWireless *s_wireless;
 	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x = NULL;
 	char *path, *network, *essid = NULL;
 	int timestamp, we_cipher;
 	GSList *bssids = NULL;
@@ -372,7 +379,7 @@
 			s_wireless_sec = nm_gconf_read_0_6_wpa_settings (client, path, network);
 			break;
 		case NM_AUTH_TYPE_WPA_EAP:
-			s_wireless_sec = nm_gconf_read_0_6_eap_settings (client, path, network);
+			s_wireless_sec = nm_gconf_read_0_6_eap_settings (client, path, network, &s_8021x);
 			break;
 		case NM_AUTH_TYPE_LEAP:
 			s_wireless_sec = nm_gconf_read_0_6_leap_settings (client, path, network);
@@ -398,6 +405,8 @@
 	nm_connection_add_setting (connection, (NMSetting *)s_wireless);
 	if (s_wireless_sec)
 		nm_connection_add_setting (connection, (NMSetting *)s_wireless_sec);
+	if (s_8021x)
+		nm_connection_add_setting (connection, (NMSetting *)s_8021x);
 
 	/* Would be better in nm_gconf_read_0_6_eap_settings, except that
 	 * the connection object doesn't exist at that point. Hrmph.
@@ -658,3 +667,245 @@
 	gconf_client_suggest_sync (client, NULL);
 }
 
+static void
+unset_ws_key (GConfClient *client, const char *dir, const char *key)
+{
+	char *old_key;
+
+	old_key = g_strdup_printf ("%s/" NM_SETTING_WIRELESS_SECURITY_SETTING_NAME "/%s", dir, key);
+	gconf_client_unset (client, old_key, NULL);
+	g_free (old_key);
+}
+
+static void
+copy_stringlist_to_8021x (GConfClient *client, const char *dir, const char *key)
+{
+	GSList *sa_val = NULL;
+
+	if (!nm_gconf_get_stringlist_helper (client, dir, key, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &sa_val))
+		return;
+
+	if (!nm_gconf_set_stringlist_helper (client, dir, key, NM_SETTING_802_1X_SETTING_NAME, sa_val))
+		g_warning ("Could not convert string list value '%s' from wireless-security to 8021x setting", key);
+
+	g_slist_foreach (sa_val, (GFunc) g_free, NULL);
+	g_slist_free (sa_val);
+
+	unset_ws_key (client, dir, key);
+}
+
+static void
+copy_string_to_8021x (GConfClient *client, const char *dir, const char *key)
+{
+	char *val = NULL;
+
+	if (!nm_gconf_get_string_helper (client, dir, key, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &val))
+		return;
+
+	if (!nm_gconf_set_string_helper (client, dir, key, NM_SETTING_802_1X_SETTING_NAME, val))
+		g_warning ("Could not convert string value '%s' from wireless-security to 8021x setting", key);
+
+	g_free (val);
+
+	unset_ws_key (client, dir, key);
+}
+
+static void
+copy_bool_to_8021x (GConfClient *client, const char *dir, const char *key)
+{
+	gboolean val;
+
+	if (!nm_gconf_get_bool_helper (client, dir, key, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, &val))
+		return;
+
+	if (val && !nm_gconf_set_bool_helper (client, dir, key, NM_SETTING_802_1X_SETTING_NAME, val))
+		g_warning ("Could not convert string value '%s' from wireless-security to 8021x setting", key);
+
+	unset_ws_key (client, dir, key);
+}
+
+static gboolean
+try_convert_leap (GConfClient *client, const char *dir)
+{
+	char *val = NULL;
+	GnomeKeyringResult ret;
+	GList *found_list = NULL;
+	GnomeKeyringFound *found;
+
+	if (!nm_gconf_get_string_helper (client, dir,
+	                                 NM_SETTING_WIRELESS_SECURITY_KEY_MGMT,
+	                                 NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+	                                 &val))
+		return FALSE;
+
+	if (strcmp (val, "ieee8021x")) {
+		g_free (val);
+		return FALSE;
+	}
+	g_free (val);
+	val = NULL;
+
+	if (!nm_gconf_get_string_helper (client, dir,
+	                                 NM_SETTING_WIRELESS_SECURITY_AUTH_ALG,
+	                                 NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+	                                 &val))
+		return FALSE;
+
+	if (strcmp (val, "leap")) {
+		g_free (val);
+		return FALSE;
+	}
+	g_free (val);
+	val = NULL;
+
+	/* Copy leap username */
+	if (!nm_gconf_get_string_helper (client, dir,
+	                                 "identity",
+	                                 NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+	                                 &val))
+		return FALSE;
+
+	if (!nm_gconf_set_string_helper (client, dir,
+	                                 NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME,
+	                                 NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+	                                 val))
+		g_warning ("Could not convert leap-username.");
+
+	g_free (val);
+	val = NULL;
+
+	unset_ws_key (client, dir, NM_SETTING_802_1X_IDENTITY);
+
+	if (!nm_gconf_get_string_helper (client, dir,
+	                                 "id",
+	                                 NM_SETTING_CONNECTION_SETTING_NAME,
+	                                 &val))
+		goto done;
+
+	/* Copy the LEAP password */
+	ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
+	                                      &found_list,
+	                                      "connection-name",
+	                                      GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
+	                                      val,
+	                                      "setting-name",
+	                                      GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
+	                                      NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+	                                      "setting-key",
+	                                      GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
+	                                      "password",
+	                                      NULL);
+	if ((ret != GNOME_KEYRING_RESULT_OK) || (g_list_length (found_list) == 0))
+		goto done;
+
+	found = (GnomeKeyringFound *) found_list->data;
+	nm_gconf_add_keyring_item (val,
+	                           NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+	                           NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD,
+	                           found->secret);
+	gnome_keyring_item_delete_sync (found->keyring, found->item_id);
+
+done:
+	g_free (val);
+	gnome_keyring_found_list_free (found_list);
+	return TRUE;
+}
+
+static void
+copy_keyring_to_8021x (GConfClient *client, const char *dir, const char *key)
+{
+	char *id = NULL;
+	GnomeKeyringResult ret;
+	GList *found_list = NULL;
+	GnomeKeyringFound *found;
+
+	if (!nm_gconf_get_string_helper (client, dir,
+	                                 "id",
+	                                 NM_SETTING_CONNECTION_SETTING_NAME,
+	                                 &id))
+		return;
+
+	/* Copy the LEAP password */
+	ret = gnome_keyring_find_itemsv_sync (GNOME_KEYRING_ITEM_GENERIC_SECRET,
+	                                      &found_list,
+	                                      "connection-name",
+	                                      GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
+	                                      id,
+	                                      "setting-name",
+	                                      GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
+	                                      NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+	                                      "setting-key",
+	                                      GNOME_KEYRING_ATTRIBUTE_TYPE_STRING,
+	                                      key,
+	                                      NULL);
+	if ((ret != GNOME_KEYRING_RESULT_OK) || (g_list_length (found_list) == 0))
+		goto done;
+
+	found = (GnomeKeyringFound *) found_list->data;
+	nm_gconf_add_keyring_item (id, NM_SETTING_802_1X_SETTING_NAME, key, found->secret);
+
+	gnome_keyring_item_delete_sync (found->keyring, found->item_id);
+
+done:
+	g_free (id);
+	gnome_keyring_found_list_free (found_list);
+}
+
+void
+nm_gconf_migrate_0_7_wireless_security (GConfClient *client)
+{
+	GSList *connections, *iter;
+
+	connections = gconf_client_all_dirs (client, GCONF_PATH_CONNECTIONS, NULL);
+	for (iter = connections; iter; iter = iter->next) {
+		char *key_mgmt = NULL;
+
+		if (!nm_gconf_get_string_helper (client, iter->data,
+		                                 NM_SETTING_WIRELESS_SECURITY_KEY_MGMT,
+		                                 NM_SETTING_WIRELESS_SECURITY_SETTING_NAME,
+		                                 &key_mgmt))
+			continue;
+
+		/* Only convert 802.1x-based connections */
+		if (strcmp (key_mgmt, "ieee8021x") && strcmp (key_mgmt, "wpa-eap")) {
+			g_free (key_mgmt);
+			continue;
+		}
+		g_free (key_mgmt);
+
+		/* Leap gets converted differently */
+		if (try_convert_leap (client, iter->data))
+			continue;
+
+		/* Otherwise straight 802.1x */
+		copy_stringlist_to_8021x (client, iter->data, NM_SETTING_802_1X_EAP);
+		copy_string_to_8021x (client, iter->data, NM_SETTING_802_1X_IDENTITY);
+		copy_string_to_8021x (client, iter->data, NM_SETTING_802_1X_ANONYMOUS_IDENTITY);
+		copy_string_to_8021x (client, iter->data, NM_SETTING_802_1X_CA_PATH);
+		copy_string_to_8021x (client, iter->data, NM_SETTING_802_1X_PHASE1_PEAPVER);
+		copy_string_to_8021x (client, iter->data, NM_SETTING_802_1X_PHASE1_PEAPLABEL);
+		copy_string_to_8021x (client, iter->data, NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING);
+		copy_string_to_8021x (client, iter->data, NM_SETTING_802_1X_PHASE2_AUTH);
+		copy_string_to_8021x (client, iter->data, NM_SETTING_802_1X_PHASE2_AUTHEAP);
+		copy_string_to_8021x (client, iter->data, NM_SETTING_802_1X_PHASE2_CA_PATH);
+		copy_string_to_8021x (client, iter->data, NMA_PATH_CA_CERT_TAG);
+		copy_string_to_8021x (client, iter->data, NMA_PATH_CLIENT_CERT_TAG);
+		copy_string_to_8021x (client, iter->data, NMA_PATH_PRIVATE_KEY_TAG);
+		copy_string_to_8021x (client, iter->data, NMA_PATH_PHASE2_CA_CERT_TAG);
+		copy_string_to_8021x (client, iter->data, NMA_PATH_PHASE2_CLIENT_CERT_TAG);
+		copy_string_to_8021x (client, iter->data, NMA_PATH_PHASE2_PRIVATE_KEY_TAG);
+
+		copy_bool_to_8021x (client, iter->data, NMA_CA_CERT_IGNORE_TAG);
+		copy_bool_to_8021x (client, iter->data, NMA_PHASE2_CA_CERT_IGNORE_TAG);
+
+		copy_keyring_to_8021x (client, iter->data, NM_SETTING_802_1X_PASSWORD);
+		copy_keyring_to_8021x (client, iter->data, NM_SETTING_802_1X_PIN);
+		copy_keyring_to_8021x (client, iter->data, NM_SETTING_802_1X_PSK);
+		copy_keyring_to_8021x (client, iter->data, NMA_PRIVATE_KEY_PASSWORD_TAG);
+		copy_keyring_to_8021x (client, iter->data, NMA_PHASE2_PRIVATE_KEY_PASSWORD_TAG);
+	}
+	free_slist (connections);
+
+	gconf_client_suggest_sync (client, NULL);
+}
+

Modified: trunk/src/gconf-helpers/gconf-upgrade.h
==============================================================================
--- trunk/src/gconf-helpers/gconf-upgrade.h	(original)
+++ trunk/src/gconf-helpers/gconf-upgrade.h	Mon Mar 17 19:52:49 2008
@@ -24,14 +24,13 @@
 
 #include <gconf/gconf-client.h>
 
-void
-nm_gconf_migrate_0_6_connections (GConfClient *client);
+void nm_gconf_migrate_0_6_connections (GConfClient *client);
 
-void
-nm_gconf_migrate_0_7_vpn_connections (GConfClient *client);
+void nm_gconf_migrate_0_7_vpn_connections (GConfClient *client);
 
-void
-nm_gconf_migrate_0_7_connection_names (GConfClient *client);
+void nm_gconf_migrate_0_7_connection_names (GConfClient *client);
+
+void nm_gconf_migrate_0_7_wireless_security (GConfClient *client);
 
 #endif	/* GCONF_UPGRADE_H */
 

Modified: trunk/src/utils/utils.c
==============================================================================
--- trunk/src/utils/utils.c	(original)
+++ trunk/src/utils/utils.c	Mon Mar 17 19:52:49 2008
@@ -36,6 +36,7 @@
 #include <nm-setting-wired.h>
 #include <nm-setting-wireless.h>
 #include <nm-setting-wireless-security.h>
+#include <nm-setting-8021x.h>
 #include <nm-setting-gsm.h>
 #include <nm-setting-cdma.h>
 #include <nm-setting-pppoe.h>
@@ -228,59 +229,57 @@
 void
 utils_fill_connection_certs (NMConnection *connection)
 {
-	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x;
 
 	g_return_if_fail (connection != NULL);
 
-	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, 
-															    NM_TYPE_SETTING_WIRELESS_SECURITY));
-	if (!s_wireless_sec)
+	s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+	if (!s_8021x)
 		return;
 
 	utils_fill_one_crypto_object (connection,
 	                              NMA_PATH_CA_CERT_TAG,
 	                              FALSE,
 	                              NULL,
-	                              &s_wireless_sec->ca_cert,
+	                              &s_8021x->ca_cert,
 	                              NULL);
 	utils_fill_one_crypto_object (connection,
 	                              NMA_PATH_CLIENT_CERT_TAG,
 	                              FALSE,
 	                              NULL,
-	                              &s_wireless_sec->client_cert,
+	                              &s_8021x->client_cert,
 	                              NULL);
 	utils_fill_one_crypto_object (connection,
 	                              NMA_PATH_PHASE2_CA_CERT_TAG,
 	                              FALSE,
 	                              NULL,
-	                              &s_wireless_sec->phase2_ca_cert,
+	                              &s_8021x->phase2_ca_cert,
 	                              NULL);
 	utils_fill_one_crypto_object (connection,
 	                              NMA_PATH_PHASE2_CLIENT_CERT_TAG,
 	                              FALSE,
 	                              NULL,
-	                              &s_wireless_sec->phase2_client_cert,
+	                              &s_8021x->phase2_client_cert,
 	                              NULL);
 }
 
 void
 utils_clear_filled_connection_certs (NMConnection *connection)
 {
-	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x;
 
 	g_return_if_fail (connection != NULL);
 
-	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, 
-															    NM_TYPE_SETTING_WIRELESS_SECURITY));
-	if (!s_wireless_sec)
+	s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+	if (!s_8021x)
 		return;
 
-	clear_one_byte_array_field (&s_wireless_sec->ca_cert);
-	clear_one_byte_array_field (&s_wireless_sec->client_cert);
-	clear_one_byte_array_field (&s_wireless_sec->private_key);
-	clear_one_byte_array_field (&s_wireless_sec->phase2_ca_cert);
-	clear_one_byte_array_field (&s_wireless_sec->phase2_client_cert);
-	clear_one_byte_array_field (&s_wireless_sec->phase2_private_key);
+	clear_one_byte_array_field (&s_8021x->ca_cert);
+	clear_one_byte_array_field (&s_8021x->client_cert);
+	clear_one_byte_array_field (&s_8021x->private_key);
+	clear_one_byte_array_field (&s_8021x->phase2_ca_cert);
+	clear_one_byte_array_field (&s_8021x->phase2_client_cert);
+	clear_one_byte_array_field (&s_8021x->phase2_private_key);
 }
 
 

Modified: trunk/src/wireless-security/eap-method-leap.c
==============================================================================
--- trunk/src/wireless-security/eap-method-leap.c	(original)
+++ trunk/src/wireless-security/eap-method-leap.c	Mon Mar 17 19:52:49 2008
@@ -22,7 +22,7 @@
 #include <glade/glade.h>
 #include <ctype.h>
 #include <string.h>
-#include <nm-setting-wireless.h>
+#include <nm-setting-8021x.h>
 
 #include "eap-method.h"
 #include "wireless-security.h"
@@ -86,14 +86,13 @@
 static void
 fill_connection (EAPMethod *parent, NMConnection *connection)
 {
-	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x;
 	GtkWidget *widget;
 
-	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, 
-										  NM_TYPE_SETTING_WIRELESS_SECURITY));
-	g_assert (s_wireless_sec);
+	s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+	g_assert (s_8021x);
 
-	s_wireless_sec->eap = g_slist_append (s_wireless_sec->eap, g_strdup ("leap"));
+	s_8021x->eap = g_slist_append (s_8021x->eap, g_strdup ("leap"));
 
 	// FIXME: allow protocol selection and filter on device capabilities
 	// FIXME: allow pairwise cipher selection and filter on device capabilities
@@ -102,11 +101,11 @@
 
 	widget = glade_xml_get_widget (parent->xml, "eap_leap_username_entry");
 	g_assert (widget);
-	s_wireless_sec->identity = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
+	s_8021x->identity = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
 
 	widget = glade_xml_get_widget (parent->xml, "eap_leap_password_entry");
 	g_assert (widget);
-	s_wireless_sec->password = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
+	s_8021x->password = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
 }
 
 EAPMethodLEAP *
@@ -151,11 +150,11 @@
 	                  (GCallback) wireless_security_changed_cb,
 	                  parent);
 	if (connection) {
-		NMSettingWirelessSecurity *s_wireless_sec;
+		NMSetting8021x *s_8021x;
 
-		s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY));
-		if (s_wireless_sec && s_wireless_sec->identity)
-			gtk_entry_set_text (GTK_ENTRY (widget), s_wireless_sec->identity);
+		s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+		if (s_8021x && s_8021x->identity)
+			gtk_entry_set_text (GTK_ENTRY (widget), s_8021x->identity);
 	}
 
 	widget = glade_xml_get_widget (xml, "eap_leap_password_entry");

Modified: trunk/src/wireless-security/eap-method-peap.c
==============================================================================
--- trunk/src/wireless-security/eap-method-peap.c	(original)
+++ trunk/src/wireless-security/eap-method-peap.c	Mon Mar 17 19:52:49 2008
@@ -23,7 +23,7 @@
 #include <glade/glade.h>
 #include <ctype.h>
 #include <string.h>
-#include <nm-setting-wireless.h>
+#include <nm-setting-8021x.h>
 
 #include "eap-method.h"
 #include "wireless-security.h"
@@ -111,7 +111,7 @@
 fill_connection (EAPMethod *parent, NMConnection *connection)
 {
 	EAPMethodPEAP *method = (EAPMethodPEAP *) parent;
-	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x;
 	GtkWidget *widget;
 	const char *text;
 	char *filename;
@@ -121,11 +121,10 @@
 	int int_version = 0;
 	char *version = NULL;
 
-	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, 
-										  NM_TYPE_SETTING_WIRELESS_SECURITY));
-	g_assert (s_wireless_sec);
+	s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+	g_assert (s_8021x);
 
-	s_wireless_sec->eap = g_slist_append (s_wireless_sec->eap, g_strdup ("peap"));
+	s_8021x->eap = g_slist_append (s_8021x->eap, g_strdup ("peap"));
 
 	// FIXME: allow protocol selection and filter on device capabilities
 	// FIXME: allow pairwise cipher selection and filter on device capabilities
@@ -136,7 +135,7 @@
 	g_assert (widget);
 	text = gtk_entry_get_text (GTK_ENTRY (widget));
 	if (text && strlen (text))
-		s_wireless_sec->anonymous_identity = g_strdup (text);
+		s_8021x->anonymous_identity = g_strdup (text);
 
 	widget = glade_xml_get_widget (parent->xml, "eap_peap_ca_cert_button");
 	g_assert (widget);
@@ -159,7 +158,7 @@
 	int_version = gtk_combo_box_get_active (GTK_COMBO_BOX (widget));
 	g_assert (int_version == 0 || int_version == 1);
 	version = g_strdup_printf ("%d", int_version);
-	g_object_set (G_OBJECT (s_wireless_sec), "phase1-peapver", version, NULL);
+	g_object_set (G_OBJECT (s_8021x), "phase1-peapver", version, NULL);
 	g_free (version);
 
 	widget = glade_xml_get_widget (parent->xml, "eap_peap_inner_auth_combo");

Modified: trunk/src/wireless-security/eap-method-simple.c
==============================================================================
--- trunk/src/wireless-security/eap-method-simple.c	(original)
+++ trunk/src/wireless-security/eap-method-simple.c	Mon Mar 17 19:52:49 2008
@@ -22,7 +22,7 @@
 #include <glade/glade.h>
 #include <ctype.h>
 #include <string.h>
-#include <nm-setting-wireless.h>
+#include <nm-setting-8021x.h>
 
 #include "eap-method.h"
 #include "wireless-security.h"
@@ -87,28 +87,27 @@
 fill_connection (EAPMethod *parent, NMConnection *connection)
 {
 	EAPMethodSimple *method = (EAPMethodSimple *) parent;
-	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x;
 	GtkWidget *widget;
 
-	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, 
-										  NM_TYPE_SETTING_WIRELESS_SECURITY));
-	g_assert (s_wireless_sec);
+	s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+	g_assert (s_8021x);
 
 	switch (method->type) {
 		case EAP_METHOD_SIMPLE_TYPE_PAP:
-			s_wireless_sec->phase2_auth = g_strdup ("pap");
+			s_8021x->phase2_auth = g_strdup ("pap");
 			break;
 		case EAP_METHOD_SIMPLE_TYPE_MSCHAP:
-			s_wireless_sec->phase2_auth = g_strdup ("mschap");
+			s_8021x->phase2_auth = g_strdup ("mschap");
 			break;
 		case EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2:
-			s_wireless_sec->phase2_auth = g_strdup ("mschapv2");
+			s_8021x->phase2_auth = g_strdup ("mschapv2");
 			break;
 		case EAP_METHOD_SIMPLE_TYPE_MD5:
-			s_wireless_sec->phase2_auth = g_strdup ("md5");
+			s_8021x->phase2_auth = g_strdup ("md5");
 			break;
 		case EAP_METHOD_SIMPLE_TYPE_CHAP:
-			s_wireless_sec->phase2_auth = g_strdup ("chap");
+			s_8021x->phase2_auth = g_strdup ("chap");
 			break;
 		default:
 			g_assert_not_reached ();
@@ -117,11 +116,11 @@
 
 	widget = glade_xml_get_widget (parent->xml, "eap_simple_username_entry");
 	g_assert (widget);
-	s_wireless_sec->identity = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
+	s_8021x->identity = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
 
 	widget = glade_xml_get_widget (parent->xml, "eap_simple_password_entry");
 	g_assert (widget);
-	s_wireless_sec->password = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
+	s_8021x->password = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
 }
 
 EAPMethodSimple *
@@ -169,11 +168,11 @@
 	                  (GCallback) wireless_security_changed_cb,
 	                  parent);
 	if (connection) {
-		NMSettingWirelessSecurity *s_wireless_sec;
+		NMSetting8021x *s_8021x;
 
-		s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY));
-		if (s_wireless_sec && s_wireless_sec->identity)
-			gtk_entry_set_text (GTK_ENTRY (widget), s_wireless_sec->identity);
+		s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+		if (s_8021x && s_8021x->identity)
+			gtk_entry_set_text (GTK_ENTRY (widget), s_8021x->identity);
 	}
 
 	widget = glade_xml_get_widget (xml, "eap_simple_password_entry");

Modified: trunk/src/wireless-security/eap-method-tls.c
==============================================================================
--- trunk/src/wireless-security/eap-method-tls.c	(original)
+++ trunk/src/wireless-security/eap-method-tls.c	Mon Mar 17 19:52:49 2008
@@ -23,7 +23,7 @@
 #include <glib/gi18n.h>
 #include <ctype.h>
 #include <string.h>
-#include <nm-setting-wireless.h>
+#include <nm-setting-8021x.h>
 
 #include "gconf-helpers.h"
 #include "eap-method.h"
@@ -127,20 +127,19 @@
 fill_connection (EAPMethod *parent, NMConnection *connection)
 {
 	EAPMethodTLS *method = (EAPMethodTLS *) parent;
-	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x;
 	GtkWidget *widget;
 	char *filename;
 	char *password = NULL;
 	GError *error = NULL;
 
-	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, 
-										  NM_TYPE_SETTING_WIRELESS_SECURITY));
-	g_assert (s_wireless_sec);
+	s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+	g_assert (s_8021x);
 
 	if (method->phase2)
-		s_wireless_sec->phase2_auth = g_strdup ("tls");
+		s_8021x->phase2_auth = g_strdup ("tls");
 	else
-		s_wireless_sec->eap = g_slist_append (s_wireless_sec->eap, g_strdup ("tls"));
+		s_8021x->eap = g_slist_append (s_8021x->eap, g_strdup ("tls"));
 
 	// FIXME: allow protocol selection and filter on device capabilities
 	// FIXME: allow pairwise cipher selection and filter on device capabilities
@@ -149,7 +148,7 @@
 
 	widget = glade_xml_get_widget (parent->xml, "eap_tls_identity_entry");
 	g_assert (widget);
-	s_wireless_sec->identity = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
+	s_8021x->identity = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
 
 	widget = glade_xml_get_widget (parent->xml, "eap_tls_user_cert_button");
 	g_assert (widget);
@@ -203,14 +202,14 @@
 
 	if (method->phase2) {
 		utils_fill_one_crypto_object (connection, NMA_PATH_PHASE2_PRIVATE_KEY_TAG,
-		                              TRUE, password, &s_wireless_sec->phase2_private_key, &error);
+		                              TRUE, password, &s_8021x->phase2_private_key, &error);
 		if (error) {
 			g_warning ("Couldn't read phase2 private key: %s", error->message);
 			g_clear_error (&error);
 		}
 	} else {
 		utils_fill_one_crypto_object (connection, NMA_PATH_PRIVATE_KEY_TAG,
-		                              TRUE, password, &s_wireless_sec->private_key, &error);
+		                              TRUE, password, &s_8021x->private_key, &error);
 		if (error) {
 			g_warning ("Couldn't read private key: %s", error->message);
 			g_clear_error (&error);

Modified: trunk/src/wireless-security/eap-method-ttls.c
==============================================================================
--- trunk/src/wireless-security/eap-method-ttls.c	(original)
+++ trunk/src/wireless-security/eap-method-ttls.c	Mon Mar 17 19:52:49 2008
@@ -23,7 +23,7 @@
 #include <glade/glade.h>
 #include <ctype.h>
 #include <string.h>
-#include <nm-setting-wireless.h>
+#include <nm-setting-8021x.h>
 
 #include "eap-method.h"
 #include "wireless-security.h"
@@ -107,7 +107,7 @@
 fill_connection (EAPMethod *parent, NMConnection *connection)
 {
 	EAPMethodTTLS *method = (EAPMethodTTLS *) parent;
-	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x;
 	GtkWidget *widget;
 	const char *text;
 	char *filename;
@@ -115,11 +115,10 @@
 	GtkTreeModel *model;
 	GtkTreeIter iter;
 
-	s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, 
-										  NM_TYPE_SETTING_WIRELESS_SECURITY));
-	g_assert (s_wireless_sec);
+	s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+	g_assert (s_8021x);
 
-	s_wireless_sec->eap = g_slist_append (s_wireless_sec->eap, g_strdup ("ttls"));
+	s_8021x->eap = g_slist_append (s_8021x->eap, g_strdup ("ttls"));
 
 	// FIXME: allow protocol selection and filter on device capabilities
 	// FIXME: allow pairwise cipher selection and filter on device capabilities
@@ -130,7 +129,7 @@
 	g_assert (widget);
 	text = gtk_entry_get_text (GTK_ENTRY (widget));
 	if (text && strlen (text))
-		s_wireless_sec->anonymous_identity = g_strdup (text);
+		s_8021x->anonymous_identity = g_strdup (text);
 
 	widget = glade_xml_get_widget (parent->xml, "eap_ttls_ca_cert_button");
 	g_assert (widget);

Modified: trunk/src/wireless-security/wireless-security.c
==============================================================================
--- trunk/src/wireless-security/wireless-security.c	(original)
+++ trunk/src/wireless-security/wireless-security.c	Mon Mar 17 19:52:49 2008
@@ -26,6 +26,8 @@
 #include <glib/gi18n.h>
 
 #include <nm-setting-wireless.h>
+#include <nm-setting-wireless-security.h>
+#include <nm-setting-8021x.h>
 
 #include "wireless-security.h"
 #include "eap-method.h"
@@ -328,11 +330,11 @@
 
 		s_wireless = NM_SETTING_WIRELESS (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS));
 		if (s_wireless && s_wireless->security && !strcmp (s_wireless->security, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)) {
-			NMSettingWirelessSecurity *s_wireless_sec;
+			NMSetting8021x *s_8021x;
 
-			s_wireless_sec = NM_SETTING_WIRELESS_SECURITY (nm_connection_get_setting (connection, NM_TYPE_SETTING_WIRELESS_SECURITY));
-			if (s_wireless_sec->eap)
-				default_method = g_slist_nth_data (s_wireless_sec->eap, 0);
+			s_8021x = NM_SETTING_802_1X (nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X));
+			if (s_8021x && s_8021x->eap)
+				default_method = g_slist_nth_data (s_8021x->eap, 0);
 		}
 	}
 
@@ -398,6 +400,7 @@
 	GtkWidget *widget;
 	NMSettingWireless *s_wireless;
 	NMSettingWirelessSecurity *s_wireless_sec;
+	NMSetting8021x *s_8021x;
 	EAPMethod *eap = NULL;
 	GtkTreeModel *model;
 	GtkTreeIter iter;
@@ -409,10 +412,14 @@
 		g_free (s_wireless->security);
 	s_wireless->security = g_strdup (NM_SETTING_WIRELESS_SECURITY_SETTING_NAME);
 
-	/* Blow away the old security setting by adding a clear one */
+	/* Blow away the old wireless security setting by adding a clear one */
 	s_wireless_sec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
 	nm_connection_add_setting (connection, (NMSetting *) s_wireless_sec);
 
+	/* Blow away the old 802.1x setting by adding a clear one */
+	s_8021x = (NMSetting8021x *) nm_setting_802_1x_new ();
+	nm_connection_add_setting (connection, (NMSetting *) s_8021x);
+
 	widget = glade_xml_get_widget (sec->xml, combo_name);
 	model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget));
 	gtk_combo_box_get_active_iter (GTK_COMBO_BOX (widget), &iter);

Modified: trunk/src/wireless-security/ws-leap.c
==============================================================================
--- trunk/src/wireless-security/ws-leap.c	(original)
+++ trunk/src/wireless-security/ws-leap.c	Mon Mar 17 19:52:49 2008
@@ -101,13 +101,12 @@
 
 	s_wireless_sec->key_mgmt = g_strdup ("ieee8021x");
 	s_wireless_sec->auth_alg = g_strdup ("leap");
-	s_wireless_sec->eap = g_slist_append (s_wireless_sec->eap, g_strdup ("leap"));
 
 	widget = glade_xml_get_widget (parent->xml, "leap_username_entry");
-	s_wireless_sec->identity = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
+	s_wireless_sec->leap_username = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
 
 	widget = glade_xml_get_widget (parent->xml, "leap_password_entry");
-	s_wireless_sec->password = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
+	s_wireless_sec->leap_password = g_strdup (gtk_entry_get_text (GTK_ENTRY (widget)));
 }
 
 WirelessSecurityLEAP *



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