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

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