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

69 lines
2.0 KiB
Diff

--- a/configure.ac
+++ b/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"
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
+++ b/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;
}
--- a/src/polkitbackend/polkitbackendjsauthority.cpp
+++ b/src/polkitbackend/polkitbackendjsauthority.cpp
@@ -1502,6 +1502,7 @@
JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
+#if defined HAVE_GETNETGRENT
JS::RootedString usrstr (authority->priv->cx);
usrstr = args[0].toString();
user = JS_EncodeStringToUTF8 (cx, usrstr);
@@ -1521,6 +1522,7 @@
JS_free (cx, user);
ret = true;
+#endif
args.rval ().setBoolean (is_in_netgroup);