1 |
commit: cca21561571e00e88f434ad94a9cde6851fab244 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 20 00:42:58 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 20 00:42:58 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cca21561 |
7 |
|
8 |
sys-auth/polkit: add musl patch to 0.120_p20220127 |
9 |
|
10 |
Pulled in from ::musl. |
11 |
|
12 |
Closes: https://bugs.gentoo.org/833753 |
13 |
Bug: https://bugs.gentoo.org/561672 |
14 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
15 |
|
16 |
...lkit-0.118-make-netgroup-support-optional.patch | 228 +++++++++++++++++++++ |
17 |
sys-auth/polkit/polkit-0.120_p20220127.ebuild | 3 + |
18 |
2 files changed, 231 insertions(+) |
19 |
|
20 |
diff --git a/sys-auth/polkit/files/polkit-0.118-make-netgroup-support-optional.patch b/sys-auth/polkit/files/polkit-0.118-make-netgroup-support-optional.patch |
21 |
new file mode 100644 |
22 |
index 000000000000..b11250fd3992 |
23 |
--- /dev/null |
24 |
+++ b/sys-auth/polkit/files/polkit-0.118-make-netgroup-support-optional.patch |
25 |
@@ -0,0 +1,228 @@ |
26 |
+Pulled in from https://github.com/gentoo/musl/blob/master/sys-auth/polkit/files/polkit-0.118-make-netgroup-support-optional.patch. |
27 |
+ |
28 |
+https://bugs.gentoo.org/833753 |
29 |
+https://bugs.gentoo.org/561672 |
30 |
+https://bugs.freedesktop.org/show_bug.cgi?id=50145 |
31 |
+https://gitlab.freedesktop.org/polkit/polkit/-/issues/14 |
32 |
+ |
33 |
+Patch has been rebased a bit since but keeping original headers. |
34 |
+ |
35 |
+From c7ad7cb3ca8fca32b9b64b0fc33867b98935b76b Mon Sep 17 00:00:00 2001 |
36 |
+From: "A. Wilcox" <AWilcox@×××××××××××.com> |
37 |
+Date: Wed, 11 Jul 2018 04:54:26 -0500 |
38 |
+Subject: [PATCH] make netgroup support optional |
39 |
+ |
40 |
+On at least Linux/musl and Linux/uclibc, netgroup support is not |
41 |
+available. PolKit fails to compile on these systems for that reason. |
42 |
+ |
43 |
+This change makes netgroup support conditional on the presence of the |
44 |
+setnetgrent(3) function which is required for the support to work. If |
45 |
+that function is not available on the system, an error will be returned |
46 |
+to the administrator if unix-netgroup: is specified in configuration. |
47 |
+ |
48 |
+Fixes bug 50145. |
49 |
+ |
50 |
+Signed-off-by: A. Wilcox <AWilcox@×××××××××××.com> |
51 |
+--- a/configure.ac |
52 |
++++ b/configure.ac |
53 |
+@@ -100,7 +100,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"], |
54 |
+ [AC_MSG_ERROR([Can't find expat library. Please install expat.])]) |
55 |
+ AC_SUBST(EXPAT_LIBS) |
56 |
+ |
57 |
+-AC_CHECK_FUNCS(clearenv fdatasync) |
58 |
++AC_CHECK_FUNCS(clearenv fdatasync setnetgrent) |
59 |
+ |
60 |
+ if test "x$GCC" = "xyes"; then |
61 |
+ LDFLAGS="-Wl,--as-needed $LDFLAGS" |
62 |
+--- a/src/polkit/polkitidentity.c |
63 |
++++ b/src/polkit/polkitidentity.c |
64 |
+@@ -182,7 +182,15 @@ polkit_identity_from_string (const gchar *str, |
65 |
+ } |
66 |
+ else if (g_str_has_prefix (str, "unix-netgroup:")) |
67 |
+ { |
68 |
++#ifndef HAVE_SETNETGRENT |
69 |
++ g_set_error (error, |
70 |
++ POLKIT_ERROR, |
71 |
++ POLKIT_ERROR_FAILED, |
72 |
++ "Netgroups are not available on this machine ('%s')", |
73 |
++ str); |
74 |
++#else |
75 |
+ identity = polkit_unix_netgroup_new (str + sizeof "unix-netgroup:" - 1); |
76 |
++#endif |
77 |
+ } |
78 |
+ |
79 |
+ if (identity == NULL && (error != NULL && *error == NULL)) |
80 |
+@@ -344,6 +352,14 @@ polkit_identity_new_for_gvariant (GVariant *variant, |
81 |
+ GVariant *v; |
82 |
+ const char *name; |
83 |
+ |
84 |
++#ifndef HAVE_SETNETGRENT |
85 |
++ g_set_error (error, |
86 |
++ POLKIT_ERROR, |
87 |
++ POLKIT_ERROR_FAILED, |
88 |
++ "Netgroups are not available on this machine"); |
89 |
++ goto out; |
90 |
++#else |
91 |
++ |
92 |
+ v = lookup_asv (details_gvariant, "name", G_VARIANT_TYPE_STRING, error); |
93 |
+ if (v == NULL) |
94 |
+ { |
95 |
+@@ -353,6 +369,7 @@ polkit_identity_new_for_gvariant (GVariant *variant, |
96 |
+ name = g_variant_get_string (v, NULL); |
97 |
+ ret = polkit_unix_netgroup_new (name); |
98 |
+ g_variant_unref (v); |
99 |
++#endif |
100 |
+ } |
101 |
+ else |
102 |
+ { |
103 |
+--- a/src/polkit/polkitunixnetgroup.c |
104 |
++++ b/src/polkit/polkitunixnetgroup.c |
105 |
+@@ -194,6 +194,9 @@ polkit_unix_netgroup_set_name (PolkitUnixNetgroup *group, |
106 |
+ PolkitIdentity * |
107 |
+ polkit_unix_netgroup_new (const gchar *name) |
108 |
+ { |
109 |
++#ifndef HAVE_SETNETGRENT |
110 |
++ g_assert_not_reached(); |
111 |
++#endif |
112 |
+ g_return_val_if_fail (name != NULL, NULL); |
113 |
+ return POLKIT_IDENTITY (g_object_new (POLKIT_TYPE_UNIX_NETGROUP, |
114 |
+ "name", name, |
115 |
+--- a/src/polkitbackend/polkitbackendinteractiveauthority.c |
116 |
++++ b/src/polkitbackend/polkitbackendinteractiveauthority.c |
117 |
+@@ -2233,25 +2233,26 @@ get_users_in_net_group (PolkitIdentity *group, |
118 |
+ GList *ret; |
119 |
+ |
120 |
+ ret = NULL; |
121 |
++#ifdef HAVE_SETNETGRENT |
122 |
+ name = polkit_unix_netgroup_get_name (POLKIT_UNIX_NETGROUP (group)); |
123 |
+ |
124 |
+-#ifdef HAVE_SETNETGRENT_RETURN |
125 |
++# ifdef HAVE_SETNETGRENT_RETURN |
126 |
+ if (setnetgrent (name) == 0) |
127 |
+ { |
128 |
+ g_warning ("Error looking up net group with name %s: %s", name, g_strerror (errno)); |
129 |
+ goto out; |
130 |
+ } |
131 |
+-#else |
132 |
++# else |
133 |
+ setnetgrent (name); |
134 |
+-#endif |
135 |
++# endif /* HAVE_SETNETGRENT_RETURN */ |
136 |
+ |
137 |
+ for (;;) |
138 |
+ { |
139 |
+-#if defined(HAVE_NETBSD) || defined(HAVE_OPENBSD) |
140 |
++# if defined(HAVE_NETBSD) || defined(HAVE_OPENBSD) |
141 |
+ const char *hostname, *username, *domainname; |
142 |
+-#else |
143 |
++# else |
144 |
+ char *hostname, *username, *domainname; |
145 |
+-#endif |
146 |
++# endif /* defined(HAVE_NETBSD) || defined(HAVE_OPENBSD) */ |
147 |
+ PolkitIdentity *user; |
148 |
+ GError *error = NULL; |
149 |
+ |
150 |
+@@ -2282,6 +2283,7 @@ get_users_in_net_group (PolkitIdentity *group, |
151 |
+ |
152 |
+ out: |
153 |
+ endnetgrent (); |
154 |
++#endif /* HAVE_SETNETGRENT */ |
155 |
+ return ret; |
156 |
+ } |
157 |
+ |
158 |
+--- a/src/polkitbackend/polkitbackendjsauthority.cpp |
159 |
++++ b/src/polkitbackend/polkitbackendjsauthority.cpp |
160 |
+@@ -1519,6 +1519,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx, |
161 |
+ |
162 |
+ JS::CallArgs args = JS::CallArgsFromVp (argc, vp); |
163 |
+ |
164 |
++#ifdef HAVE_SETNETGRENT |
165 |
+ JS::RootedString usrstr (authority->priv->cx); |
166 |
+ usrstr = args[0].toString(); |
167 |
+ user = JS_EncodeStringToUTF8 (cx, usrstr); |
168 |
+@@ -1533,6 +1534,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx, |
169 |
+ { |
170 |
+ is_in_netgroup = true; |
171 |
+ } |
172 |
++#endif |
173 |
+ |
174 |
+ ret = true; |
175 |
+ |
176 |
+--- a/test/polkit/polkitidentitytest.c |
177 |
++++ b/test/polkit/polkitidentitytest.c |
178 |
+@@ -19,6 +19,7 @@ |
179 |
+ * Author: Nikki VonHollen <vonhollen@××××××.com> |
180 |
+ */ |
181 |
+ |
182 |
++#include "config.h" |
183 |
+ #include "glib.h" |
184 |
+ #include <polkit/polkit.h> |
185 |
+ #include <polkit/polkitprivate.h> |
186 |
+@@ -145,11 +146,15 @@ struct ComparisonTestData comparison_test_data [] = { |
187 |
+ {"unix-group:root", "unix-group:jane", FALSE}, |
188 |
+ {"unix-group:jane", "unix-group:jane", TRUE}, |
189 |
+ |
190 |
++#ifdef HAVE_SETNETGRENT |
191 |
+ {"unix-netgroup:foo", "unix-netgroup:foo", TRUE}, |
192 |
+ {"unix-netgroup:foo", "unix-netgroup:bar", FALSE}, |
193 |
++#endif |
194 |
+ |
195 |
+ {"unix-user:root", "unix-group:root", FALSE}, |
196 |
++#ifdef HAVE_SETNETGRENT |
197 |
+ {"unix-user:jane", "unix-netgroup:foo", FALSE}, |
198 |
++#endif |
199 |
+ |
200 |
+ {NULL}, |
201 |
+ }; |
202 |
+@@ -181,11 +186,13 @@ main (int argc, char *argv[]) |
203 |
+ g_test_add_data_func ("/PolkitIdentity/group_string_2", "unix-group:jane", test_string); |
204 |
+ g_test_add_data_func ("/PolkitIdentity/group_string_3", "unix-group:users", test_string); |
205 |
+ |
206 |
++#ifdef HAVE_SETNETGRENT |
207 |
+ g_test_add_data_func ("/PolkitIdentity/netgroup_string", "unix-netgroup:foo", test_string); |
208 |
++ g_test_add_data_func ("/PolkitIdentity/netgroup_gvariant", "unix-netgroup:foo", test_gvariant); |
209 |
++#endif |
210 |
+ |
211 |
+ g_test_add_data_func ("/PolkitIdentity/user_gvariant", "unix-user:root", test_gvariant); |
212 |
+ g_test_add_data_func ("/PolkitIdentity/group_gvariant", "unix-group:root", test_gvariant); |
213 |
+- g_test_add_data_func ("/PolkitIdentity/netgroup_gvariant", "unix-netgroup:foo", test_gvariant); |
214 |
+ |
215 |
+ add_comparison_tests (); |
216 |
+ |
217 |
+--- a/test/polkit/polkitunixnetgrouptest.c |
218 |
++++ b/test/polkit/polkitunixnetgrouptest.c |
219 |
+@@ -19,6 +19,7 @@ |
220 |
+ * Author: Nikki VonHollen <vonhollen@××××××.com> |
221 |
+ */ |
222 |
+ |
223 |
++#include "config.h" |
224 |
+ #include "glib.h" |
225 |
+ #include <polkit/polkit.h> |
226 |
+ #include <string.h> |
227 |
+@@ -69,7 +70,9 @@ int |
228 |
+ main (int argc, char *argv[]) |
229 |
+ { |
230 |
+ g_test_init (&argc, &argv, NULL); |
231 |
++#ifdef HAVE_SETNETGRENT |
232 |
+ g_test_add_func ("/PolkitUnixNetgroup/new", test_new); |
233 |
+ g_test_add_func ("/PolkitUnixNetgroup/set_name", test_set_name); |
234 |
++#endif |
235 |
+ return g_test_run (); |
236 |
+ } |
237 |
+--- a/test/polkitbackend/test-polkitbackendjsauthority.c |
238 |
++++ b/test/polkitbackend/test-polkitbackendjsauthority.c |
239 |
+@@ -137,12 +137,14 @@ test_get_admin_identities (void) |
240 |
+ "unix-group:users" |
241 |
+ } |
242 |
+ }, |
243 |
++#ifdef HAVE_SETNETGRENT |
244 |
+ { |
245 |
+ "net.company.action3", |
246 |
+ { |
247 |
+ "unix-netgroup:foo" |
248 |
+ } |
249 |
+ }, |
250 |
++#endif |
251 |
+ }; |
252 |
+ guint n; |
253 |
+ |
254 |
|
255 |
diff --git a/sys-auth/polkit/polkit-0.120_p20220127.ebuild b/sys-auth/polkit/polkit-0.120_p20220127.ebuild |
256 |
index c92d740a4cb2..5a56448ed7cb 100644 |
257 |
--- a/sys-auth/polkit/polkit-0.120_p20220127.ebuild |
258 |
+++ b/sys-auth/polkit/polkit-0.120_p20220127.ebuild |
259 |
@@ -69,6 +69,9 @@ QA_MULTILIB_PATHS=" |
260 |
|
261 |
src_prepare() { |
262 |
local PATCHES=( |
263 |
+ # musl |
264 |
+ "${FILESDIR}"/${PN}-0.118-make-netgroup-support-optional.patch |
265 |
+ # Pending upstream |
266 |
"${FILESDIR}"/${PN}-0.120-meson.patch |
267 |
) |