[gnome-control-center/gnome-3-4] Revert "NM user connections"



commit 1ad6f1054a42f788338854077471331f27f79531
Author: Michael Biebl <biebl debian org>
Date:   Tue Mar 14 22:50:38 2017 +0100

    Revert "NM user connections"
    
    This reverts commit 66f7d308626bd901172b5cf9d0dc3e454265484a.

 panels/network/cc-network-panel.c             |   44 +++++++-----------------
 panels/network/network-dialogs.c              |   16 ---------
 panels/network/network-dialogs.h              |    2 -
 panels/network/panel-cell-renderer-security.h |    4 +-
 4 files changed, 15 insertions(+), 51 deletions(-)
---
diff --git a/panels/network/cc-network-panel.c b/panels/network/cc-network-panel.c
index 3d10fed..b673597 100644
--- a/panels/network/cc-network-panel.c
+++ b/panels/network/cc-network-panel.c
@@ -927,16 +927,20 @@ get_access_point_security (NMAccessPoint *ap)
         wpa_flags = nm_access_point_get_wpa_flags (ap);
         rsn_flags = nm_access_point_get_rsn_flags (ap);
 
-        if ((rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK) ||
-            (wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_PSK))
-                type = NM_AP_SEC_WPA_PSK;
-        else if (rsn_flags != NM_802_11_AP_SEC_NONE ||
-                 wpa_flags != NM_802_11_AP_SEC_NONE)
-                type = NM_AP_SEC_WPA_OTHER;
-        else if (flags & NM_802_11_AP_FLAGS_PRIVACY)
+        if (!(flags & NM_802_11_AP_FLAGS_PRIVACY) &&
+            wpa_flags == NM_802_11_AP_SEC_NONE &&
+            rsn_flags == NM_802_11_AP_SEC_NONE)
+                type = NM_AP_SEC_NONE;
+        else if ((flags & NM_802_11_AP_FLAGS_PRIVACY) &&
+                 wpa_flags == NM_802_11_AP_SEC_NONE &&
+                 rsn_flags == NM_802_11_AP_SEC_NONE)
                 type = NM_AP_SEC_WEP;
+        else if (!(flags & NM_802_11_AP_FLAGS_PRIVACY) &&
+                 wpa_flags != NM_802_11_AP_SEC_NONE &&
+                 rsn_flags != NM_802_11_AP_SEC_NONE)
+                type = NM_AP_SEC_WPA;
         else
-                type = NM_AP_SEC_NONE;
+                type = NM_AP_SEC_WPA2;
 
         return type;
 }
@@ -2822,7 +2826,6 @@ wireless_ap_changed_cb (GtkComboBox *combo_box, CcNetworkPanel *panel)
         gboolean ret;
         gchar *object_path = NULL;
         gchar *ssid_target = NULL;
-        NMAccessPointSecurity security = NM_AP_SEC_UNKNOWN;
         GSList *list, *l;
         GSList *filtered;
         GtkTreeIter iter;
@@ -2830,7 +2833,6 @@ wireless_ap_changed_cb (GtkComboBox *combo_box, CcNetworkPanel *panel)
         NetObject *object;
         NMConnection *connection;
         NMConnection *connection_activate = NULL;
-        NMConnection *connection_partial = NULL;
         NMDevice *device;
         NMSettingWireless *setting_wireless;
 
@@ -2854,7 +2856,6 @@ wireless_ap_changed_cb (GtkComboBox *combo_box, CcNetworkPanel *panel)
         gtk_tree_model_get (model, &iter,
                             PANEL_WIRELESS_COLUMN_ID, &object_path,
                             PANEL_WIRELESS_COLUMN_TITLE, &ssid_target,
-                            PANEL_WIRELESS_COLUMN_SECURITY, &security,
                             -1);
         g_debug ("try to connect to WIFI network %s [%s]",
                  ssid_target, object_path);
@@ -2902,27 +2903,8 @@ wireless_ap_changed_cb (GtkComboBox *combo_box, CcNetworkPanel *panel)
         /* create one, as it's missing */
         g_debug ("no existing connection found for %s, creating",
                  ssid_target);
-        if (cc_network_panel_default_to_private_connection (panel->priv->client)) {
-                NMSettingConnection *s_con;
-
-                connection_partial = nm_connection_new ();
-                s_con = (NMSettingConnection *) nm_setting_connection_new ();
-                nm_setting_connection_add_permission (s_con, "user", g_get_user_name(), NULL);
-                nm_connection_add_setting (connection_partial, NM_SETTING (s_con));
-
-                if (security == NM_AP_SEC_WPA_PSK) {
-                        NMSettingWirelessSecurity *s_wsec = (NMSettingWirelessSecurity *) 
nm_setting_wireless_security_new ();
-                        g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_PSK_FLAGS, 
NM_SETTING_SECRET_FLAG_AGENT_OWNED, NULL);
-                        nm_connection_add_setting (connection_partial, NM_SETTING (s_wsec));
-                }
-                if (security == NM_AP_SEC_WEP) {
-                        NMSettingWirelessSecurity *s_wsec = (NMSettingWirelessSecurity *) 
nm_setting_wireless_security_new ();
-                        g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_WEP_KEY_FLAGS, 
NM_SETTING_SECRET_FLAG_AGENT_OWNED, NULL);
-                        nm_connection_add_setting (connection_partial, NM_SETTING (s_wsec));
-                }
-        }
         nm_client_add_and_activate_connection (panel->priv->client,
-                                               connection_partial,
+                                               NULL,
                                                device, object_path,
                                                connection_add_activate_cb, panel);
 out:
