static void access_point_added_proxy (DBusGProxy *proxy, char *path, gpointer user_data) { NMDeviceWifi *self = NM_DEVICE_WIFI (user_data); NMDeviceWifiPrivate *priv; GObject *ap; g_return_if_fail (self != NULL); ap = G_OBJECT (nm_device_wifi_get_access_point_by_path (self, path)); if (!ap) { DBusGConnection *connection = nm_object_get_connection (NM_OBJECT (self)); priv = NM_DEVICE_WIFI_GET_PRIVATE (self); ap = G_OBJECT (_nm_object_cache_get (path)); if (ap) { g_ptr_array_add (priv->aps, g_object_ref (ap)); } else { ap = G_OBJECT (nm_access_point_new (connection, path)); if (ap) g_ptr_array_add (priv->aps, ap); } } if (ap) g_signal_emit (self, signals[ACCESS_POINT_ADDED], 0, NM_ACCESS_POINT (ap)); }
static void access_point_removed_proxy (DBusGProxy *proxy, char *path, gpointer user_data) { NMDeviceWifi *self = NM_DEVICE_WIFI (user_data); NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); NMAccessPoint *ap; g_return_if_fail (self != NULL); ap = nm_device_wifi_get_access_point_by_path (self, path); if (ap) { if (ap == priv->active_ap) { g_object_unref (priv->active_ap); priv->active_ap = NULL; priv->null_active_ap = FALSE; _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT); priv->rate = 0; _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIFI_BITRATE); } g_signal_emit (self, signals[ACCESS_POINT_REMOVED], 0, ap); g_ptr_array_remove (priv->aps, ap); g_object_unref (G_OBJECT (ap)); } }
void cc_network_panel_connect_to_8021x_network (CcNetworkPanel *panel, NMClient *client, NMRemoteSettings *settings, NMDevice *device, const gchar *arg_access_point) { NMConnection *connection; NMSettingConnection *s_con; NMSettingWireless *s_wifi; NMSettingWirelessSecurity *s_wsec; NMSetting8021x *s_8021x; NM80211ApSecurityFlags wpa_flags, rsn_flags; GtkWidget *dialog; char *uuid; NMAccessPoint *ap; g_debug ("connect to 8021x wifi"); ap = nm_device_wifi_get_access_point_by_path (NM_DEVICE_WIFI (device), arg_access_point); if (ap == NULL) { g_warning ("didn't find access point with path %s", arg_access_point); return; } /* If the AP is WPA[2]-Enterprise then we need to set up a minimal 802.1x * setting and ask the user for more information. */ rsn_flags = nm_access_point_get_rsn_flags (ap); wpa_flags = nm_access_point_get_wpa_flags (ap); if (!(rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X) && !(wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)) { g_warning ("Network panel loaded with connect-8021x-wifi but the " "access point does not support 802.1x"); return; } connection = nm_connection_new (); /* Need a UUID for the "always ask" stuff in the Dialog of Doom */ s_con = (NMSettingConnection *) nm_setting_connection_new (); uuid = nm_utils_uuid_generate (); g_object_set (s_con, NM_SETTING_CONNECTION_UUID, uuid, NULL); g_free (uuid); nm_connection_add_setting (connection, NM_SETTING (s_con)); s_wifi = (NMSettingWireless *) nm_setting_wireless_new (); nm_connection_add_setting (connection, NM_SETTING (s_wifi)); g_object_set (s_wifi, NM_SETTING_WIRELESS_SSID, nm_access_point_get_ssid (ap), NM_SETTING_WIRELESS_SEC, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NULL); s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new (); g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "wpa-eap", NULL); nm_connection_add_setting (connection, NM_SETTING (s_wsec)); s_8021x = (NMSetting8021x *) nm_setting_802_1x_new (); nm_setting_802_1x_add_eap_method (s_8021x, "ttls"); g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "mschapv2", NULL); nm_connection_add_setting (connection, NM_SETTING (s_8021x)); dialog = nma_wireless_dialog_new (client, settings, connection, device, ap, FALSE); show_wireless_dialog (panel, client, settings, dialog); }