wok-next view polkit105/stuff/patches/0001-Bug-50145-make-netgroup-support-optional.patch @ rev 21449

updated slock (1.1 -> 1.4)
author Hans-G?nter Theisgen
date Thu May 07 07:51:56 2020 +0100 (2020-05-07)
parents
children
line source
1 From 2428beec9189bb93e6e1fdd5bdde35acf5279a03 Mon Sep 17 00:00:00 2001
2 From: Natanael Copa <ncopa@alpinelinux.org>
3 Date: Sun, 20 May 2012 15:42:56 +0200
4 Subject: [PATCH] Bug 50145 - make netgroup support optional
6 https://bugs.freedesktop.org/show_bug.cgi?id=50145
8 netgroups are not defined in POSIX and are not be available on
9 all systems.
11 We check for getnetgrent in configure script.
13 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
14 ---
15 configure.ac | 2 +-
16 src/polkitbackend/polkitbackendlocalauthority.c | 8 ++++++--
17 src/polkitbackend/polkitbackendlocalauthorizationstore.c | 3 ++-
18 3 files changed, 9 insertions(+), 4 deletions(-)
20 diff --git a/configure.ac b/configure.ac
21 index f325922..711aa7c 100644
22 --- a/configure.ac
23 +++ b/configure.ac
24 @@ -141,7 +141,7 @@ AC_CHECK_LIB(expat,XML_ParserCreate,[EXPAT_LIBS="-lexpat"],
25 [AC_MSG_ERROR([Can't find expat library. Please install expat.])])
26 AC_SUBST(EXPAT_LIBS)
28 -AC_CHECK_FUNCS(clearenv)
29 +AC_CHECK_FUNCS(clearenv getnetgrent)
31 if test "x$GCC" = "xyes"; then
32 LDFLAGS="-Wl,--as-needed $LDFLAGS"
33 diff --git a/src/polkitbackend/polkitbackendlocalauthority.c b/src/polkitbackend/polkitbackendlocalauthority.c
34 index b53eda3..f14e924 100644
35 --- a/src/polkitbackend/polkitbackendlocalauthority.c
36 +++ b/src/polkitbackend/polkitbackendlocalauthority.c
37 @@ -52,9 +52,10 @@
39 static GList *get_users_in_group (PolkitIdentity *group,
40 gboolean include_root);
41 -
42 +#if defined HAVE_GETNETGRENT
43 static GList *get_users_in_net_group (PolkitIdentity *group,
44 gboolean include_root);
45 +#endif
47 static GList *get_groups_for_user (PolkitIdentity *user);
49 @@ -511,10 +512,12 @@ polkit_backend_local_authority_get_admin_auth_identities (PolkitBackendInteracti
50 {
51 ret = g_list_concat (ret, get_users_in_group (identity, FALSE));
52 }
53 +#if defined HAVE_GETNETGRENT
54 else if (POLKIT_IS_UNIX_NETGROUP (identity))
55 {
56 ret = g_list_concat (ret, get_users_in_net_group (identity, FALSE));
57 }
58 +#endif
59 else
60 {
61 g_warning ("Unsupported identity %s", admin_identities[n]);
62 @@ -690,6 +693,7 @@ get_users_in_group (PolkitIdentity *group,
63 return ret;
64 }
66 +#if defined HAVE_GETNETGRENT
67 static GList *
68 get_users_in_net_group (PolkitIdentity *group,
69 gboolean include_root)
70 @@ -741,7 +745,7 @@ get_users_in_net_group (PolkitIdentity *group,
71 endnetgrent ();
72 return ret;
73 }
74 -
75 +#endif
77 static GList *
78 get_groups_for_user (PolkitIdentity *user)
79 diff --git a/src/polkitbackend/polkitbackendlocalauthorizationstore.c b/src/polkitbackend/polkitbackendlocalauthorizationstore.c
80 index 2ddfe75..02553c4 100644
81 --- a/src/polkitbackend/polkitbackendlocalauthorizationstore.c
82 +++ b/src/polkitbackend/polkitbackendlocalauthorizationstore.c
83 @@ -725,6 +725,7 @@ polkit_backend_local_authorization_store_lookup (PolkitBackendLocalAuthorization
84 break;
85 }
87 +#if defined HAVE_GETNETGRENT
88 /* if no identity specs matched and identity is a user, match against netgroups */
89 if (ll == NULL && POLKIT_IS_UNIX_USER (identity))
90 {
91 @@ -732,13 +733,13 @@ polkit_backend_local_authorization_store_lookup (PolkitBackendLocalAuthorization
92 const gchar *user_name = polkit_unix_user_get_name (user_identity);
93 if (!user_name)
94 continue;
95 -
96 for (ll = authorization->netgroup_identities; ll != NULL; ll = ll->next)
97 {
98 if (innetgr ((const gchar *) ll->data, NULL, user_name, NULL))
99 break;
100 }
101 }
102 +#endif
104 if (ll == NULL)
105 continue;
106 --
107 1.7.10.2