diff --git a/panels/network/network-dialogs.c b/panels/network/network-dialogs.c
index b572eb6..9721e61 100644
--- a/panels/network/network-dialogs.c
+++ b/panels/network/network-dialogs.c
@@ -233,14 +233,6 @@ show_wireless_dialog (CcNetworkPanel   *panel,
         gtk_widget_show (dialog);
 }
 
-gboolean
-cc_network_panel_default_to_private_connection (NMClient *client)
-{
-        NMClientPermissionResult perms;
-        perms = nm_client_get_permission_result (client, NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM);
-        return (perms != NM_CLIENT_PERMISSION_RESULT_YES);
-}
-
 void
 cc_network_panel_create_wifi_network (CcNetworkPanel   *panel,
                                      NMClient         *client,
@@ -314,10 +306,6 @@ cc_network_panel_connect_to_8021x_network (CcNetworkPanel   *panel,
         g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_AUTH, "mschapv2", NULL);
         nm_connection_add_setting (connection, NM_SETTING (s_8021x));
 
-        if (cc_network_panel_default_to_private_connection (client)) {
-                nm_setting_connection_add_permission (s_con, "user", g_get_user_name(), NULL);
-        }
-
         dialog = nma_wireless_dialog_new (client, settings, connection, device, ap, FALSE);
         show_wireless_dialog (panel, client, settings, dialog);
 }
@@ -371,7 +359,6 @@ cdma_mobile_wizard_done (NMAMobileWizard *wizard,
                              NM_SETTING_CDMA_NUMBER, "#777",
                              NM_SETTING_CDMA_USERNAME, method->username,
                              NM_SETTING_CDMA_PASSWORD, method->password,
-                             NM_SETTING_CDMA_PASSWORD_FLAGS, NM_SETTING_SECRET_FLAG_AGENT_OWNED,
                              NULL);
                nm_connection_add_setting (connection, setting);
 
@@ -401,7 +388,6 @@ cdma_mobile_wizard_done (NMAMobileWizard *wizard,
                              NULL);
                g_free (uuid);
                g_free (id);
-               nm_setting_connection_add_permission (setting, "user", g_get_user_name (), NULL);
                nm_connection_add_setting (connection, setting);
        }
 
@@ -435,7 +421,6 @@ gsm_mobile_wizard_done (NMAMobileWizard *wizard,
                              NM_SETTING_GSM_NUMBER, "*99#",
                              NM_SETTING_GSM_USERNAME, method->username,
                              NM_SETTING_GSM_PASSWORD, method->password,
-                             NM_SETTING_GSM_PASSWORD_FLAGS, NM_SETTING_SECRET_FLAG_AGENT_OWNED,
                              NM_SETTING_GSM_APN, method->gsm_apn,
                              NULL);
                nm_connection_add_setting (connection, setting);
@@ -466,7 +451,6 @@ gsm_mobile_wizard_done (NMAMobileWizard *wizard,
                              NULL);
                g_free (uuid);
                g_free (id);
-               nm_setting_connection_add_permission ((NMSettingConnection *) setting, "user", 
g_get_user_name (), NULL);
                nm_connection_add_setting (connection, setting);
        }
 
diff --git a/panels/network/network-dialogs.h b/panels/network/network-dialogs.h
index 1605855..cd9c6a7 100644
--- a/panels/network/network-dialogs.h
+++ b/panels/network/network-dialogs.h
@@ -23,8 +23,6 @@
 #include <nm-access-point.h>
 #include "cc-network-panel.h"
 
-gboolean cc_network_panel_default_to_private_connection (NMClient *client);
-
 void cc_network_panel_create_wifi_network (CcNetworkPanel   *panel,
                                           NMClient         *client,
                                           NMRemoteSettings *settings);
diff --git a/panels/network/panel-cell-renderer-security.h b/panels/network/panel-cell-renderer-security.h
index c1a29fe..e297abe 100644
--- a/panels/network/panel-cell-renderer-security.h
+++ b/panels/network/panel-cell-renderer-security.h
@@ -44,8 +44,8 @@ typedef enum {
   NM_AP_SEC_UNKNOWN,
   NM_AP_SEC_NONE,
   NM_AP_SEC_WEP,
-  NM_AP_SEC_WPA_PSK,
-  NM_AP_SEC_WPA_OTHER
+  NM_AP_SEC_WPA,
+  NM_AP_SEC_WPA2
 } NMAccessPointSecurity;
 
 struct _PanelCellRendererSecurity


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