Blame SOURCES/0001-data-Disable-network-configuration-on-login-screen.patch

4e44f9
From aa1c4a7708df2edbc12f2ada7249208aef586d1e Mon Sep 17 00:00:00 2001
4e44f9
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
4e44f9
Date: Tue, 8 Jun 2021 20:45:00 +0200
4e44f9
Subject: [PATCH] data: Disable network configuration on login screen
4e44f9
4e44f9
---
4e44f9
 data/meson.build            | 10 ++++++++++
4e44f9
 data/org.gnome.gdm.rules.in |  8 ++++++++
4e44f9
 2 files changed, 18 insertions(+)
4e44f9
 create mode 100644 data/org.gnome.gdm.rules.in
4e44f9
4e44f9
diff --git a/data/meson.build b/data/meson.build
4e44f9
index 7c5222ea..20d39a36 100644
4e44f9
--- a/data/meson.build
4e44f9
+++ b/data/meson.build
4e44f9
@@ -130,60 +130,70 @@ pam_data_files_map = {
4e44f9
   ],
4e44f9
   'arch': [
4e44f9
     'gdm-autologin',
4e44f9
     'gdm-launch-environment',
4e44f9
     'gdm-fingerprint',
4e44f9
     'gdm-smartcard',
4e44f9
     'gdm-password',
4e44f9
   ],
4e44f9
   'none': [],
4e44f9
   # We should no longer have 'autodetect' at this point
4e44f9
 }
4e44f9
 
4e44f9
 pam_data_files = pam_data_files_map[default_pam_config]
4e44f9
 pam_prefix = (get_option('pam-prefix') != '')? get_option('pam-prefix') : get_option('sysconfdir')
4e44f9
 foreach _pam_filename : pam_data_files
4e44f9
   install_data('pam-@0@/@1@.pam'.format(default_pam_config, _pam_filename),
4e44f9
     rename: _pam_filename,
4e44f9
     install_dir: pam_prefix / 'pam.d',
4e44f9
   )
4e44f9
 endforeach
4e44f9
 
4e44f9
 gdm_rules = configure_file(
4e44f9
   input: '61-gdm.rules.in',
4e44f9
   output: '@BASENAME@',
4e44f9
   configuration: {
4e44f9
     'libexecdir': gdm_prefix / get_option('libexecdir'),
4e44f9
   },
4e44f9
   install_dir: udev_dir,
4e44f9
 )
4e44f9
 
4e44f9
+# Polkit rules
4e44f9
+polkit_rules = configure_file(
4e44f9
+  input: 'org.gnome.gdm.rules.in',
4e44f9
+  output: '@BASENAME@',
4e44f9
+  configuration: {
4e44f9
+    'GDM_USERNAME': get_option('user'),
4e44f9
+  },
4e44f9
+  install_dir: get_option('datadir') / 'polkit-1' / 'rules.d',
4e44f9
+)
4e44f9
+
4e44f9
 # DBus service files
4e44f9
 service_config = configuration_data()
4e44f9
 service_config.set('sbindir', gdm_prefix / get_option('sbindir'))
4e44f9
 service_config.set('GDM_INITIAL_VT', get_option('initial-vt'))
4e44f9
 service_config.set('LANG_CONFIG_FILE', lang_config_file)
4e44f9
 if plymouth_dep.found()
4e44f9
   service_config.set('PLYMOUTH_QUIT_SERVICE', 'plymouth-quit.service')
4e44f9
 else
4e44f9
   service_config.set('PLYMOUTH_QUIT_SERVICE', '')
4e44f9
 endif
4e44f9
 
4e44f9
 if get_option('systemdsystemunitdir') != ''
4e44f9
   systemd_systemunitdir = get_option('systemdsystemunitdir')
4e44f9
 else
4e44f9
   systemd_systemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir')
4e44f9
 endif
4e44f9
 
4e44f9
 if get_option('systemduserunitdir') != ''
4e44f9
   systemd_userunitdir = get_option('systemduserunitdir')
4e44f9
 else
4e44f9
   systemd_userunitdir = systemd_dep.get_pkgconfig_variable('systemduserunitdir',
4e44f9
                                                            define_variable: ['prefix', get_option('prefix')])
4e44f9
 endif
4e44f9
 
4e44f9
 configure_file(
4e44f9
   input: 'gdm.service.in',
4e44f9
   output: '@BASENAME@',
4e44f9
   configuration: service_config,
4e44f9
   install_dir: systemd_systemunitdir,
4e44f9
   format: 'cmake'
4e44f9
diff --git a/data/org.gnome.gdm.rules.in b/data/org.gnome.gdm.rules.in
4e44f9
new file mode 100644
4e44f9
index 00000000..09544f11
4e44f9
--- /dev/null
4e44f9
+++ b/data/org.gnome.gdm.rules.in
4e44f9
@@ -0,0 +1,8 @@
4e44f9
+polkit.addRule(function(action, subject) {
4e44f9
+    if (action.id == "org.freedesktop.NetworkManager.network-control" &&
4e44f9
+        subject.user == "@GDM_USERNAME@") {
4e44f9
+            return polkit.Result.NO;
4e44f9
+    }
4e44f9
+
4e44f9
+    return polkit.Result.NOT_HANDLED;
4e44f9
+});
4e44f9
-- 
4e44f9
2.32.0
4e44f9