]>
Commit | Line | Data |
---|---|---|
eb99a939 ER |
1 | Description: Set new wireless connections as user-owned |
2 | Set connections and passwords as user-owned, following matching changes in | |
3 | nm-applet and gnome-control-center. The logic is | |
4 | - Wired connections: always system-owned. | |
5 | - Modem (GSM/UMTS) connections are created by the control center. | |
6 | - Bluetooth PAN connections are now always user-owned. | |
7 | - Wireless connections are system-owned if the user has | |
8 | permissions (in Debian this means group sudo or netdev). Otherwise, | |
9 | it is user-owned, with the password in the keyring only for WPA. | |
10 | - 802.1x (wired or wireless) is always handled by the control center. | |
11 | Author: Josselin Mouette <joss@debian.org> | |
12 | Origin: vendor | |
13 | Forwarded: no | |
14 | Last-Update: 2013-05-16 | |
15 | --- | |
16 | --- a/files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js | |
17 | +++ b/files/usr/share/cinnamon/applets/network@cinnamon.org/applet.js | |
18 | @@ -100,6 +100,11 @@ | |
19 | this._init.apply(this, arguments); | |
20 | } | |
21 | ||
22 | +function default_to_private_connections(client) { | |
23 | + let perms = client.get_permission_result (NMClient.ClientPermission.SETTINGS_MODIFY_SYSTEM); | |
24 | + return (perms != NMClient.ClientPermissionResult.YES); | |
25 | +} | |
26 | + | |
27 | NMNetworkMenuItem.prototype = { | |
28 | __proto__: PopupMenu.PopupBaseMenuItem.prototype, | |
29 | ||
30 | @@ -899,12 +904,14 @@ | |
31 | let connection = new NetworkManager.Connection; | |
32 | connection._uuid = NetworkManager.utils_uuid_generate(); | |
33 | connection.add_setting(new NetworkManager.SettingBluetooth); | |
34 | - connection.add_setting(new NetworkManager.SettingConnection({ | |
35 | + let setting_conn = new NetworkManager.SettingConnection({ | |
36 | uuid: connection._uuid, | |
37 | id: this._autoConnectionName, | |
38 | type: NetworkManager.SETTING_BLUETOOTH_SETTING_NAME, | |
39 | autoconnect: false | |
40 | - })); | |
41 | + }); | |
42 | + setting_conn.add_permission('user', GLib.get_user_name(), null); | |
43 | + connection.add_setting(setting_conn); | |
44 | return connection; | |
45 | }, | |
46 | ||
47 | @@ -986,6 +993,8 @@ | |
48 | this._overflowItem = null; | |
49 | this._networks = [ ]; | |
50 | ||
51 | + this._client = client; | |
52 | + | |
53 | // breaking the layers with this, but cannot call | |
54 | // this.connectionValid until I have a device | |
55 | this.device = device; | |
56 | @@ -1520,12 +1529,27 @@ | |
57 | ||
58 | let connection = new NetworkManager.Connection(); | |
59 | connection.add_setting(new NetworkManager.SettingWireless()); | |
60 | - connection.add_setting(new NetworkManager.SettingConnection({ | |
61 | + let setting_conn = new NetworkManager.SettingConnection({ | |
62 | id: name, | |
63 | autoconnect: true, // NetworkManager will know to ignore this if appropriate | |
64 | uuid: NetworkManager.utils_uuid_generate(), | |
65 | type: NetworkManager.SETTING_WIRELESS_SETTING_NAME | |
66 | - })); | |
67 | + }); | |
68 | + if (default_to_private_connections(this._client)) { | |
69 | + setting_conn.add_permission('user', GLib.get_user_name(), null); | |
70 | + if (apObj.security == NMAccessPointSecurity.WPA2_PSK || | |
71 | + apObj.security == NMAccessPointSecurity.WPA_PSK) { | |
72 | + connection.add_setting(new NetworkManager.SettingWirelessSecurity({ | |
73 | + psk_flags: NetworkManager.SettingSecretFlags.AGENT_OWNED | |
74 | + })); | |
75 | + } | |
76 | + if (apObj.security == NMAccessPointSecurity.WEP) { | |
77 | + connection.add_setting(new NetworkManager.SettingWirelessSecurity({ | |
78 | + wep_key_flags: NetworkManager.SettingSecretFlags.AGENT_OWNED | |
79 | + })); | |
80 | + } | |
81 | + } | |
82 | + connection.add_setting(setting_conn); | |
83 | return connection; | |
84 | }, | |
85 |