diff --git a/ChangeLog b/ChangeLog index 1306a486d..2b5a4b74c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,44 @@ +2006-02-25 Robert Love + + Add WPA Enterprise support: + * gnome/applet/Makefile.am: Build the files nm-gconf-wso-wpa-eap.c and + nm-gconf-wso-wpa-eap.h. + * gnome/applet/nm-gconf-wso-wpa-eap.c, + gnome/applet/nm-gconf-wso-wpa-eap.h: Add WPA Enterprise Gconf + serialization and deserialization. + * gnome/applet/nm-gconf-wso-wpa-psk.c, gnome/applet/nm-gconf-wso.c, + gnome/applet/wireless-security-option.c, gnome/applet/wso-wpa-psk.c, + gnome/applet/wso-wpa-psk.h: Clean up, support new defines. + * gnome/applet/wireless-applet.glade: Add UI for configurating security + settings related to WPA Enterprise. + * gnome/applet/wireless-security-manager.c: Invoke wso_wpa_eap_new() to + instantiate WPA Enterprise wireless-security-option. + * gnome/applet/wso-wpa-eap.c, gnome/applet/wso-wpa-eap.h: New files. + Implement WPA Enterprise wireless-security-option object. + * include/NetworkManager.h: Add new NM_AUTH_TYPE_* and NM_EAP_METHOD_* + defines. Cleanup. + * libnm-util/cipher-wpa-psk-hex.c, + libnm-util/cipher-wpa-psk-passphrase.c: Cleanup. + * libnm-util/dbus-helpers.c, libnm-util/dbus-helpers.h: Add + nmu_security_serialize_wpa_eap() to serialize input to DBUS method, + nmu_security_serialize_wpa_eap_with_cipher() to serialize input + including the cipher to DBUS method, and + nmu_security_deserialize_wpa_eap() to deserialize from DBUS return + to output. + * src/Makefile.am: Build the files nm-ap-security-wpa-eap.c and + nm-ap-security-wpa-eap.h + * src/NetworkManagerAP.c: Add NM_AUTH_TYPE_WPA_EAP to + NM_802_11_CAP_KEY_MGMT_802_1X cipher to capability mapping. + * src/nm-ap-security-wpa-eap.c, src/nm-ap-security-wpa-eap.h: New + files. Implement NMAPSecurityWPA_EAP object. + * src/nm-ap-security-wpa-psk.c: Cleanup. + * src/nm-ap-security.c: Support NM_AUTH_TYPE_EAP cipher and instantiate + an NMAPSecurityWPA_EAP object via the method + nm_ap_security_wpa_eap_new_deserialize(). + * src/nm-dbus-nm.c: Cleanup. + * test/nm-tool.c: Display "Enterprise" for wireless networks providing + WPA Enterprise support. + 2006-02-24 Robert Love Patch from Timo Hoenig : diff --git a/gnome/applet/Makefile.am b/gnome/applet/Makefile.am index 66b0a9eb6..f6db52650 100644 --- a/gnome/applet/Makefile.am +++ b/gnome/applet/Makefile.am @@ -74,6 +74,8 @@ nm_applet_SOURCES = \ wso-wep-hex.h \ wso-wep-passphrase.c \ wso-wep-passphrase.h \ + wso-wpa-eap.c \ + wso-wpa-eap.h \ wso-wpa-psk.c \ wso-wpa-psk.h \ nm-gconf-wso.c \ @@ -81,6 +83,8 @@ nm_applet_SOURCES = \ nm-gconf-wso-private.h \ nm-gconf-wso-wep.c \ nm-gconf-wso-wep.h \ + nm-gconf-wso-wpa-eap.c \ + nm-gconf-wso-wpa-eap.h \ nm-gconf-wso-wpa-psk.c \ nm-gconf-wso-wpa-psk.h \ gconf-helpers.c \ diff --git a/gnome/applet/nm-gconf-wso-wpa-psk.c b/gnome/applet/nm-gconf-wso-wpa-psk.c index bb0b120af..c9ce6a969 100644 --- a/gnome/applet/nm-gconf-wso-wpa-psk.c +++ b/gnome/applet/nm-gconf-wso-wpa-psk.c @@ -39,8 +39,6 @@ struct _NMGConfWSOWPA_PSKPrivate { int wpa_version; int key_mgt; - - gboolean dispose_has_run; }; NMGConfWSOWPA_PSK * @@ -53,7 +51,7 @@ nm_gconf_wso_wpa_psk_new_deserialize_dbus (DBusMessageIter *iter, int we_cipher) int key_mgt; g_return_val_if_fail (iter != NULL, NULL); - g_return_val_if_fail ((we_cipher == NM_AUTH_CIPHER_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP) || (we_cipher == IW_AUTH_CIPHER_CCMP), NULL); + g_return_val_if_fail ((we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP) || (we_cipher == IW_AUTH_CIPHER_CCMP), NULL); if (!nmu_security_deserialize_wpa_psk (iter, &key, &key_len, &wpa_version, &key_mgt)) goto out; @@ -65,6 +63,8 @@ nm_gconf_wso_wpa_psk_new_deserialize_dbus (DBusMessageIter *iter, int we_cipher) security->priv->wpa_version = wpa_version; security->priv->key_mgt = key_mgt; + /* FIXME: Need to free 'key' ? */ + out: return security; } @@ -73,12 +73,12 @@ NMGConfWSOWPA_PSK * nm_gconf_wso_wpa_psk_new_deserialize_gconf (GConfClient *client, const char *network, int we_cipher) { NMGConfWSOWPA_PSK * security = NULL; - int wpa_version; - int key_mgt; + int wpa_version; + int key_mgt; g_return_val_if_fail (client != NULL, NULL); g_return_val_if_fail (network != NULL, NULL); - g_return_val_if_fail ((we_cipher == NM_AUTH_CIPHER_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP) || (we_cipher == IW_AUTH_CIPHER_CCMP), NULL); + g_return_val_if_fail ((we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP) || (we_cipher == IW_AUTH_CIPHER_CCMP), NULL); if (!nm_gconf_get_int_helper (client, GCONF_PATH_WIRELESS_NETWORKS, @@ -140,7 +140,6 @@ nm_gconf_wso_wpa_psk_init (NMGConfWSOWPA_PSK * self) self->priv = NM_GCONF_WSO_WPA_PSK_GET_PRIVATE (self); self->priv->wpa_version = IW_AUTH_WPA_VERSION_WPA; self->priv->key_mgt = IW_AUTH_KEY_MGMT_PSK; - self->priv->dispose_has_run = FALSE; } static void diff --git a/gnome/applet/nm-gconf-wso.c b/gnome/applet/nm-gconf-wso.c index e1b5f306b..0aecef361 100644 --- a/gnome/applet/nm-gconf-wso.c +++ b/gnome/applet/nm-gconf-wso.c @@ -29,6 +29,7 @@ #include "nm-gconf-wso.h" #include "nm-gconf-wso-private.h" #include "nm-gconf-wso-wep.h" +#include "nm-gconf-wso-wpa-eap.h" #include "nm-gconf-wso-wpa-psk.h" #include "gconf-helpers.h" #include "wireless-security-option.h" @@ -84,12 +85,16 @@ nm_gconf_wso_new_deserialize_dbus (DBusMessageIter *iter) security = NM_GCONF_WSO (nm_gconf_wso_wep_new_deserialize_dbus (iter, we_cipher)); break; - case NM_AUTH_CIPHER_AUTO: + case NM_AUTH_TYPE_WPA_PSK_AUTO: case IW_AUTH_CIPHER_TKIP: case IW_AUTH_CIPHER_CCMP: security = NM_GCONF_WSO (nm_gconf_wso_wpa_psk_new_deserialize_dbus (iter, we_cipher)); break; + case NM_AUTH_TYPE_WPA_EAP: + security = NM_GCONF_WSO (nm_gconf_wso_wpa_eap_new_deserialize_dbus (iter, we_cipher)); + break; + default: break; } @@ -126,7 +131,7 @@ nm_gconf_wso_new_deserialize_gconf (GConfClient *client, security = NM_GCONF_WSO (nm_gconf_wso_wep_new_deserialize_gconf (client, network, we_cipher)); break; - case NM_AUTH_CIPHER_AUTO: + case NM_AUTH_TYPE_WPA_PSK_AUTO: case IW_AUTH_CIPHER_TKIP: case IW_AUTH_CIPHER_CCMP: security = NM_GCONF_WSO (nm_gconf_wso_wpa_psk_new_deserialize_gconf (client, network, we_cipher)); @@ -176,7 +181,8 @@ nm_gconf_wso_set_we_cipher (NMGConfWSO *self, /* Ensure the cipher is valid */ g_return_if_fail ( - (we_cipher == NM_AUTH_CIPHER_AUTO) + (we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO) + || (we_cipher == NM_AUTH_TYPE_WPA_EAP) || (we_cipher == IW_AUTH_CIPHER_NONE) || (we_cipher == IW_AUTH_CIPHER_WEP40) || (we_cipher == IW_AUTH_CIPHER_WEP104) diff --git a/gnome/applet/wireless-applet.glade b/gnome/applet/wireless-applet.glade index 28d202d39..31a79e786 100644 --- a/gnome/applet/wireless-applet.glade +++ b/gnome/applet/wireless-applet.glade @@ -1704,7 +1704,7 @@ WEP 40/128-bit ASCII Key: False False - GTK_JUSTIFY_RIGHT + GTK_JUSTIFY_LEFT False False 1 @@ -1935,7 +1935,7 @@ Shared Key User Name: False False - GTK_JUSTIFY_RIGHT + GTK_JUSTIFY_LEFT False False 1 @@ -1963,7 +1963,7 @@ Shared Key Password: False False - GTK_JUSTIFY_RIGHT + GTK_JUSTIFY_LEFT False False 1 @@ -2070,7 +2070,7 @@ Shared Key False - + 8 True 2 @@ -2232,6 +2232,484 @@ Shared Key + + True + wpa_eap_subwindow + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + True + False + False + GTK_POS_TOP + False + False + + + + 8 + True + 8 + 2 + False + 4 + 4 + + + + True + CA Certificate File: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 5 + 6 + fill + + + + + + + True + Private Key File: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 6 + 7 + fill + + + + + + + True + Select the CA Certificate File + GTK_FILE_CHOOSER_ACTION_OPEN + True + False + False + -1 + + + 1 + 2 + 5 + 6 + fill + fill + + + + + + True + Select the Private Key File + GTK_FILE_CHOOSER_ACTION_OPEN + True + False + False + -1 + + + 1 + 2 + 6 + 7 + fill + fill + + + + + + True + Private Key Password: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 7 + 8 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 7 + 8 + + + + + + + True + Client Certificate File: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + Select the Client Certificate File + GTK_FILE_CHOOSER_ACTION_OPEN + True + False + False + -1 + + + 1 + 2 + 4 + 5 + fill + fill + + + + + + True + Identity: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Password: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + Anonymous Identity: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 3 + 4 + + + + + + + True + EAP Method: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + False + True + + + 1 + 2 + 0 + 1 + fill + fill + + + + + False + True + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True wep_passphrase_subwindow @@ -2273,7 +2751,7 @@ Shared Key Passphrase: False False - GTK_JUSTIFY_RIGHT + GTK_JUSTIFY_LEFT False False 1 diff --git a/gnome/applet/wireless-security-manager.c b/gnome/applet/wireless-security-manager.c index e06d5fa04..0153e50b5 100644 --- a/gnome/applet/wireless-security-manager.c +++ b/gnome/applet/wireless-security-manager.c @@ -34,6 +34,7 @@ #include "wso-wep-ascii.h" #include "wso-wep-hex.h" #include "wso-wep-passphrase.h" +#include "wso-wpa-eap.h" #include "wso-wpa-psk.h" struct WirelessSecurityManager @@ -89,14 +90,30 @@ gboolean wsm_set_capabilities (WirelessSecurityManager *wsm, guint32 capabilitie if (capabilities & NM_802_11_CAP_PROTO_WPA) { - if ((opt = wso_wpa_psk_new (wsm->glade_file, capabilities, FALSE))) - wsm->options = g_slist_append (wsm->options, opt); + if (capabilities & NM_802_11_CAP_KEY_MGMT_802_1X) + { + if ((opt = wso_wpa_eap_new (wsm->glade_file, capabilities, FALSE))) + wsm->options = g_slist_append (wsm->options, opt); + } + if (capabilities & NM_802_11_CAP_KEY_MGMT_PSK) + { + if ((opt = wso_wpa_psk_new (wsm->glade_file, capabilities, FALSE))) + wsm->options = g_slist_append (wsm->options, opt); + } } if (capabilities & NM_802_11_CAP_PROTO_WPA2) { - if ((opt = wso_wpa_psk_new (wsm->glade_file, capabilities, TRUE))) - wsm->options = g_slist_append (wsm->options, opt); + if (capabilities & NM_802_11_CAP_KEY_MGMT_802_1X) + { + if ((opt = wso_wpa_eap_new (wsm->glade_file, capabilities, TRUE))) + wsm->options = g_slist_append (wsm->options, opt); + } + if (capabilities & NM_802_11_CAP_KEY_MGMT_PSK) + { + if ((opt = wso_wpa_psk_new (wsm->glade_file, capabilities, TRUE))) + wsm->options = g_slist_append (wsm->options, opt); + } } if (!wsm->options) diff --git a/gnome/applet/wireless-security-option.c b/gnome/applet/wireless-security-option.c index 92ef0c33d..fed6381a3 100644 --- a/gnome/applet/wireless-security-option.c +++ b/gnome/applet/wireless-security-option.c @@ -199,7 +199,7 @@ wso_wpa_create_key_type_model (int capabilities, { GtkListStore * model; GtkTreeIter iter; - int num = 0; + int num = 1; const char * name; g_return_val_if_fail (num_added != NULL, NULL); @@ -210,7 +210,6 @@ wso_wpa_create_key_type_model (int capabilities, gtk_list_store_append (model, &iter); gtk_list_store_set (model, &iter, WPA_KEY_TYPE_NAME_COL, name, WPA_KEY_TYPE_CIPHER_COL, 0, -1); - num++; if (capabilities & NM_802_11_CAP_CIPHER_TKIP) { diff --git a/gnome/applet/wso-wpa-psk.c b/gnome/applet/wso-wpa-psk.c index cbde7fae9..ded3e16ca 100644 --- a/gnome/applet/wso-wpa-psk.c +++ b/gnome/applet/wso-wpa-psk.c @@ -38,9 +38,9 @@ struct OptData { - gboolean wpa2; - const char * entry_name; - const char * key_type_combo_name; + gboolean wpa2; + const char * entry_name; + const char * key_type_combo_name; IEEE_802_11_Cipher * hex_cipher; IEEE_802_11_Cipher * passphrase_cipher; }; @@ -127,15 +127,13 @@ key_type_combo_changed_cb (GtkComboBox *combo, int we_cipher; GtkTreeModel * model; GtkTreeIter iter; - char * str; GSList * elt; g_return_if_fail (opt != NULL); model = gtk_combo_box_get_model (combo); gtk_combo_box_get_active_iter (combo, &iter); - gtk_tree_model_get (model, &iter, WPA_KEY_TYPE_NAME_COL, &str, - WPA_KEY_TYPE_CIPHER_COL, &we_cipher, -1); + gtk_tree_model_get (model, &iter, WPA_KEY_TYPE_CIPHER_COL, &we_cipher, -1); for (elt = opt->ciphers; elt; elt = g_slist_next (elt)) { diff --git a/gnome/applet/wso-wpa-psk.h b/gnome/applet/wso-wpa-psk.h index fcd3b0068..c3515d037 100644 --- a/gnome/applet/wso-wpa-psk.h +++ b/gnome/applet/wso-wpa-psk.h @@ -25,4 +25,4 @@ WirelessSecurityOption * wso_wpa_psk_new (const char *glade_file, int capabilities, gboolean wpa2); -#endif /* WSO_WPA_PSK_HEX_H */ +#endif /* WSO_WPA_PSK_H */ diff --git a/include/NetworkManager.h b/include/NetworkManager.h index 6ae4f4170..694f5ecbe 100644 --- a/include/NetworkManager.h +++ b/include/NetworkManager.h @@ -54,7 +54,7 @@ /* * NetworkManager signals */ -#define NM_DBUS_SIGNAL_STATE_CHANGE "StateChange" +#define NM_DBUS_SIGNAL_STATE_CHANGE "StateChange" /* @@ -92,26 +92,45 @@ typedef enum NMDeviceType /* 802.11 wireless-specific device capability bits */ -#define NM_802_11_CAP_NONE 0x00000000 -#define NM_802_11_CAP_PROTO_NONE 0x00000001 -#define NM_802_11_CAP_PROTO_WEP 0x00000002 -#define NM_802_11_CAP_PROTO_WPA 0x00000004 -#define NM_802_11_CAP_PROTO_WPA2 0x00000008 -#define NM_802_11_CAP_RESERVED1 0x00000010 -#define NM_802_11_CAP_RESERVED2 0x00000020 -#define NM_802_11_CAP_KEY_MGMT_PSK 0x00000040 -#define NM_802_11_CAP_KEY_MGMT_802_1X 0x00000080 -#define NM_802_11_CAP_RESERVED3 0x00000100 -#define NM_802_11_CAP_RESERVED4 0x00000200 -#define NM_802_11_CAP_RESERVED5 0x00000400 -#define NM_802_11_CAP_RESERVED6 0x00000800 -#define NM_802_11_CAP_CIPHER_WEP40 0x00001000 -#define NM_802_11_CAP_CIPHER_WEP104 0x00002000 -#define NM_802_11_CAP_CIPHER_TKIP 0x00004000 -#define NM_802_11_CAP_CIPHER_CCMP 0x00008000 +#define NM_802_11_CAP_NONE 0x00000000 +#define NM_802_11_CAP_PROTO_NONE 0x00000001 +#define NM_802_11_CAP_PROTO_WEP 0x00000002 +#define NM_802_11_CAP_PROTO_WPA 0x00000004 +#define NM_802_11_CAP_PROTO_WPA2 0x00000008 +#define NM_802_11_CAP_RESERVED1 0x00000010 +#define NM_802_11_CAP_RESERVED2 0x00000020 +#define NM_802_11_CAP_KEY_MGMT_PSK 0x00000040 +#define NM_802_11_CAP_KEY_MGMT_802_1X 0x00000080 +#define NM_802_11_CAP_RESERVED3 0x00000100 +#define NM_802_11_CAP_RESERVED4 0x00000200 +#define NM_802_11_CAP_RESERVED5 0x00000400 +#define NM_802_11_CAP_RESERVED6 0x00000800 +#define NM_802_11_CAP_CIPHER_WEP40 0x00001000 +#define NM_802_11_CAP_CIPHER_WEP104 0x00002000 +#define NM_802_11_CAP_CIPHER_TKIP 0x00004000 +#define NM_802_11_CAP_CIPHER_CCMP 0x00008000 -/* Let wpa_supplicant figure out the cipher */ -#define NM_AUTH_CIPHER_AUTO 0x0 +/* + * NM-supported Authentication Methods + */ +#define NM_AUTH_TYPE_WPA_PSK_AUTO 0x00000000 +#define NM_AUTH_TYPE_NONE 0x00000001 +#define NM_AUTH_TYPE_WEP40 0x00000002 +#define NM_AUTH_TYPE_WPA_PSK_TKIP 0x00000004 +#define NM_AUTH_TYPE_WPA_PSK_CCMP 0x00000008 +#define NM_AUTH_TYPE_WEP104 0x00000010 +#define NM_AUTH_TYPE_WPA_EAP 0x00000020 + +/* + * EAP Methods + */ +#define NM_EAP_METHOD_MD5 0x00000001 /* EAP-MD5 */ +#define NM_EAP_METHOD_MSCHAP 0x00000002 /* EAP-MSCHAPv2 */ +#define NM_EAP_METHOD_OTP 0x00000004 /* EAP-OTP */ +#define NM_EAP_METHOD_GTC 0x00000008 /* EAP-GTC */ +#define NM_EAP_METHOD_PEAP 0x00000010 /* EAP-PEAP */ +#define NM_EAP_METHOD_TLS 0x00000020 /* EAP-TLS */ +#define NM_EAP_METHOD_TTLS 0x00000040 /* EAP-TTLS */ /* * Wireless network update types diff --git a/libnm-util/cipher-wpa-psk-hex.c b/libnm-util/cipher-wpa-psk-hex.c index f01cbf816..197925c62 100644 --- a/libnm-util/cipher-wpa-psk-hex.c +++ b/libnm-util/cipher-wpa-psk-hex.c @@ -37,7 +37,7 @@ IEEE_802_11_Cipher * cipher_wpa_psk_hex_new (void) IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->refcount = 1; - cipher->we_cipher = NM_AUTH_CIPHER_AUTO; + cipher->we_cipher = NM_AUTH_TYPE_WPA_PSK_AUTO; cipher->input_min = HEXSTR_WPA_PMK_LEN; cipher->input_max = HEXSTR_WPA_PMK_LEN; cipher->cipher_hash_func = cipher_wpa_psk_hex_hash_func; @@ -50,8 +50,8 @@ IEEE_802_11_Cipher * cipher_wpa_psk_hex_new (void) void cipher_wpa_psk_hex_set_we_cipher (IEEE_802_11_Cipher *cipher, int we_cipher) { g_return_if_fail (cipher != NULL); - g_return_if_fail ((we_cipher == NM_AUTH_CIPHER_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP) || (we_cipher == IW_AUTH_CIPHER_CCMP)); - g_return_if_fail ((cipher->we_cipher == NM_AUTH_CIPHER_AUTO || cipher->we_cipher == IW_AUTH_CIPHER_TKIP) || (cipher->we_cipher == IW_AUTH_CIPHER_CCMP)); + g_return_if_fail ((we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP) || (we_cipher == IW_AUTH_CIPHER_CCMP)); + g_return_if_fail ((cipher->we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO || cipher->we_cipher == IW_AUTH_CIPHER_TKIP) || (cipher->we_cipher == IW_AUTH_CIPHER_CCMP)); cipher->we_cipher = we_cipher; } diff --git a/libnm-util/cipher-wpa-psk-passphrase.c b/libnm-util/cipher-wpa-psk-passphrase.c index 53e0719fc..c576ad071 100644 --- a/libnm-util/cipher-wpa-psk-passphrase.c +++ b/libnm-util/cipher-wpa-psk-passphrase.c @@ -38,7 +38,7 @@ IEEE_802_11_Cipher * cipher_wpa_psk_passphrase_new (void) IEEE_802_11_Cipher * cipher = g_malloc0 (sizeof (IEEE_802_11_Cipher)); cipher->refcount = 1; - cipher->we_cipher = NM_AUTH_CIPHER_AUTO; + cipher->we_cipher = NM_AUTH_TYPE_WPA_PSK_AUTO; /* Passphrase between 8 and 63 characters inclusive */ cipher->input_min = 8; cipher->input_max = (WPA_PMK_LEN * 2) - 1; @@ -52,8 +52,8 @@ IEEE_802_11_Cipher * cipher_wpa_psk_passphrase_new (void) void cipher_wpa_psk_passphrase_set_we_cipher (IEEE_802_11_Cipher *cipher, int we_cipher) { g_return_if_fail (cipher != NULL); - g_return_if_fail ((we_cipher == NM_AUTH_CIPHER_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP) || (we_cipher == IW_AUTH_CIPHER_CCMP)); - g_return_if_fail ((cipher->we_cipher == NM_AUTH_CIPHER_AUTO || cipher->we_cipher == IW_AUTH_CIPHER_TKIP) || (cipher->we_cipher == IW_AUTH_CIPHER_CCMP)); + g_return_if_fail ((we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP) || (we_cipher == IW_AUTH_CIPHER_CCMP)); + g_return_if_fail ((cipher->we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO || cipher->we_cipher == IW_AUTH_CIPHER_TKIP) || (cipher->we_cipher == IW_AUTH_CIPHER_CCMP)); cipher->we_cipher = we_cipher; } diff --git a/libnm-util/dbus-helpers.c b/libnm-util/dbus-helpers.c index 4b9ad580c..38bf32e90 100644 --- a/libnm-util/dbus-helpers.c +++ b/libnm-util/dbus-helpers.c @@ -24,6 +24,7 @@ #include #include +#include "NetworkManager.h" #include "dbus-helpers.h" #include "cipher.h" @@ -163,10 +164,10 @@ nmu_security_serialize_wpa_psk (DBusMessageIter *iter, dbus_bool_t nmu_security_deserialize_wpa_psk (DBusMessageIter *iter, - char **key, - int *key_len, - int *wpa_version, - int *key_mgt) + char **key, + int *key_len, + int *wpa_version, + int *key_mgt) { char * dbus_key; dbus_int32_t dbus_wpa_version; @@ -208,13 +209,14 @@ nmu_security_deserialize_wpa_psk (DBusMessageIter *iter, return TRUE; } + dbus_bool_t nmu_security_serialize_wpa_psk_with_cipher (DBusMessage *message, - IEEE_802_11_Cipher *cipher, - const char *ssid, - const char *input, - int wpa_version, - int key_mgt) + IEEE_802_11_Cipher *cipher, + const char *ssid, + const char *input, + int wpa_version, + int key_mgt) { char * key = NULL; dbus_bool_t result = TRUE; @@ -238,6 +240,206 @@ nmu_security_serialize_wpa_psk_with_cipher (DBusMessage *message, } +dbus_bool_t +nmu_security_serialize_wpa_eap (DBusMessageIter *iter, + int eap_method, + const char *identity, + const char *passwd, + const char *anon_identity, + const char *private_key_passwd, + const char *private_key_file, + const char *client_cert_file, + const char *ca_cert_file, + int wpa_version) +{ + g_return_val_if_fail (iter != NULL, FALSE); + g_return_val_if_fail ((wpa_version == IW_AUTH_WPA_VERSION_WPA) || (wpa_version == IW_AUTH_WPA_VERSION_WPA2), FALSE); + g_return_val_if_fail ((eap_method == NM_EAP_METHOD_MD5) + || (eap_method == NM_EAP_METHOD_MSCHAP) + || (eap_method == NM_EAP_METHOD_OTP) + || (eap_method == NM_EAP_METHOD_GTC) + || (eap_method == NM_EAP_METHOD_PEAP) + || (eap_method == NM_EAP_METHOD_TLS) + || (eap_method == NM_EAP_METHOD_TTLS), FALSE); + + /* Second arg: EAP method (INT32) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_INT32, &eap_method); + + /* Third arg: Identity (STRING) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &identity); + + /* Fourth arg: Password (STRING) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &passwd); + + /* Fifth arg: Anonymous Identity (STRING) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &anon_identity); + + /* Sixth arg: Private key password (STRING) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &private_key_passwd); + + /* Seventh arg: Private key file (STRING) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &private_key_file); + + /* Eighth arg: Client certificate file (STRING) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &client_cert_file); + + /* Ninth arg: CA certificate file (STRING) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_STRING, &ca_cert_file); + + /* Tenth and final arg: WPA version (INT32) */ + dbus_message_iter_append_basic (iter, DBUS_TYPE_INT32, &wpa_version); + + return TRUE; +} + + +dbus_bool_t +nmu_security_serialize_wpa_eap_with_cipher (DBusMessageIter *iter, + int eap_method, + const char *identity, + const char *passwd, + const char *anon_identity, + const char *private_key_passwd, + const char *private_key_file, + const char *client_cert_file, + const char *ca_cert_file, + int wpa_version) +{ + dbus_bool_t result; + + g_return_val_if_fail (iter != NULL, FALSE); + g_return_val_if_fail ((wpa_version == IW_AUTH_WPA_VERSION_WPA) || (wpa_version == IW_AUTH_WPA_VERSION_WPA2), FALSE); + g_return_val_if_fail ((eap_method == NM_EAP_METHOD_MD5) + || (eap_method == NM_EAP_METHOD_MSCHAP) + || (eap_method == NM_EAP_METHOD_OTP) + || (eap_method == NM_EAP_METHOD_GTC) + || (eap_method == NM_EAP_METHOD_PEAP) + || (eap_method == NM_EAP_METHOD_TLS) + || (eap_method == NM_EAP_METHOD_TTLS), FALSE); + + /* First arg: WE Cipher (INT32) */ + we_cipher_append_helper (iter, NM_AUTH_TYPE_WPA_EAP); + + result = nmu_security_serialize_wpa_eap (iter, eap_method, identity, passwd, anon_identity, private_key_passwd, + private_key_file, client_cert_file, ca_cert_file, wpa_version); + + return result; +} + + +dbus_bool_t +nmu_security_deserialize_wpa_eap (DBusMessageIter *iter, + int *eap_method, + char **identity, + char **passwd, + char **anon_identity, + char **private_key_passwd, + char **private_key_file, + char **client_cert_file, + char **ca_cert_file, + int *wpa_version) +{ + char * dbus_identity; + char * dbus_password; + char * dbus_anon_identity; + char * dbus_private_key_passwd; + char * dbus_private_key_file; + char * dbus_client_cert_file; + char * dbus_ca_cert_file; + dbus_int32_t dbus_wpa_version; + dbus_int32_t dbus_eap_method; + + g_return_val_if_fail (iter != NULL, FALSE); + g_return_val_if_fail (identity != NULL, FALSE); + g_return_val_if_fail (*identity == NULL, FALSE); + g_return_val_if_fail (passwd != NULL, FALSE); + g_return_val_if_fail (*passwd == NULL, FALSE); + g_return_val_if_fail (anon_identity != NULL, FALSE); + g_return_val_if_fail (*anon_identity == NULL, FALSE); + g_return_val_if_fail (private_key_passwd != NULL, FALSE); + g_return_val_if_fail (*private_key_passwd == NULL, FALSE); + g_return_val_if_fail (private_key_file != NULL, FALSE); + g_return_val_if_fail (*private_key_file == NULL, FALSE); + g_return_val_if_fail (client_cert_file != NULL, FALSE); + g_return_val_if_fail (*client_cert_file == NULL, FALSE); + g_return_val_if_fail (ca_cert_file != NULL, FALSE); + g_return_val_if_fail (*ca_cert_file == NULL, FALSE); + g_return_val_if_fail (wpa_version != NULL, FALSE); + + /* Second arg: EAP method (INT32) */ + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_INT32, FALSE); + dbus_message_iter_get_basic (iter, &dbus_eap_method); + g_return_val_if_fail ((dbus_eap_method == NM_EAP_METHOD_MD5) + || (dbus_eap_method == NM_EAP_METHOD_MSCHAP) + || (dbus_eap_method == NM_EAP_METHOD_OTP) + || (dbus_eap_method == NM_EAP_METHOD_GTC) + || (dbus_eap_method == NM_EAP_METHOD_PEAP) + || (dbus_eap_method == NM_EAP_METHOD_TLS) + || (dbus_eap_method == NM_EAP_METHOD_TTLS), FALSE); + + /* Third arg: Identity (STRING) */ + g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); + dbus_message_iter_get_basic (iter, &dbus_identity); + g_return_val_if_fail (dbus_identity != NULL, FALSE); + + /* Fourth arg: Password (STRING) */ + g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); + dbus_message_iter_get_basic (iter, &dbus_password); + g_return_val_if_fail (dbus_password != NULL, FALSE); + + /* Fifth arg: Anonymous Identity (STRING) */ + g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); + dbus_message_iter_get_basic (iter, &dbus_anon_identity); + g_return_val_if_fail (dbus_anon_identity != NULL, FALSE); + + /* Sixth arg: Private key password (STRING) */ + g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); + dbus_message_iter_get_basic (iter, &dbus_private_key_passwd); + g_return_val_if_fail (dbus_private_key_passwd != NULL, FALSE); + + /* Seventh arg: Private key file (STRING) */ + g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); + dbus_message_iter_get_basic (iter, &dbus_private_key_file); + g_return_val_if_fail (dbus_private_key_file != NULL, FALSE); + + /* Eighth arg: Client certificate file (STRING) */ + g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); + dbus_message_iter_get_basic (iter, &dbus_client_cert_file); + g_return_val_if_fail (dbus_client_cert_file != NULL, FALSE); + + /* Ninth arg: CA certificate file (STRING) */ + g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_STRING, FALSE); + dbus_message_iter_get_basic (iter, &dbus_ca_cert_file); + g_return_val_if_fail (dbus_ca_cert_file != NULL, FALSE); + + /* Tenth and final arg: WPA version (INT32) */ + g_return_val_if_fail (dbus_message_iter_next (iter), FALSE); + g_return_val_if_fail (dbus_message_iter_get_arg_type (iter) == DBUS_TYPE_INT32, FALSE); + dbus_message_iter_get_basic (iter, &dbus_wpa_version); + g_return_val_if_fail ((dbus_wpa_version == IW_AUTH_WPA_VERSION_WPA) + || (dbus_wpa_version == IW_AUTH_WPA_VERSION_WPA2), FALSE); + + *eap_method = dbus_eap_method; + *identity = strlen (dbus_identity) > 0 ? dbus_identity : NULL; + *passwd = strlen (dbus_password) > 0 ? dbus_password : NULL; + *anon_identity = strlen (dbus_anon_identity) > 0 ? dbus_anon_identity : NULL; + *private_key_passwd = strlen (dbus_private_key_passwd) > 0 ? dbus_private_key_passwd : NULL; + *private_key_file = strlen (dbus_private_key_file) > 0 ? dbus_private_key_file : NULL; + *client_cert_file = strlen (dbus_client_cert_file) > 0 ? dbus_client_cert_file : NULL; + *ca_cert_file = strlen (dbus_ca_cert_file) > 0 ? dbus_ca_cert_file : NULL; + *wpa_version = dbus_wpa_version; + + return TRUE; +} + + /* * nmu_create_dbus_error_message * diff --git a/libnm-util/dbus-helpers.h b/libnm-util/dbus-helpers.h index 553938d6e..713f425eb 100644 --- a/libnm-util/dbus-helpers.h +++ b/libnm-util/dbus-helpers.h @@ -65,6 +65,39 @@ dbus_bool_t nmu_security_serialize_wpa_psk_with_cipher (DBusMessage *message, int wpa_version, int key_mgt); +dbus_bool_t nmu_security_serialize_wpa_eap (DBusMessageIter *iter, + int eap_method, + const char *identity, + const char *passwd, + const char *anon_identity, + const char *private_key_passwd, + const char *private_key_file, + const char *client_cert_file, + const char *ca_cert_file, + int wpa_version); + +dbus_bool_t nmu_security_serialize_wpa_eap_with_cipher (DBusMessageIter *iter, + int eap_method, + const char *identity, + const char *passwd, + const char *anon_identity, + const char *private_key_passwd, + const char *private_key_file, + const char *client_cert_file, + const char *ca_cert_file, + int wpa_version); + +dbus_bool_t nmu_security_deserialize_wpa_eap (DBusMessageIter *iter, + int *eap_method, + char **identity, + char **passwd, + char **anon_identity, + char **private_key_passwd, + char **private_key_file, + char **client_cert_file, + char **ca_cert_file, + int *wpa_version); + DBusMessage * nmu_create_dbus_error_message (DBusMessage *message, const char *exception_namespace, const char *exception, diff --git a/src/Makefile.am b/src/Makefile.am index 036af0797..798bf13d4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -56,6 +56,8 @@ NetworkManager_SOURCES = \ nm-ap-security-private.h \ nm-ap-security-wep.c \ nm-ap-security-wep.h \ + nm-ap-security-wpa-eap.c \ + nm-ap-security-wpa-eap.h \ nm-ap-security-wpa-psk.c \ nm-ap-security-wpa-psk.h \ kernel-types.h \ diff --git a/src/NetworkManagerAP.c b/src/NetworkManagerAP.c index 84bc0640d..d616cb8f4 100644 --- a/src/NetworkManagerAP.c +++ b/src/NetworkManagerAP.c @@ -578,11 +578,17 @@ static guint32 add_capabilities_from_cipher (guint32 caps, int cipher) caps &= ~NM_802_11_CAP_PROTO_NONE; } - if (cipher == NM_AUTH_CIPHER_AUTO) + if (cipher == NM_AUTH_TYPE_WPA_PSK_AUTO) { caps &= ~NM_802_11_CAP_PROTO_NONE; } + if (cipher == NM_AUTH_TYPE_WPA_EAP) + { + caps |= NM_802_11_CAP_KEY_MGMT_802_1X; + caps &= ~NM_802_11_CAP_PROTO_NONE; + } + return caps; } diff --git a/src/nm-ap-security-wpa-psk.c b/src/nm-ap-security-wpa-psk.c index f522c8ea5..18b83b2d4 100644 --- a/src/nm-ap-security-wpa-psk.c +++ b/src/nm-ap-security-wpa-psk.c @@ -74,7 +74,7 @@ nm_ap_security_wpa_psk_new_deserialize (DBusMessageIter *iter, int we_cipher) int key_mgt; g_return_val_if_fail (iter != NULL, NULL); - g_return_val_if_fail (we_cipher == NM_AUTH_CIPHER_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP || we_cipher == IW_AUTH_CIPHER_CCMP, NULL); + g_return_val_if_fail (we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP || we_cipher == IW_AUTH_CIPHER_CCMP, NULL); if (!nmu_security_deserialize_wpa_psk (iter, &key, &key_len, &wpa_version, &key_mgt)) goto out; @@ -83,7 +83,7 @@ nm_ap_security_wpa_psk_new_deserialize (DBusMessageIter *iter, int we_cipher) security = g_object_new (NM_TYPE_AP_SECURITY_WPA_PSK, NULL); nm_ap_security_set_we_cipher (NM_AP_SECURITY (security), we_cipher); if (key) - nm_ap_security_set_key (NM_AP_SECURITY (security), key, key_len); + nm_ap_security_set_key (NM_AP_SECURITY (security), key, key_len); /* FIXME: Free 'key' ? */ security->priv->wpa_version = wpa_version; security->priv->key_mgt = key_mgt; @@ -100,7 +100,7 @@ nm_ap_security_wpa_psk_new_from_ap (NMAccessPoint *ap, int we_cipher) guint32 caps; g_return_val_if_fail (ap != NULL, NULL); - g_return_val_if_fail (we_cipher == NM_AUTH_CIPHER_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP || (we_cipher == IW_AUTH_CIPHER_CCMP), NULL); + g_return_val_if_fail (we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO || we_cipher == IW_AUTH_CIPHER_TKIP || (we_cipher == IW_AUTH_CIPHER_CCMP), NULL); security = g_object_new (NM_TYPE_AP_SECURITY_WPA_PSK, NULL); nm_ap_security_set_we_cipher (NM_AP_SECURITY (security), we_cipher); @@ -193,7 +193,7 @@ real_write_supplicant_config (NMAPSecurity *instance, pairwise_cipher = "NONE"; /* If user selected "Automatic", we let wpa_supplicant sort it out */ - if (cipher != NM_AUTH_CIPHER_AUTO) + if (cipher != NM_AUTH_TYPE_WPA_PSK_AUTO) { if (!nm_utils_supplicant_request_with_check (ctrl, "OK", __func__, NULL, "SET_NETWORK %i pairwise %s", nwid, pairwise_cipher)) diff --git a/src/nm-ap-security.c b/src/nm-ap-security.c index 18e542983..1722e9fde 100644 --- a/src/nm-ap-security.c +++ b/src/nm-ap-security.c @@ -28,6 +28,7 @@ #include "nm-ap-security-private.h" #include "nm-ap-security-wep.h" #include "nm-ap-security-wpa-psk.h" +#include "nm-ap-security-wpa-eap.h" #include "nm-device-802-11-wireless.h" #include "wpa_ctrl.h" #include "nm-utils.h" @@ -85,13 +86,18 @@ nm_ap_security_new_deserialize (DBusMessageIter *iter) security = NM_AP_SECURITY (nm_ap_security_wep_new_deserialize (iter, we_cipher)); break; - case NM_AUTH_CIPHER_AUTO: + case NM_AUTH_TYPE_WPA_PSK_AUTO: case IW_AUTH_CIPHER_TKIP: case IW_AUTH_CIPHER_CCMP: security = NM_AP_SECURITY (nm_ap_security_wpa_psk_new_deserialize (iter, we_cipher)); break; + case NM_AUTH_TYPE_WPA_EAP: + security = NM_AP_SECURITY (nm_ap_security_wpa_eap_new_deserialize (iter)); + break; + default: + nm_warning ("Unmatched cipher %d", we_cipher); break; } } @@ -103,8 +109,10 @@ out: #define WPA2_CCMP_PSK (NM_802_11_CAP_PROTO_WPA2 | NM_802_11_CAP_CIPHER_CCMP | NM_802_11_CAP_KEY_MGMT_PSK) #define WPA2_TKIP_PSK (NM_802_11_CAP_PROTO_WPA2 | NM_802_11_CAP_CIPHER_TKIP | NM_802_11_CAP_KEY_MGMT_PSK) +#define WPA2_EAP (NM_802_11_CAP_PROTO_WPA2 | NM_802_11_CAP_KEY_MGMT_802_1X) #define WPA_CCMP_PSK (NM_802_11_CAP_PROTO_WPA | NM_802_11_CAP_CIPHER_CCMP | NM_802_11_CAP_KEY_MGMT_PSK) #define WPA_TKIP_PSK (NM_802_11_CAP_PROTO_WPA | NM_802_11_CAP_CIPHER_TKIP | NM_802_11_CAP_KEY_MGMT_PSK) +#define WPA_EAP (NM_802_11_CAP_PROTO_WPA | NM_802_11_CAP_KEY_MGMT_802_1X) #define WEP_WEP104 (NM_802_11_CAP_PROTO_WEP | NM_802_11_CAP_CIPHER_WEP104) #define WEP_WEP40 (NM_802_11_CAP_PROTO_WEP | NM_802_11_CAP_CIPHER_WEP40) NMAPSecurity * @@ -121,6 +129,8 @@ nm_ap_security_new_from_ap (NMAccessPoint *ap) security = NM_AP_SECURITY (nm_ap_security_wpa_psk_new_from_ap (ap, IW_AUTH_CIPHER_CCMP)); else if ((caps & WPA_TKIP_PSK) || (caps & WPA2_TKIP_PSK)) security = NM_AP_SECURITY (nm_ap_security_wpa_psk_new_from_ap (ap, IW_AUTH_CIPHER_TKIP)); + else if ((caps & WPA_EAP) || (caps & WPA2_EAP)) + security = NM_AP_SECURITY (nm_ap_security_wpa_eap_new_from_ap (ap)); else if (caps & WEP_WEP104) security = NM_AP_SECURITY (nm_ap_security_wep_new_from_ap (ap, IW_AUTH_CIPHER_WEP104)); else if (caps & WEP_WEP40) @@ -153,18 +163,23 @@ nm_ap_security_set_we_cipher (NMAPSecurity *self, int we_cipher) { g_return_if_fail (self != NULL); - /* Ensure the cipher is valid */ + /* Ensure that the cipher is valid */ g_return_if_fail ( - (we_cipher == NM_AUTH_CIPHER_AUTO) + (we_cipher == NM_AUTH_TYPE_WPA_PSK_AUTO) || (we_cipher == IW_AUTH_CIPHER_NONE) || (we_cipher == IW_AUTH_CIPHER_WEP40) || (we_cipher == IW_AUTH_CIPHER_WEP104) || (we_cipher == IW_AUTH_CIPHER_TKIP) - || (we_cipher == IW_AUTH_CIPHER_CCMP)); + || (we_cipher == IW_AUTH_CIPHER_CCMP) + || (we_cipher == NM_AUTH_TYPE_WPA_EAP)); self->priv->we_cipher = we_cipher; } +/* + * nm_ap_security_set_key - set the encryption key for a given AP + * + */ void nm_ap_security_set_key (NMAPSecurity *self, const char *key, int key_len) { @@ -211,7 +226,7 @@ real_write_supplicant_config (NMAPSecurity *self, int nm_ap_security_get_we_cipher (NMAPSecurity *self) { - g_return_val_if_fail (self != NULL, NM_AUTH_CIPHER_AUTO); + g_return_val_if_fail (self != NULL, NM_AUTH_TYPE_WPA_PSK_AUTO); return self->priv->we_cipher; } diff --git a/src/nm-dbus-nm.c b/src/nm-dbus-nm.c index bd8c50f89..ce6c4aaa0 100644 --- a/src/nm-dbus-nm.c +++ b/src/nm-dbus-nm.c @@ -323,8 +323,8 @@ out: */ static DBusMessage *nm_dbus_nm_create_wireless_network (DBusConnection *connection, DBusMessage *message, NMDbusCBData *data) { - const char * INVALID_ARGS_ERROR = "InvalidArguments"; - const char * INVALID_ARGS_MESSAGE = "NetworkManager::createWirelessNetwork called with invalid arguments."; + const char * INVALID_ARGS_ERROR = "InvalidArguments"; + const char * INVALID_ARGS_MESSAGE = "NetworkManager::createWirelessNetwork called with invalid arguments."; NMDevice * dev = NULL; DBusMessage * reply = NULL; char * dev_path = NULL; diff --git a/test/nm-tool.c b/test/nm-tool.c index 82d339256..601c26608 100644 --- a/test/nm-tool.c +++ b/test/nm-tool.c @@ -172,6 +172,12 @@ static void detail_network (DBusConnection *connection, const char *path, const enc_string = g_string_append_c (enc_string, ' '); enc_string = g_string_append (enc_string, "WPA2"); } + if (capabilities & NM_802_11_CAP_KEY_MGMT_802_1X) + { + if (enc_string->str && (strlen (enc_string->str) > 0)) + enc_string = g_string_append_c (enc_string, ' '); + enc_string = g_string_append (enc_string, "Enterprise"); + } if (enc_string->str && (strlen (enc_string->str) > 0)) { enc_string = g_string_prepend (enc_string, ", Encrypted (");