polkit/pkexec.patch
Marcus Meissner eb1406e636 Accepting request 595009 from home:iznogood:branches:Base:System
- Update to version 0.114:
  + Port to mozjs 52, the latest version of the firefox JavaScript
    engine.
  + Add gettext support for policy files.
  + Fixes for various memory leaks.
  + Updated translations.
- Update keyring with Ray Strode <halfline@gmail.com> public key.
- Drop with_systemd define and all conditionals and
  polkit-no-systemd.patch and ConsoleKit BuildRequires, we only
  support systemd now.
- Drop upstream fixed polkit-itstools.patch.
- Rebase pkexec.patch with quilt.
- Add gcc-c++ and pkgconfig(mozjs-52) BuildRequires: New
  dependencies.
- Drop conditional pkgconfig(mozjs-17.0) and pkgconfig(mozjs185):
  no longer supported.
- Drop autoconf and automake BuildRequires: They are implicit via
  libtool BuildRequires.
- Replace glib2-devel and gobject-introspection-devel with their
  pkgconfig counterparts: pkgconfig(gio-unix-2.0),
  pkgconfig(gmodule-2.0) and pkgconfig(gobject-introspection-1.0).
- Add polkit-jsauthority-pass-format-string.patch: jsauthority:
  pass "%s" format string to remaining report function, patch from
  upstream git, adding missed commit (bgo#105865).
- Drop polkit-revert-session-magic.patch: Upstream systemd bug is
  since a long time fixed (gh#systemd#58) (boo#954139).

OBS-URL: https://build.opensuse.org/request/show/595009
OBS-URL: https://build.opensuse.org/package/show/Base:System/polkit?expand=0&rev=121
2018-04-10 08:51:08 +00:00

69 lines
2.1 KiB
Diff

From: Andreas Schwab <schwab@suse.de>
Subject: pkexec: allow --version and --help even if not setuid
Don't check for setuid invocation until after parsing command line, to allow
running uninstalled pkexec with --help or --version. This also helps
building packages that want to check for pkexec in an emulated environment
that does not support setuid invocation (eg. QEMU linux-user).
Index: polkit-0.114/src/programs/pkexec.c
===================================================================
--- polkit-0.114.orig/src/programs/pkexec.c 2018-04-03 20:16:17.000000000 +0200
+++ polkit-0.114/src/programs/pkexec.c 2018-04-10 02:48:03.031508016 +0200
@@ -504,27 +504,6 @@ main (int argc, char *argv[])
/* Disable remote file access from GIO. */
setenv ("GIO_USE_VFS", "local", 1);
- /* check for correct invocation */
- if (geteuid () != 0)
- {
- g_printerr ("pkexec must be setuid root\n");
- goto out;
- }
-
- original_user_name = g_strdup (g_get_user_name ());
- if (original_user_name == NULL)
- {
- g_printerr ("Error getting user name.\n");
- goto out;
- }
-
- if ((original_cwd = g_get_current_dir ()) == NULL)
- {
- g_printerr ("Error getting cwd: %s\n",
- g_strerror (errno));
- goto out;
- }
-
/* First process options and find the command-line to invoke. Avoid using fancy library routines
* that depend on environtment variables since we haven't cleared the environment just yet.
*/
@@ -580,6 +559,27 @@ main (int argc, char *argv[])
goto out;
}
+ /* check for correct invocation */
+ if (geteuid () != 0)
+ {
+ g_printerr ("pkexec must be setuid root\n");
+ goto out;
+ }
+
+ original_user_name = g_strdup (g_get_user_name ());
+ if (original_user_name == NULL)
+ {
+ g_printerr ("Error getting user name.\n");
+ goto out;
+ }
+
+ if ((original_cwd = g_get_current_dir ()) == NULL)
+ {
+ g_printerr ("Error getting cwd: %s\n",
+ g_strerror (errno));
+ goto out;
+ }
+
if (opt_user == NULL)
opt_user = g_strdup ("root");