Thanks to dcbw and danw on irc, I managed to implement EAP-PWD support
in NetworkManager and network-manager-applet. Please find the two
patches attached.

Cheers,

-- jvoisin
From e77bfe7fed7bfc73e8fb83ab964b5cf36127dfba Mon Sep 17 00:00:00 2001
From: jvoisin <[email protected]>
Date: Wed, 18 Sep 2013 19:17:34 +0100
Subject: [PATCH] Implementation of EAP-PWD support

---
 cli/src/settings.c                                     | 2 +-
 libnm-util/nm-setting-8021x.c                          | 7 ++++---
 src/settings/plugins/ifcfg-rh/reader.c                 | 1 +
 src/settings/plugins/ifnet/connection_parser.c         | 1 +
 src/supplicant-manager/nm-supplicant-settings-verify.c | 2 +-
 5 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/cli/src/settings.c b/cli/src/settings.c
index 81e8779..1b75082 100644
--- a/cli/src/settings.c
+++ b/cli/src/settings.c
@@ -2302,7 +2302,7 @@ DEFINE_SETTER_STR_LIST_MULTI (check_and_add_802_1X_eap,
 static gboolean
 nmc_property_802_1X_set_eap (NMSetting *setting, const char *prop, const char *val, GError **error)
 {
-	const char *valid_eap[] = { "leap", "md5", "tls", "peap", "ttls", "sim", "fast", NULL };
+	const char *valid_eap[] = { "leap", "md5", "tls", "peap", "ttls", "sim", "fast", "pwd", NULL };
 	return check_and_add_802_1X_eap (setting, prop, val, valid_eap, error);
 }
 DEFINE_REMOVER_INDEX (nmc_property_802_1X_remove_idx_eap,
diff --git a/libnm-util/nm-setting-8021x.c b/libnm-util/nm-setting-8021x.c
index 58b2a44..55644e0 100644
--- a/libnm-util/nm-setting-8021x.c
+++ b/libnm-util/nm-setting-8021x.c
@@ -2395,6 +2395,7 @@ typedef struct {
 
 static EAPMethodsTable eap_methods_table[] = {
 	{ "leap", need_secrets_password, verify_identity },
+	{ "pwd", need_secrets_password, verify_identity },
 	{ "md5", need_secrets_password, verify_identity },
 	{ "pap", need_secrets_password, verify_identity },
 	{ "chap", need_secrets_password, verify_identity },
@@ -2520,7 +2521,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error)
 {
 	NMSetting8021x *self = NM_SETTING_802_1X (setting);
 	NMSetting8021xPrivate *priv = NM_SETTING_802_1X_GET_PRIVATE (self);
-	const char *valid_eap[] = { "leap", "md5", "tls", "peap", "ttls", "sim", "fast", NULL };
+	const char *valid_eap[] = { "leap", "md5", "tls", "peap", "ttls", "sim", "fast", "pwd", NULL };
 	const char *valid_phase1_peapver[] = { "0", "1", NULL };
 	const char *valid_phase1_peaplabel[] = { "0", "1", NULL };
 	const char *valid_phase1_fast_pac[] = { "0", "1", "2", "3", NULL };
@@ -3024,7 +3025,7 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
 	 * NMSetting8021x:eap:
 	 *
 	 * The allowed EAP method to be used when authenticating to the network with
-	 * 802.1x.  Valid methods are: "leap", "md5", "tls", "peap", "ttls", and
+	 * 802.1x.  Valid methods are: "leap", "md5", "tls", "peap", "ttls", "pwd" and
 	 * "fast".  Each method requires different configuration using the
 	 * properties of this object; refer to wpa_supplicant documentation for the
 	 * allowed combinations.
@@ -3036,7 +3037,7 @@ nm_setting_802_1x_class_init (NMSetting8021xClass *setting_class)
 							   "The allowed EAP method to be used when "
 							   "authenticating to the network with 802.1x. "
 							   "Valid methods are: 'leap', 'md5', 'tls', 'peap', "
-							   "'ttls', and 'fast'. Each method requires "
+							   "'ttls', 'pwd', and 'fast'. Each method requires "
 							   "different configuration using the properties of "
 							   "this setting; refer to wpa_supplicant "
 							   "documentation for the allowed combinations.",
diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c
index 6b0c693..5c34536 100644
--- a/src/settings/plugins/ifcfg-rh/reader.c
+++ b/src/settings/plugins/ifcfg-rh/reader.c
@@ -2713,6 +2713,7 @@ static EAPReader eap_readers[] = {
 	{ "mschap", eap_simple_reader, TRUE },
 	{ "mschapv2", eap_simple_reader, TRUE },
 	{ "leap", eap_simple_reader, FALSE },
+	{ "pwd", eap_simple_reader, FALSE },
 	{ "tls", eap_tls_reader, FALSE },
 	{ "peap", eap_peap_reader, FALSE },
 	{ "ttls", eap_ttls_reader, FALSE },
diff --git a/src/settings/plugins/ifnet/connection_parser.c b/src/settings/plugins/ifnet/connection_parser.c
index 9f389ae..72f4fdb 100644
--- a/src/settings/plugins/ifnet/connection_parser.c
+++ b/src/settings/plugins/ifnet/connection_parser.c
@@ -98,6 +98,7 @@ typedef struct {
 
 static EAPReader eap_readers[] = {
 	{"md5", eap_simple_reader, TRUE},
+	{"pwd", eap_simple_reader, TRUE},
 	{"pap", eap_simple_reader, TRUE},
 	{"chap", eap_simple_reader, TRUE},
 	{"mschap", eap_simple_reader, TRUE},
diff --git a/src/supplicant-manager/nm-supplicant-settings-verify.c b/src/supplicant-manager/nm-supplicant-settings-verify.c
index 143e51a..6e6d7a9 100644
--- a/src/supplicant-manager/nm-supplicant-settings-verify.c
+++ b/src/supplicant-manager/nm-supplicant-settings-verify.c
@@ -74,7 +74,7 @@ const char * key_mgmt_allowed[] = { "WPA-PSK", "WPA-EAP", "IEEE8021X", "WPA-NONE
                                     "NONE", NULL };
 const char * auth_alg_allowed[] = { "OPEN", "SHARED", "LEAP", NULL };
 const char * eap_allowed[] =      { "LEAP", "MD5", "TLS", "PEAP", "TTLS", "SIM",
-                                    "PSK", "FAST", NULL };
+                                    "PSK", "FAST", "PWD", NULL };
 
 const char * phase1_allowed[] =   {"peapver=0", "peapver=1", "peaplabel=1",
                                     "peap_outer_success=0", "include_tls_length=1",
-- 
1.8.3.2

From 33d62bb31fdb6c13fb427fbf230b86e88d5d230a Mon Sep 17 00:00:00 2001
From: jvoisin <[email protected]>
Date: Thu, 19 Sep 2013 13:41:13 +0100
Subject: [PATCH] Implement EAP-PWD support

---
 src/wireless-security/eap-method-simple.c |  3 +++
 src/wireless-security/eap-method-simple.h |  1 +
 src/wireless-security/wireless-security.c | 13 +++++++++++++
 3 files changed, 17 insertions(+)

diff --git a/src/wireless-security/eap-method-simple.c b/src/wireless-security/eap-method-simple.c
index 401eeb2..23ccb4e 100644
--- a/src/wireless-security/eap-method-simple.c
+++ b/src/wireless-security/eap-method-simple.c
@@ -125,6 +125,9 @@ fill_connection (EAPMethod *parent, NMConnection *connection)
 		case EAP_METHOD_SIMPLE_TYPE_GTC:
 			eap = "gtc";
 			break;
+		case EAP_METHOD_SIMPLE_TYPE_PWD:
+			eap = "pwd";
+			break;
 		default:
 			g_assert_not_reached ();
 			break;
diff --git a/src/wireless-security/eap-method-simple.h b/src/wireless-security/eap-method-simple.h
index 8a955dc..6f43104 100644
--- a/src/wireless-security/eap-method-simple.h
+++ b/src/wireless-security/eap-method-simple.h
@@ -30,6 +30,7 @@ typedef enum {
 	EAP_METHOD_SIMPLE_TYPE_MSCHAP,
 	EAP_METHOD_SIMPLE_TYPE_MSCHAP_V2,
 	EAP_METHOD_SIMPLE_TYPE_MD5,
+	EAP_METHOD_SIMPLE_TYPE_PWD,
 	EAP_METHOD_SIMPLE_TYPE_CHAP,
 	EAP_METHOD_SIMPLE_TYPE_GTC
 } EAPMethodSimpleType;
diff --git a/src/wireless-security/wireless-security.c b/src/wireless-security/wireless-security.c
index 73315b1..2bc7648 100644
--- a/src/wireless-security/wireless-security.c
+++ b/src/wireless-security/wireless-security.c
@@ -387,6 +387,7 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
 	EAPMethodSimple *em_md5;
 	EAPMethodTLS *em_tls;
 	EAPMethodLEAP *em_leap;
+	EAPMethodSimple *em_pwd;
 	EAPMethodFAST *em_fast;
 	EAPMethodTTLS *em_ttls;
 	EAPMethodPEAP *em_peap;
@@ -458,6 +459,18 @@ ws_802_1x_auth_combo_init (WirelessSecurity *sec,
 		item++;
 	}
 
+	em_pwd = eap_method_simple_new (sec, connection, EAP_METHOD_SIMPLE_TYPE_PWD,
+		FALSE, is_editor, secrets_only);
+	gtk_list_store_append (auth_model, &iter);
+	gtk_list_store_set (auth_model, &iter,
+		AUTH_NAME_COLUMN, _("PWD"),
+		AUTH_METHOD_COLUMN, em_pwd,
+		-1);
+	eap_method_unref (EAP_METHOD (em_pwd));
+	if (default_method && (active < 0) && !strcmp (default_method, "pwd"))
+		active = item;
+	item++;
+
 	em_fast = eap_method_fast_new (sec, connection, is_editor, secrets_only);
 	gtk_list_store_append (auth_model, &iter);
 	gtk_list_store_set (auth_model, &iter,
-- 
1.8.3.2

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
networkmanager-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to