polkit{,-elogind}: fix musl
This commit is contained in:
parent
d2ffdd84eb
commit
885c4d4fca
3 changed files with 68 additions and 104 deletions
68
srcpkgs/polkit/patches/fix-no-innetgr.patch
Normal file
68
srcpkgs/polkit/patches/fix-no-innetgr.patch
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
--- configure.ac
|
||||||
|
+++ configure.ac
|
||||||
|
@@ -102,7 +102,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
|
||||||
|
[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
|
||||||
|
AC_SUBST(EXPAT_LIBS)
|
||||||
|
|
||||||
|
-AC_CHECK_FUNCS(clearenv fdatasync)
|
||||||
|
+AC_CHECK_FUNCS(clearenv fdatasync getnetgrent)
|
||||||
|
|
||||||
|
if test "x$GCC" = "xyes"; then
|
||||||
|
LDFLAGS="-Wl,--as-needed $LDFLAGS"
|
||||||
|
--- src/polkitbackend/polkitbackendinteractiveauthority.c
|
||||||
|
+++ src/polkitbackend/polkitbackendinteractiveauthority.c
|
||||||
|
@@ -2227,6 +2227,7 @@ get_users_in_net_group (PolkitIdentity *group,
|
||||||
|
ret = NULL;
|
||||||
|
name = polkit_unix_netgroup_get_name (POLKIT_UNIX_NETGROUP (group));
|
||||||
|
|
||||||
|
+#if defined HAVE_GETNETGRENT
|
||||||
|
#ifdef HAVE_SETNETGRENT_RETURN
|
||||||
|
if (setnetgrent (name) == 0)
|
||||||
|
{
|
||||||
|
@@ -2235,6 +2236,7 @@ get_users_in_net_group (PolkitIdentity *group,
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
setnetgrent (name);
|
||||||
|
+#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
@@ -2247,8 +2249,10 @@ get_users_in_net_group (PolkitIdentity *group,
|
||||||
|
PolkitIdentity *user;
|
||||||
|
GError *error = NULL;
|
||||||
|
|
||||||
|
+#if defined HAVE_GETNETGRENT
|
||||||
|
if (getnetgrent (&hostname, &username, &domainname) == 0)
|
||||||
|
break;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/* Skip NULL entries since we never want to make everyone an admin
|
||||||
|
* Skip "-" entries which mean "no match ever" in netgroup land */
|
||||||
|
@@ -2273,7 +2277,9 @@ get_users_in_net_group (PolkitIdentity *group,
|
||||||
|
ret = g_list_reverse (ret);
|
||||||
|
|
||||||
|
out:
|
||||||
|
+#if defined HAVE_GETNETGRENT
|
||||||
|
endnetgrent ();
|
||||||
|
+#endif
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
--- src/polkitbackend/polkitbackendjsauthority.cpp
|
||||||
|
+++ src/polkitbackend/polkitbackendjsauthority.cpp
|
||||||
|
@@ -1492,6 +1492,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
|
||||||
|
if (!JS_ConvertArguments (cx, argc, JS_ARGV (cx, vp), "SS", &user_str, &netgroup_str))
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
+#if defined HAVE_GETNETGRENT
|
||||||
|
user = JS_EncodeString (cx, user_str);
|
||||||
|
netgroup = JS_EncodeString (cx, netgroup_str);
|
||||||
|
|
||||||
|
@@ -1507,6 +1508,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
|
||||||
|
JS_free (cx, user);
|
||||||
|
|
||||||
|
ret = JS_TRUE;
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
JS_SET_RVAL (cx, vp, BOOLEAN_TO_JSVAL (is_in_netgroup));
|
||||||
|
out:
|
|
@ -1,103 +0,0 @@
|
||||||
From 2428beec9189bb93e6e1fdd5bdde35acf5279a03 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Natanael Copa <ncopa@alpinelinux.org>
|
|
||||||
Date: Sun, 20 May 2012 15:42:56 +0200
|
|
||||||
Subject: [PATCH] Bug 50145 - make netgroup support optional
|
|
||||||
|
|
||||||
https://bugs.freedesktop.org/show_bug.cgi?id=50145
|
|
||||||
|
|
||||||
netgroups are not defined in POSIX and are not be available on
|
|
||||||
all systems.
|
|
||||||
|
|
||||||
We check for getnetgrent in configure script.
|
|
||||||
|
|
||||||
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
|
||||||
---
|
|
||||||
configure.ac | 2 +-
|
|
||||||
src/polkitbackend/polkitbackendlocalauthority.c | 8 ++++++--
|
|
||||||
src/polkitbackend/polkitbackendlocalauthorizationstore.c | 3 ++-
|
|
||||||
3 files changed, 9 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
--- configure.ac
|
|
||||||
+++ configure.ac
|
|
||||||
@@ -141,7 +141,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
|
|
||||||
[AC_MSG_ERROR([Can't find expat library. Please install expat.])])
|
|
||||||
AC_SUBST(EXPAT_LIBS)
|
|
||||||
|
|
||||||
-AC_CHECK_FUNCS(clearenv)
|
|
||||||
+AC_CHECK_FUNCS(clearenv getnetgrent)
|
|
||||||
|
|
||||||
if test "x$GCC" = "xyes"; then
|
|
||||||
LDFLAGS="-Wl,--as-needed $LDFLAGS"
|
|
||||||
--- src/polkitbackend/polkitbackendlocalauthority.c
|
|
||||||
+++ src/polkitbackend/polkitbackendlocalauthority.c
|
|
||||||
@@ -52,9 +52,10 @@
|
|
||||||
|
|
||||||
static GList *get_users_in_group (PolkitIdentity *group,
|
|
||||||
gboolean include_root);
|
|
||||||
-
|
|
||||||
+#if defined HAVE_GETNETGRENT
|
|
||||||
static GList *get_users_in_net_group (PolkitIdentity *group,
|
|
||||||
gboolean include_root);
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
static GList *get_groups_for_user (PolkitIdentity *user);
|
|
||||||
|
|
||||||
@@ -511,10 +512,12 @@ polkit_backend_local_authority_get_admin_auth_identities (PolkitBackendInteracti
|
|
||||||
{
|
|
||||||
ret = g_list_concat (ret, get_users_in_group (identity, FALSE));
|
|
||||||
}
|
|
||||||
+#if defined HAVE_GETNETGRENT
|
|
||||||
else if (POLKIT_IS_UNIX_NETGROUP (identity))
|
|
||||||
{
|
|
||||||
ret = g_list_concat (ret, get_users_in_net_group (identity, FALSE));
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_warning ("Unsupported identity %s", admin_identities[n]);
|
|
||||||
@@ -690,6 +693,7 @@ get_users_in_group (PolkitIdentity *group,
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if defined HAVE_GETNETGRENT
|
|
||||||
static GList *
|
|
||||||
get_users_in_net_group (PolkitIdentity *group,
|
|
||||||
gboolean include_root)
|
|
||||||
@@ -741,7 +745,7 @@ get_users_in_net_group (PolkitIdentity *group,
|
|
||||||
endnetgrent ();
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
-
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
static GList *
|
|
||||||
get_groups_for_user (PolkitIdentity *user)
|
|
||||||
--- src/polkitbackend/polkitbackendlocalauthorizationstore.c
|
|
||||||
+++ src/polkitbackend/polkitbackendlocalauthorizationstore.c
|
|
||||||
@@ -725,6 +725,7 @@ polkit_backend_local_authorization_store_lookup (PolkitBackendLocalAuthorization
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
+#if defined HAVE_GETNETGRENT
|
|
||||||
/* if no identity specs matched and identity is a user, match against netgroups */
|
|
||||||
if (ll == NULL && POLKIT_IS_UNIX_USER (identity))
|
|
||||||
{
|
|
||||||
@@ -732,13 +733,13 @@ polkit_backend_local_authorization_store_lookup (PolkitBackendLocalAuthorization
|
|
||||||
const gchar *user_name = polkit_unix_user_get_name (user_identity);
|
|
||||||
if (!user_name)
|
|
||||||
continue;
|
|
||||||
-
|
|
||||||
for (ll = authorization->netgroup_identities; ll != NULL; ll = ll->next)
|
|
||||||
{
|
|
||||||
if (innetgr ((const gchar *) ll->data, NULL, user_name, NULL))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+#endif
|
|
||||||
|
|
||||||
if (ll == NULL)
|
|
||||||
continue;
|
|
||||||
--
|
|
||||||
1.7.10.2
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,6 @@ license="GPL-2"
|
||||||
#checksum=e1c095093c654951f78f8618d427faf91cf62abdefed98de40ff65eca6413c81
|
#checksum=e1c095093c654951f78f8618d427faf91cf62abdefed98de40ff65eca6413c81
|
||||||
wrksrc=$pkgname
|
wrksrc=$pkgname
|
||||||
_hash=29ba7afba1b79a325183a71966f35926dfdf506e
|
_hash=29ba7afba1b79a325183a71966f35926dfdf506e
|
||||||
patch_args="-Np1"
|
|
||||||
|
|
||||||
hostmakedepends="automake libtool gettext-devel pkg-config intltool libxslt
|
hostmakedepends="automake libtool gettext-devel pkg-config intltool libxslt
|
||||||
docbook-xsl glib-devel gtk-doc gobject-introspection git autoconf-archive"
|
docbook-xsl glib-devel gtk-doc gobject-introspection git autoconf-archive"
|
||||||
|
|
Loading…
Reference in a new issue