freeipa/daemons/ipa-slapi-plugins/ipa-extdom-extop
Alexander Bokovoy 3a42bc0960 extdom-extop: refactor tests to use unshare+chroot to override nss_files configuration
Unit tests for ipa-extdom-extop plugin use nss_files.so.2 module to test the
functionality instead of relying on SSSD API or nss_sss.so.2 module. The latter
two cannot be used in build environment.

nss_files.so.2 always tries to open /etc/passwd and /etc/group. In past, we
overloaded 'fopen()' to change the path to opened file but this stops working
after glibc consolidate file opening in nss_files with the code starting at
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=299210c1fa67e2dfb564475986fce11cd33db9ad,
this method is not usable anymore and builds against glibc 2.31.9000+ fail in
cmocka unit test execution in Rawhide.

Apply an alternative approach that uses a new user namespace to unshare the
test from its parent and chroot to the test data where expected /etc/passwd and
/etc/group are provided. This method works only on Linux, thus only run the
unit test on Linux.

In case unshare() or chroot() fail, we have to skip tests that use
nss_files.so.2.

Fixes: https://pagure.io/freeipa/issue/8437
Signed-off-by: Alexander Bokovoy <abokovoy@redhat.com>
Reviewed-By: Rob Crittenden <rcritten@redhat.com>
2020-08-04 18:43:22 +03:00
..
test_data/etc extdom-extop: refactor tests to use unshare+chroot to override nss_files configuration 2020-08-04 18:43:22 +03:00
back_extdom_nss_sss.c extdom: plugin doesn't use timeout in blocking call 2019-09-12 10:48:13 +03:00
back_extdom_sss_idmap.c extdom: plugin doesn't use timeout in blocking call 2019-09-12 10:48:13 +03:00
back_extdom.h extdom: plugin doesn't use timeout in blocking call 2019-09-12 10:48:13 +03:00
ipa_extdom_cmocka_tests.c extdom-extop: refactor tests to use unshare+chroot to override nss_files configuration 2020-08-04 18:43:22 +03:00
ipa_extdom_common.c extdom: use sss_nss_*_timeout calls 2019-09-12 10:48:13 +03:00
ipa_extdom_extop.c extdom: plugin doesn't use timeout in blocking call 2019-09-12 10:48:13 +03:00
ipa_extdom.h extdom: plugin doesn't use timeout in blocking call 2019-09-12 10:48:13 +03:00
ipa-extdom-extop-conf.ldif Add external domain extop DS plugin 2012-06-28 13:08:26 +02:00
Makefile.am extdom-extop: refactor tests to use unshare+chroot to override nss_files configuration 2020-08-04 18:43:22 +03:00
README Add external domain extop DS plugin 2012-06-28 13:08:26 +02:00