comparison security/polkit/make-innetgr-optional.patch @ 490:dbffca6c243e

security/polkit: initial import, closes #1578
author David Demelier <markand@malikania.fr>
date Sun, 07 Apr 2019 14:36:39 +0200
parents
children
comparison
equal deleted inserted replaced
489:ba543d44b357 490:dbffca6c243e
1 --- configure.ac
2 +++ configure.ac
3 @@ -99,7 +99,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
4 [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
5 AC_SUBST(EXPAT_LIBS)
6
7 -AC_CHECK_FUNCS(clearenv fdatasync)
8 +AC_CHECK_FUNCS(clearenv fdatasync getnetgrent)
9
10 if test "x$GCC" = "xyes"; then
11 LDFLAGS="-Wl,--as-needed $LDFLAGS"
12 --- src/polkitbackend/polkitbackendinteractiveauthority.c
13 +++ src/polkitbackend/polkitbackendinteractiveauthority.c
14 @@ -2228,6 +2228,7 @@ get_users_in_net_group (PolkitIdentity *group,
15 ret = NULL;
16 name = polkit_unix_netgroup_get_name (POLKIT_UNIX_NETGROUP (group));
17
18 +#if defined HAVE_GETNETGRENT
19 #ifdef HAVE_SETNETGRENT_RETURN
20 if (setnetgrent (name) == 0)
21 {
22 @@ -2236,6 +2237,7 @@ get_users_in_net_group (PolkitIdentity *group,
23 }
24 #else
25 setnetgrent (name);
26 +#endif
27 #endif
28
29 for (;;)
30 @@ -2248,8 +2250,10 @@ get_users_in_net_group (PolkitIdentity *group,
31 PolkitIdentity *user;
32 GError *error = NULL;
33
34 +#if defined HAVE_GETNETGRENT
35 if (getnetgrent (&hostname, &username, &domainname) == 0)
36 break;
37 +#endif
38
39 /* Skip NULL entries since we never want to make everyone an admin
40 * Skip "-" entries which mean "no match ever" in netgroup land */
41 @@ -2274,7 +2278,9 @@ get_users_in_net_group (PolkitIdentity *group,
42 ret = g_list_reverse (ret);
43
44 out:
45 +#if defined HAVE_GETNETGRENT
46 endnetgrent ();
47 +#endif
48 return ret;
49 }
50
51 --- src/polkitbackend/polkitbackendjsauthority.cpp
52 +++ src/polkitbackend/polkitbackendjsauthority.cpp
53 @@ -1499,6 +1499,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
54
55 JS::CallArgs args = JS::CallArgsFromVp (argc, vp);
56
57 +#if defined HAVE_GETNETGRENT
58 user = JS_EncodeString (cx, args[0].toString());
59 netgroup = JS_EncodeString (cx, args[1].toString());
60
61 @@ -1514,6 +1515,7 @@ js_polkit_user_is_in_netgroup (JSContext *cx,
62 JS_free (cx, user);
63
64 ret = true;
65 +#endif
66
67 args.rval ().setBoolean (is_in_netgroup);
68