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

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