--- 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: