void-packages/srcpkgs/polkit-elogind/patches/make-innetgr-optional.patch

69 lines
2.0 KiB
Diff

--- configure.ac
+++ configure.ac
@@ -99,7 +99,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
@@ -2228,6 +2228,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)
{
@@ -2236,6 +2237,7 @@ get_users_in_net_group (PolkitIdentity *group,
}
#else
setnetgrent (name);
+#endif
#endif
for (;;)
@@ -2248,8 +2250,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 */
@@ -2274,7 +2278,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
@@ -1499,6 +1499,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
+#if defined HAVE_GETNETGRENT
user = JS_EncodeString (cx, args[0].toString());
netgroup = JS_EncodeString (cx, args[1].toString());
@@ -1514,6 +1515,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
JS_free (cx, user);
ret = true;
+#endif
args.rval ().setBoolean (is_in_netgroup);