1 |
commit: 7bb73255629cc4999ff198fda276d593657609b8 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed May 4 02:32:40 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed May 4 02:32:40 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7bb73255 |
7 |
|
8 |
sys-auth/polkit: backport pkexec help/version fix (fixes gparted) |
9 |
|
10 |
Closes: https://bugs.gentoo.org/827884 |
11 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
12 |
|
13 |
.../files/polkit-0.120_p20220221-pkexec-suid.patch | 67 +++++++++++ |
14 |
sys-auth/polkit/polkit-0.120_p20220221-r1.ebuild | 129 +++++++++++++++++++++ |
15 |
2 files changed, 196 insertions(+) |
16 |
|
17 |
diff --git a/sys-auth/polkit/files/polkit-0.120_p20220221-pkexec-suid.patch b/sys-auth/polkit/files/polkit-0.120_p20220221-pkexec-suid.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..959656b158a1 |
20 |
--- /dev/null |
21 |
+++ b/sys-auth/polkit/files/polkit-0.120_p20220221-pkexec-suid.patch |
22 |
@@ -0,0 +1,67 @@ |
23 |
+https://gitlab.freedesktop.org/polkit/polkit/-/commit/7d4b52c4d71c46049d87a0775de695ea914f3f1b |
24 |
+https://gitlab.freedesktop.org/polkit/polkit/-/merge_requests/113 |
25 |
+https://bugs.gentoo.org/827884 |
26 |
+ |
27 |
+From: Matt Turner <mattst88@×××××.com> |
28 |
+Date: Tue, 3 May 2022 12:54:37 +0000 |
29 |
+Subject: [PATCH] pkexec: Allow --version and --help even if not setuid root |
30 |
+ |
31 |
+--- a/src/programs/pkexec.c |
32 |
++++ b/src/programs/pkexec.c |
33 |
+@@ -514,27 +514,6 @@ main (int argc, char *argv[]) |
34 |
+ /* Disable remote file access from GIO. */ |
35 |
+ setenv ("GIO_USE_VFS", "local", 1); |
36 |
+ |
37 |
+- /* check for correct invocation */ |
38 |
+- if (geteuid () != 0) |
39 |
+- { |
40 |
+- g_printerr ("pkexec must be setuid root\n"); |
41 |
+- goto out; |
42 |
+- } |
43 |
+- |
44 |
+- original_user_name = g_strdup (g_get_user_name ()); |
45 |
+- if (original_user_name == NULL) |
46 |
+- { |
47 |
+- g_printerr ("Error getting user name.\n"); |
48 |
+- goto out; |
49 |
+- } |
50 |
+- |
51 |
+- if ((original_cwd = g_get_current_dir ()) == NULL) |
52 |
+- { |
53 |
+- g_printerr ("Error getting cwd: %s\n", |
54 |
+- g_strerror (errno)); |
55 |
+- goto out; |
56 |
+- } |
57 |
+- |
58 |
+ /* First process options and find the command-line to invoke. Avoid using fancy library routines |
59 |
+ * that depend on environtment variables since we haven't cleared the environment just yet. |
60 |
+ */ |
61 |
+@@ -595,6 +574,27 @@ main (int argc, char *argv[]) |
62 |
+ goto out; |
63 |
+ } |
64 |
+ |
65 |
++ /* check for correct invocation */ |
66 |
++ if (geteuid () != 0) |
67 |
++ { |
68 |
++ g_printerr ("pkexec must be setuid root\n"); |
69 |
++ goto out; |
70 |
++ } |
71 |
++ |
72 |
++ original_user_name = g_strdup (g_get_user_name ()); |
73 |
++ if (original_user_name == NULL) |
74 |
++ { |
75 |
++ g_printerr ("Error getting user name.\n"); |
76 |
++ goto out; |
77 |
++ } |
78 |
++ |
79 |
++ if ((original_cwd = g_get_current_dir ()) == NULL) |
80 |
++ { |
81 |
++ g_printerr ("Error getting cwd: %s\n", |
82 |
++ g_strerror (errno)); |
83 |
++ goto out; |
84 |
++ } |
85 |
++ |
86 |
+ if (opt_user == NULL) |
87 |
+ opt_user = g_strdup ("root"); |
88 |
+ |
89 |
+GitLab |
90 |
|
91 |
diff --git a/sys-auth/polkit/polkit-0.120_p20220221-r1.ebuild b/sys-auth/polkit/polkit-0.120_p20220221-r1.ebuild |
92 |
new file mode 100644 |
93 |
index 000000000000..a1b8221ce450 |
94 |
--- /dev/null |
95 |
+++ b/sys-auth/polkit/polkit-0.120_p20220221-r1.ebuild |
96 |
@@ -0,0 +1,129 @@ |
97 |
+# Copyright 1999-2022 Gentoo Authors |
98 |
+# Distributed under the terms of the GNU General Public License v2 |
99 |
+ |
100 |
+EAPI=7 |
101 |
+ |
102 |
+inherit meson pam pax-utils systemd xdg-utils |
103 |
+ |
104 |
+DESCRIPTION="Policy framework for controlling privileges for system-wide services" |
105 |
+HOMEPAGE="https://www.freedesktop.org/wiki/Software/polkit https://gitlab.freedesktop.org/polkit/polkit" |
106 |
+if [[ ${PV} == *_p* ]] ; then |
107 |
+ MY_COMMIT="b10a1bdb697045db40774f2a9a8c58ae5c7189c3" |
108 |
+ SRC_URI="https://gitlab.freedesktop.org/polkit/polkit/-/archive/${MY_COMMIT}/polkit-${MY_COMMIT}.tar.bz2 -> ${P}.tar.bz2" |
109 |
+ S="${WORKDIR}"/${PN}-${MY_COMMIT} |
110 |
+else |
111 |
+ SRC_URI="https://www.freedesktop.org/software/${PN}/releases/${P}.tar.gz" |
112 |
+fi |
113 |
+ |
114 |
+LICENSE="LGPL-2" |
115 |
+SLOT="0" |
116 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" |
117 |
+IUSE="+duktape examples gtk +introspection kde pam selinux systemd test" |
118 |
+#RESTRICT="!test? ( test )" |
119 |
+# Tests currently don't work with meson. See |
120 |
+# https://gitlab.freedesktop.org/polkit/polkit/-/issues/144 |
121 |
+RESTRICT="test" |
122 |
+ |
123 |
+BDEPEND=" |
124 |
+ acct-user/polkitd |
125 |
+ app-text/docbook-xml-dtd:4.1.2 |
126 |
+ app-text/docbook-xsl-stylesheets |
127 |
+ dev-libs/glib |
128 |
+ dev-libs/gobject-introspection-common |
129 |
+ dev-libs/libxslt |
130 |
+ dev-util/glib-utils |
131 |
+ sys-devel/gettext |
132 |
+ virtual/pkgconfig |
133 |
+ introspection? ( dev-libs/gobject-introspection ) |
134 |
+" |
135 |
+DEPEND=" |
136 |
+ dev-libs/glib:2 |
137 |
+ dev-libs/expat |
138 |
+ duktape? ( dev-lang/duktape:= ) |
139 |
+ !duktape? ( dev-lang/spidermonkey:91[-debug] ) |
140 |
+ pam? ( |
141 |
+ sys-auth/pambase |
142 |
+ sys-libs/pam |
143 |
+ ) |
144 |
+ !pam? ( virtual/libcrypt:= ) |
145 |
+ systemd? ( sys-apps/systemd:0=[policykit] ) |
146 |
+ !systemd? ( sys-auth/elogind ) |
147 |
+" |
148 |
+RDEPEND="${DEPEND} |
149 |
+ acct-user/polkitd |
150 |
+ selinux? ( sec-policy/selinux-policykit ) |
151 |
+" |
152 |
+PDEPEND=" |
153 |
+ gtk? ( || ( |
154 |
+ >=gnome-extra/polkit-gnome-0.105 |
155 |
+ >=lxde-base/lxsession-0.5.2 |
156 |
+ ) ) |
157 |
+ kde? ( kde-plasma/polkit-kde-agent ) |
158 |
+" |
159 |
+ |
160 |
+DOCS=( docs/TODO HACKING NEWS README ) |
161 |
+ |
162 |
+QA_MULTILIB_PATHS=" |
163 |
+ usr/lib/polkit-1/polkit-agent-helper-1 |
164 |
+ usr/lib/polkit-1/polkitd" |
165 |
+ |
166 |
+src_prepare() { |
167 |
+ local PATCHES=( |
168 |
+ # musl |
169 |
+ "${FILESDIR}"/${PN}-0.118-make-netgroup-support-optional.patch |
170 |
+ # In next release |
171 |
+ "${FILESDIR}"/${P}-pkexec-suid.patch |
172 |
+ |
173 |
+ # Pending upstream |
174 |
+ "${FILESDIR}"/${PN}-0.120-meson.patch |
175 |
+ ) |
176 |
+ |
177 |
+ default |
178 |
+ |
179 |
+ # bug #401513 |
180 |
+ sed -i -e 's|unix-group:wheel|unix-user:0|' src/polkitbackend/*-default.rules || die |
181 |
+} |
182 |
+ |
183 |
+src_configure() { |
184 |
+ xdg_environment_reset |
185 |
+ |
186 |
+ local emesonargs=( |
187 |
+ --localstatedir="${EPREFIX}"/var |
188 |
+ -Dauthfw="$(usex pam pam shadow)" |
189 |
+ -Dexamples=false |
190 |
+ -Dgtk_doc=false |
191 |
+ -Dman=true |
192 |
+ -Dos_type=gentoo |
193 |
+ -Dsession_tracking="$(usex systemd libsystemd-login libelogind)" |
194 |
+ -Dsystemdsystemunitdir="$(systemd_get_systemunitdir)" |
195 |
+ -Djs_engine=$(usex duktape duktape mozjs) |
196 |
+ $(meson_use introspection) |
197 |
+ $(meson_use test tests) |
198 |
+ $(usex pam "-Dpam_module_dir=$(getpam_mod_dir)" '') |
199 |
+ ) |
200 |
+ meson_src_configure |
201 |
+} |
202 |
+ |
203 |
+src_compile() { |
204 |
+ meson_src_compile |
205 |
+ |
206 |
+ # Required for polkitd on hardened/PaX due to spidermonkey's JIT |
207 |
+ pax-mark mr src/polkitbackend/.libs/polkitd test/polkitbackend/.libs/polkitbackendjsauthoritytest |
208 |
+} |
209 |
+ |
210 |
+src_install() { |
211 |
+ meson_src_install |
212 |
+ |
213 |
+ if use examples ; then |
214 |
+ docinto examples |
215 |
+ dodoc src/examples/{*.c,*.policy*} |
216 |
+ fi |
217 |
+ |
218 |
+ diropts -m 0700 -o polkitd |
219 |
+ keepdir /usr/share/polkit-1/rules.d |
220 |
+} |
221 |
+ |
222 |
+pkg_postinst() { |
223 |
+ chmod 0700 "${EROOT}"/{etc,usr/share}/polkit-1/rules.d |
224 |
+ chown polkitd "${EROOT}"/{etc,usr/share}/polkit-1/rules.d |
225 |
+} |