aboutsummaryrefslogtreecommitdiffstats
path: root/testing/polkit-elogind/make-innetgr-optional.patch
blob: 338c201745a50fabb880522aee549ab5d71f1cb0 (plain) (blame)
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
--- 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
@@ -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);