1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
diff --git a/configure.ac b/configure.ac
index 4bb6d90..8d30a95 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,7 +158,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 innetgr)
if test "x$GCC" = "xyes"; then
LDFLAGS="-Wl,--as-needed $LDFLAGS"
diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
index 3bd2f0b..9d2ec61 100644
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
@@ -2103,6 +2103,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)
@@ -2154,6 +2155,7 @@ get_users_in_net_group (PolkitIdentity *group,
endnetgrent ();
return ret;
}
+#endif
/* ---------------------------------------------------------------------------------------------------- */
@@ -2243,10 +2245,12 @@ authentication_agent_initiate_challenge (AuthenticationAgent *agent,
{
user_identities = g_list_concat (user_identities, get_users_in_group (identity, FALSE));
}
+#if defined HAVE_GETNETGRENT
else if (POLKIT_IS_UNIX_NETGROUP (identity))
{
user_identities = g_list_concat (user_identities, get_users_in_net_group (identity, FALSE));
}
+#endif
else
{
g_warning ("Unsupported identity");
diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
index bc2fe22..b84c110 100644
--- a/src/polkitbackend/polkitbackendjsauthority.c
+++ b/src/polkitbackend/polkitbackendjsauthority.c
@@ -29,6 +29,7 @@
#include <glib/gstdio.h>
#include <locale.h>
#include <glib/gi18n-lib.h>
+#include <sys/wait.h>
#include <polkit/polkit.h>
#include "polkitbackendjsauthority.h"
@@ -1450,13 +1451,16 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
JSBool ret = JS_FALSE;
JSString *user_str;
JSString *netgroup_str;
- char *user;
- char *netgroup;
JSBool is_in_netgroup = JS_FALSE;
if (!JS_ConvertArguments (cx, argc, JS_ARGV (cx, vp), "SS", &user_str, &netgroup_str))
goto out;
+#if defined(HAVE_INNETGR)
+ {
+ char *user;
+ char *netgroup;
+
user = JS_EncodeString (cx, user_str);
netgroup = JS_EncodeString (cx, netgroup_str);
@@ -1470,6 +1474,8 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
JS_free (cx, netgroup);
JS_free (cx, user);
+ }
+#endif
ret = JS_TRUE;
|