Blame SOURCES/gdm-networking.patch

477568
From ed0699886f49e5dd8d6ca9ffb60ba17cd76a810f Mon Sep 17 00:00:00 2001
477568
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
477568
Date: Mon, 7 Jun 2021 17:49:57 +0200
477568
Subject: [PATCH 1/5] status/network: Disable modem connection when windows
477568
 aren't allowed
477568
477568
The item launches the corresponding Settings panel when activated, which
477568
doesn't work when windows are disabled by the session mode. Rather than
477568
failing silently, turn the item insensitive.
477568
---
477568
 js/ui/status/network.js | 12 ++++++++++++
477568
 1 file changed, 12 insertions(+)
477568
477568
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
477568
index b3bb7589c..3ad7b04dd 100644
477568
--- a/js/ui/status/network.js
477568
+++ b/js/ui/status/network.js
477568
@@ -514,6 +514,10 @@ var NMDeviceModem = class extends NMConnectionDevice {
477568
                 this._iconChanged();
477568
             });
477568
         }
477568
+
477568
+        this._sessionUpdatedId =
477568
+            Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
477568
+        this._sessionUpdated();
477568
     }
477568
 
477568
     get category() {
477568
@@ -525,6 +529,10 @@ var NMDeviceModem = class extends NMConnectionDevice {
477568
                     'connect-3g', this._device.get_path()]);
477568
     }
477568
 
477568
+    _sessionUpdated() {
477568
+        this._autoConnectItem.sensitive = Main.sessionMode.hasWindows;
477568
+    }
477568
+
477568
     destroy() {
477568
         if (this._operatorNameId) {
477568
             this._mobileDevice.disconnect(this._operatorNameId);
477568
@@ -534,6 +542,10 @@ var NMDeviceModem = class extends NMConnectionDevice {
477568
             this._mobileDevice.disconnect(this._signalQualityId);
477568
             this._signalQualityId = 0;
477568
         }
477568
+        if (this._sessionUpdatedId) {
477568
+            Main.sessionMode.disconnect(this._sessionUpdatedId);
477568
+            this._sessionUpdatedId = 0;
477568
+        }
477568
 
477568
         super.destroy();
477568
     }
477568
-- 
477568
2.31.1
477568
477568
477568
From 59d52e1591e1522fff22320c657496ca978a7926 Mon Sep 17 00:00:00 2001
477568
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
477568
Date: Mon, 7 Jun 2021 18:28:32 +0200
477568
Subject: [PATCH 2/5] status/network: Only list wifi networks that can be
477568
 activated
477568
477568
Setting up a connection for an Enterprise WPA(2) encrypted wireless
477568
network requires Settings. That's not available when windows are
477568
disabled via the session mode, so filter out affected entries.
477568
---
477568
 js/ui/status/network.js | 29 ++++++++++++++++++++++++++++-
477568
 1 file changed, 28 insertions(+), 1 deletion(-)
477568
477568
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
477568
index 3ad7b04dd..c023022a7 100644
477568
--- a/js/ui/status/network.js
477568
+++ b/js/ui/status/network.js
477568
@@ -1,5 +1,5 @@
477568
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
477568
-const { Clutter, Gio, GLib, GObject, NM, St } = imports.gi;
477568
+const { Clutter, Gio, GLib, GObject, Meta, NM, St } = imports.gi;
477568
 const Mainloop = imports.mainloop;
477568
 const Signals = imports.signals;
477568
 
477568
@@ -751,6 +751,11 @@ var NMWirelessDialog = class extends ModalDialog.ModalDialog {
477568
             this._scanTimeoutId = 0;
477568
         }
477568
 
477568
+        if (this._syncVisibilityId) {
477568
+            Meta.later_remove(this._syncVisibilityId);
477568
+            this._syncVisibilityId = 0;
477568
+        }
477568
+
477568
         super.destroy();
477568
     }
477568
 
477568
@@ -1081,9 +1086,31 @@ var NMWirelessDialog = class extends ModalDialog.ModalDialog {
477568
             this._itemBox.insert_child_at_index(network.item.actor, newPos);
477568
         }
477568
 
477568
+        this._queueSyncItemVisibility();
477568
         this._syncView();
477568
     }
477568
 
477568
+    _queueSyncItemVisibility() {
477568
+        if (this._syncVisibilityId)
477568
+            return;
477568
+
477568
+        this._syncVisibilityId = Meta.later_add(
477568
+            Meta.LaterType.BEFORE_REDRAW,
477568
+            () => {
477568
+                const { hasWindows } = Main.sessionMode;
477568
+                const { WPA2_ENT, WPA_ENT } = NMAccessPointSecurity;
477568
+
477568
+                for (const network of this._networks) {
477568
+                    const [firstAp] = network.accessPoints;
477568
+                    network.item.visible =
477568
+                        hasWindows ||
477568
+                        network.connections.length > 0 ||
477568
+                        (firstAp._secType !== WPA2_ENT && firstAp._secType !== WPA_ENT);
477568
+                }
477568
+                return GLib.SOURCE_REMOVE;
477568
+            });
477568
+    }
477568
+
477568
     _accessPointRemoved(device, accessPoint) {
477568
         let res = this._findExistingNetwork(accessPoint);
477568
 
477568
-- 
477568
2.31.1
477568
477568
477568
From 9d204cdb38bcfee214dbe0b0bf9c2073dc50fe93 Mon Sep 17 00:00:00 2001
477568
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
477568
Date: Tue, 8 Jun 2021 00:17:48 +0200
477568
Subject: [PATCH 3/5] status/network: Consider network-control action
477568
477568
NetworkManager installs a `network-control` polkit action that can
477568
be used to disallow network configuration, except that we happily
477568
ignore it. Add it to the conditions that turn a network section
477568
insensitive.
477568
---
477568
 js/ui/status/network.js | 20 +++++++++++++++++---
477568
 1 file changed, 17 insertions(+), 3 deletions(-)
477568
477568
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
477568
index c023022a7..79729e01b 100644
477568
--- a/js/ui/status/network.js
477568
+++ b/js/ui/status/network.js
477568
@@ -1,5 +1,5 @@
477568
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
477568
-const { Clutter, Gio, GLib, GObject, Meta, NM, St } = imports.gi;
477568
+const { Clutter, Gio, GLib, GObject, Meta, NM, Polkit, St } = imports.gi;
477568
 const Mainloop = imports.mainloop;
477568
 const Signals = imports.signals;
477568
 
477568
@@ -1683,11 +1683,25 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
477568
         this._client.connect('connection-removed', this._connectionRemoved.bind(this));
477568
 
477568
         Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));
477568
-        this._sessionUpdated();
477568
+
477568
+        this._configPermission = null;
477568
+        Polkit.Permission.new(
477568
+            'org.freedesktop.NetworkManager.network-control', null, null,
477568
+            (o, res) => {
477568
+                try {
477568
+                    this._configPermission = Polkit.Permission.new_finish(res);
477568
+                } catch (e) {
477568
+                    log('No permission to control network connections: %s'.format(e.toString()));
477568
+                }
477568
+                this._sessionUpdated();
477568
+            });
477568
     }
477568
 
477568
     _sessionUpdated() {
477568
-        let sensitive = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;
477568
+        const sensitive =
477568
+            !Main.sessionMode.isLocked &&
477568
+            !Main.sessionMode.isGreeter &&
477568
+            this._configPermission && this._configPermission.allowed;
477568
         this.menu.setSensitive(sensitive);
477568
     }
477568
 
477568
-- 
477568
2.31.1
477568
477568
477568
From 7d2c8aabb86b9942c99ae9b7157dbffb875acde9 Mon Sep 17 00:00:00 2001
477568
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
477568
Date: Thu, 10 Jun 2021 23:12:27 +0200
477568
Subject: [PATCH 4/5] sessionMode: Enable networkAgent on login screen
477568
477568
We will soon enable the network sections in the status menu on the
477568
login screen, so enable the network agent to handle authentication
477568
requests (like wifi/VPN passwords).
477568
---
477568
 js/ui/sessionMode.js | 4 +++-
477568
 1 file changed, 3 insertions(+), 1 deletion(-)
477568
477568
diff --git a/js/ui/sessionMode.js b/js/ui/sessionMode.js
477568
index 25aa75a3d..fa7f83416 100644
477568
--- a/js/ui/sessionMode.js
477568
+++ b/js/ui/sessionMode.js
477568
@@ -43,7 +43,9 @@ const _modes = {
477568
         isGreeter: true,
477568
         isPrimary: true,
477568
         unlockDialog: imports.gdm.loginDialog.LoginDialog,
477568
-        components: ['polkitAgent'],
477568
+        components: Config.HAVE_NETWORKMANAGER
477568
+            ? ['networkAgent', 'polkitAgent']
477568
+            : ['polkitAgent'],
477568
         panel: {
477568
             left: [],
477568
             center: ['dateMenu'],
477568
-- 
477568
2.31.1
477568
477568
477568
From 07ce899bcb9d30991262d6c484508e6c5fa14c85 Mon Sep 17 00:00:00 2001
477568
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
477568
Date: Tue, 8 Jun 2021 00:19:26 +0200
477568
Subject: [PATCH 5/5] status/network: Do not disable on login screen
477568
477568
We currently disable all network items on both the lock- and login
477568
screen. While it makes sense to be very restrictive on the lock screen,
477568
there are some (fringe) use cases for being more permissive on the
477568
login screen (like remote home directories only accessible via VPN).
477568
477568
There's precedence with the power-off/restart actions to be less
477568
restrictive on the login screen, and since we started respecting
477568
the `network-control` polkit action, it's possible to restore the
477568
old behavior if desired.
477568
---
477568
 js/ui/status/network.js | 1 -
477568
 1 file changed, 1 deletion(-)
477568
477568
diff --git a/js/ui/status/network.js b/js/ui/status/network.js
477568
index 79729e01b..914dbbd99 100644
477568
--- a/js/ui/status/network.js
477568
+++ b/js/ui/status/network.js
477568
@@ -1700,7 +1700,6 @@ var NMApplet = class extends PanelMenu.SystemIndicator {
477568
     _sessionUpdated() {
477568
         const sensitive =
477568
             !Main.sessionMode.isLocked &&
477568
-            !Main.sessionMode.isGreeter &&
477568
             this._configPermission && this._configPermission.allowed;
477568
         this.menu.setSensitive(sensitive);
477568
     }
477568
-- 
477568
2.31.1
477568