[gparted] Add detection of pkexec root privilege escalation program (#776437)



commit b47528b6f976633b49be192ab8e4e8455f95b6e4
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Tue Jun 20 16:15:12 2017 +0100

    Add detection of pkexec root privilege escalation program (#776437)
    
    Many of the distributions (confirmed for Arch Linux, Debian, Fedora,
    OpenSUSE, RedHat/CentOS and Ubuntu but likely many others too) are now
    using polkit as the mechanism to authorise privileged actions, including
    using it to authorise GParted to run as root in their packages of
    GParted.  Therefore make the GParted configure script check for the
    pkexec command.
    
    Use pkexec with the --disable-internal-agent option when available,
    preventing pkexec using it's own textual authentication agent.  When
    running GParted from a desktop icon or menu there is no terminal with
    which to interact with the textual authentication agent to it can't be
    used.  The desktop's graphical agent must be running.  This matches how
    some distributions already use polkit in their own packages of GParted.
    
    Required actions file will be added in the next commit.
    
        polkit(8)
        https://www.freedesktop.org/software/polkit/docs/latest/polkit.8.html
    
        pkexec(1)
        https://www.freedesktop.org/software/polkit/docs/latest/pkexec.1.html
    
    Bug 776437 - GParted fails to run as root under Wayland

 README       |    9 ++++++---
 configure.ac |   12 ++++++++++--
 2 files changed, 16 insertions(+), 5 deletions(-)
---
diff --git a/README b/README
index 87e28e0..6a123f9 100644
--- a/README
+++ b/README
@@ -270,15 +270,18 @@ system.  These commands include:
    {filemanager}   - used in attempt data rescue to display discovered
                      file systems.  (e.g., nautilus, pcmanfm)
    hal-lock        - used to prevent automounting of file systems
-   gksudo          - used to acquire root privileges in gparted shell
+   pkexec          - used to acquire root privileges in gparted shell
                      script wrapper, but only if available when gparted
                      source is configured
-   gksu            - alternatively used to acquire root privileges in
+   gksudo          - alternatively used to acquire root privileges in
                      gparted shell script wrapper, second choice if
                      available when gparted source is configured
-   kdesudo         - alternatively used to acquire root privileges in
+   gksu            - alternatively used to acquire root privileges in
                      gparted shell script wrapper, third choice if
                      available when gparted source is configured
+   kdesudo         - alternatively used to acquire root privileges in
+                     gparted shell script wrapper, fourth choice if
+                     available when gparted source is configured
    xdg-su          - alternatively used to acquire root privileges in
                      gparted shell script wrapper, last choice if
                      available when gparted source is configured
diff --git a/configure.ac b/configure.ac
index 61046c7..0b4f74d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -21,9 +21,17 @@ PKG_CHECK_EXISTS
 
 
 dnl======================
-dnl checks for other programs
+dnl Find graphical privilege escalation program
 dnl======================
-AC_CHECK_PROGS([GKSUPROG], [gksudo gksu kdesudo "xdg-su -c"], [])
+AC_CHECK_PROGS([GKSUPROG], [pkexec gksudo gksu kdesudo "xdg-su -c"], [])
+
+if test "x$GKSUPROG" = 'xpkexec'; then
+       AC_MSG_CHECKING([how to run pkexec])
+       if pkexec --help 2>&1 | grep -q -- --disable-internal-agent; then
+               GKSUPROG="$GKSUPROG --disable-internal-agent"
+       fi
+       AC_MSG_RESULT([$GKSUPROG])
+fi
 
 
 dnl======================


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]