Fails to build with the error:
../../src/polkitbackend/.libs/libpolkit-backend-1.so: undefined reference to `setnetgrent'
../../src/polkitbackend/.libs/libpolkit-backend-1.so: undefined reference to `innetgr'
../../src/polkitbackend/.libs/libpolkit-backend-1.so: undefined reference to `getnetgrent'
../../src/polkitbackend/.libs/libpolkit-backend-1.so: undefined reference to `endnetgrent'
collect2: ld returned 1 exit status
make: *** [polkitd] Error 1
make: Leaving directory `/home/ncopa/aports/main/polkit/src/polkit-0.105/src/polkitd'
The problem is that netgroup (introduced with 674357c20c1b6cb421fea6eb6924b274ec477c0e) is not defined in POSIX and therefore not implemented in uclibc. The netgroup support should be a compiletime option.
Please note that it is during linking that the error happens so the configure script could check for getnetgrent linking.
related bug: #43610
Created attachment 61878 [details] [review]
Quick and dirty fix
This quick-and-dirty patch makes it compile and should work. You might want add an --disable-netgroups configure option or similar.
Created attachment 73996 [details] [review]
make netgroup support optional
Updated version of the patch.
Created attachment 118753 [details] [review]
make netgroup support optional for version 0.113
It also does not work as is with version 0.113 on Lilblue (Gentoo using uclibc as system libc). My patch is a little different from the Natanel's one.
Thanks for the patch.
1. If a system administrator does configure the system to use netgroups, polkit should somehow visibly refuse the configuration instead of silently ignoring it. Sadly polkit_unix_netgroup_new() cannot fail, so it might mean tracking down the callers and how they are used. (Then, get_user_in_net_group/js_polkit_user_is_in_netgroup could perhaps be #ifdef-ed to g_assert_not_reached()}.
2. Code-wise, it would be nice to minimize the number of ifdefs/conditions in the code. I guess that would mean having #ifdefs only inside get_users_in_net_group and js_polkit_user_is_in_netgroup instead of removing the functions entirely and then needing more ifdefs in their callers.
Sadly I don’t have _that_ much time for polkit and supporting non-glibc systems is honestly quite low on the priority list; still, 1. above does need to be dealt with before shipping support in an upstream release.
Created attachment 140555 [details] [review]
Make Netgroup support optional
This patch has been written entirely from scratch by me from the latest Git master.
It takes all of the advice from the last patch's review:
- Show an error if configuration includes 'unix-netgroup:'.
- Put g_assert_not_reached in polkit_unix_netgroup_new since all callers have been modified to error out before it is reached.
- Pass all tests on a glibc/x86_64 machine and a musl/ppc64 machine.
Created attachment 140556 [details] [review]
Make Netgroup support optional
And this one foregoes adding itself as a new file in the root source tree... whoops. Sorry about that.
-- GitLab Migration Automatic Message --
This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/polkit/polkit/issues/14.