36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce Simo Sorce <simo@redhat.com>
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce Copyright (C) 2013 Red Hat
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce This program is free software; you can redistribute it and/or modify
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce it under the terms of the GNU General Public License as published by
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce the Free Software Foundation; either version 3 of the License, or
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce (at your option) any later version.
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce This program is distributed in the hope that it will be useful,
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce but WITHOUT ANY WARRANTY; without even the implied warranty of
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce GNU General Public License for more details.
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce You should have received a copy of the GNU General Public License
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce along with this program. If not, see <http://www.gnu.org/licenses/>.
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_debug.so", { LIBPFX"libsss_debug.so", NULL } },
42ec8af02ecf1937e4db9b1ecc6216022634f0f9Michal Zidek { "libsss_semanage.so", { LIBPFX"libsss_semanage.so", NULL } },
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libipa_hbac.so", { LIBPFX"libipa_hbac.so", NULL } },
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_idmap.so", { LIBPFX"libsss_idmap.so", NULL } },
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_nss_idmap.so", { LIBPFX"libsss_nss_idmap.so", NULL } },
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libnss_sss.so", { LIBPFX"libnss_sss.so", NULL } },
db36dca3d45e6eefbb30042ee65876566f1a6014Sumit Bose { "libsss_certmap.so", { LIBPFX"libsss_certmap.so", NULL } },
885386b7e3f1c3e74b354576b98a092b0835d64eSumit Bose { "libwbclient.so", { LIBPFX"libwbclient.so", NULL } },
25cd72fd477acaecbb827b68f0a425ccb79c184cSumit Bose#endif /* BUILD_LIBWBCLIENT */
7a6a7db9a535d6cceb61c080594c67feccbcea12Lukas Slebodnik { "libsss_simpleifp.so", { LIBPFX"libsss_simpleifp.so", NULL } },
7a6a7db9a535d6cceb61c080594c67feccbcea12Lukas Slebodnik#endif /* BUILD_IFP */
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_sudo.so", { LIBPFX"libsss_sudo.so", NULL } },
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_autofs.so", { LIBPFX"libsss_autofs.so", NULL } },
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "sssd_krb5_locator_plugin.so", { LIBPFX"sssd_krb5_locator_plugin.so",
8a5e793a0576250da80371e53aa3e7eba15cdb63Sumit Bose { "sssd_krb5_localauth_plugin.so", { LIBPFX"sssd_krb5_localauth_plugin.so",
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "sssd_pac_plugin.so", { LIBPFX"sssd_pac_plugin.so", NULL } },
af4ffe1001adcc0a96897e426d26444f07af9aa1Benjamin Franzke { "cifs_idmap_sss.so", { LIBPFX"cifs_idmap_sss.so", NULL } },
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "memberof.so", { LIBPFX"memberof.so", NULL } },
5a05b6127064c74349f1edae32e5e13032c386feLukas Slebodnik { "libsss_child.so", { LIBPFX"libsss_util.so",
5a05b6127064c74349f1edae32e5e13032c386feLukas Slebodnik { "libsss_crypt.so", { LIBPFX"libsss_crypt.so", NULL } },
558b8f3cd2439c01e139cf5f812aea9409fe776aLukas Slebodnik { "libsss_cert.so", { LIBPFX"libsss_cert.so", NULL } },
5a05b6127064c74349f1edae32e5e13032c386feLukas Slebodnik { "libsss_util.so", { LIBPFX"libsss_util.so", NULL } },
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_simple.so", { LIBPFX"libdlopen_test_providers.so",
c71e0a6710418991d759a329b8dcb77c7ad3e16eJakub Hrozek { "libsss_files.so", { LIBPFX"libdlopen_test_providers.so",
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_ad.so", { LIBPFX"libdlopen_test_providers.so",
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_ipa.so", { LIBPFX"libdlopen_test_providers.so",
d708e53d0df0c1ed4cc0097bebfa2a84d7b20fadLukas Slebodnik { "winbind_idmap_sss.so", { LIBPFX"libdlopen_test_winbind_idmap.so",
a2e417f38c57ed87c956ddcecf4dafca93842b65Lukas Slebodnik#endif /* BUILD_SAMBA */
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_krb5.so", { LIBPFX"libdlopen_test_providers.so",
a25942bc2f6ac9b3b2817ede35fa2b445373c6e4Lukas Slebodnik { "libsss_krb5_common.so", { LIBPFX"libdlopen_test_providers.so",
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_ldap.so", { LIBPFX"libdlopen_test_providers.so",
a25942bc2f6ac9b3b2817ede35fa2b445373c6e4Lukas Slebodnik { "libsss_ldap_common.so", { LIBPFX"libdlopen_test_providers.so",
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce { "libsss_proxy.so", { LIBPFX"libdlopen_test_providers.so",
889706cbc739358c2a0aac2ba6bc054fdc8e048bLukas Slebodnik { "_py2hbac.so", { LIBPFX"_py2hbac.so", NULL } },
889706cbc739358c2a0aac2ba6bc054fdc8e048bLukas Slebodnik { "_py2sss.so", { LIBPFX"_py2sss.so", NULL } },
889706cbc739358c2a0aac2ba6bc054fdc8e048bLukas Slebodnik { "_py2sss_murmur.so", { LIBPFX"_py2sss_murmur.so", NULL } },
889706cbc739358c2a0aac2ba6bc054fdc8e048bLukas Slebodnik { "_py2sss_nss_idmap.so", { LIBPFX"_py2sss_nss_idmap.so", NULL } },
889706cbc739358c2a0aac2ba6bc054fdc8e048bLukas Slebodnik { "_py3hbac.so", { LIBPFX"_py3hbac.so", NULL } },
889706cbc739358c2a0aac2ba6bc054fdc8e048bLukas Slebodnik { "_py3sss.so", { LIBPFX"_py3sss.so", NULL } },
889706cbc739358c2a0aac2ba6bc054fdc8e048bLukas Slebodnik { "_py3sss_murmur.so", { LIBPFX"_py3sss_murmur.so", NULL } },
889706cbc739358c2a0aac2ba6bc054fdc8e048bLukas Slebodnik { "_py3sss_nss_idmap.so", { LIBPFX"_py3sss_nss_idmap.so", NULL } },
558b8f3cd2439c01e139cf5f812aea9409fe776aLukas Slebodnik /* for testing purposes */
d708e53d0df0c1ed4cc0097bebfa2a84d7b20fadLukas Slebodnik { "libdlopen_test_providers.so", { LIBPFX"libdlopen_test_providers.so",
558b8f3cd2439c01e139cf5f812aea9409fe776aLukas Slebodnik { "libsss_nss_idmap_tests.so", { LIBPFX"libsss_nss_idmap_tests.so",
558b8f3cd2439c01e139cf5f812aea9409fe776aLukas Slebodnik { LIBPFX"libdlopen_test_winbind_idmap.so", NULL } },
558b8f3cd2439c01e139cf5f812aea9409fe776aLukas Slebodnik { "libsss_ad_tests.so", { LIBPFX"libdlopen_test_providers.so",
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorcestatic bool recursive_dlopen(const char **name, int round, char **errmsg)
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce handle = dlopen(name[round], RTLD_GLOBAL|RTLD_NOW);
569bbc59e4060160a986d0fea31601a7b7d998feBenjamin Franzke if (asprintf(errmsg, "dlopen() failed: %s", dlerror()) == -1)
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce return false;
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnikstatic int file_so_filter(const struct dirent *ent)
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnikstatic char **get_so_files(size_t *_list_size)
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnik n = scandir(LIBPFX, &namelist, file_so_filter, alphasort);
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnik for (int i = 0; i < n; ++i) {
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnikstatic void remove_library_from_list(const char *library, char **list,
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnik if (list[i] != NULL && strcmp(library, list[i]) == 0) {
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnik /* found library need to be removed from list */
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnik ck_abort_msg("Cannot find expected library: %s", library);
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnik char **found_libraries = get_so_files(&found_libraries_size);
36ccdecd053a9ad88dce86b8c84770dc2aa11d21Simo Sorce fail_unless(ok, "Error opening %s: [%s]", so[i].name, errmsg);
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnik remove_library_from_list(so[i].name, found_libraries,
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnik for (i = 0; i < found_libraries_size; ++i) {
c7b3c43cf669e39f7ce5f4ef1a2e939b31a8b7b9Lukas Slebodnik printf("Unchecked library found: %s\n", found_libraries[i]);