[SSSD] [PATCH] BUILD: Link libsss_krb5_common.so to libkeyutils.so
Lukas Slebodnik
lslebodn at redhat.com
Tue Nov 12 15:23:06 UTC 2013
On (12/11/13 11:15), Jakub Hrozek wrote:
>On Tue, Nov 12, 2013 at 08:23:04AM +0100, Lukas Slebodnik wrote:
>> On (16/10/13 08:56), Simo Sorce wrote:
>> >On Wed, 2013-10-16 at 14:49 +0200, Benjamin Franzke wrote:
>> >> Hi List,
>> >>
>> >>
>> >> The symbol add_key is used by
>> >> src/providers/krb5/krb5_delayed_online_authentication.c
>> >> which is part of libsss_krb5_common.so
>> >>
>> >>
>> >> Fixes following error:
>> >> [sssd[be[default]]] [load_backend_module]
>> >> (0x0010): Unable to load ad module with path
>> >> (/usr/lib64/sssd/libsss_ad.so), error:
>> >> /usr/lib64/sssd/libsss_krb5_common.so: undefined symbol: add_key
>> >>
>> >>
>> >> -lkeyutils was passed to the libraries libsss_{krb5,ipa,ad}.so,
>> >> but when compiling with -Wl,--as-needed this flag will be ignored,
>> >> since it is not used directly. So it was unavailable to
>> >> libsss_krb5_common.so which actually needs it.
>> >>
>> >>
>> >> This patch removes $(KEYUTILS_LIBS) from those libraries and adds it
>> >> to
>> >> libsss_krb5_common.so
>> >>
>> >>
>> >> Maybe libsss_krb5_common.so should be added to dlopen-tests?
>> >
>> >Yes please.
>> >
>> >> But then other libraries and functions are needed as well,
>> >> which it currently inherits from libsss_{krb5,ipa,ad}.so.
>> >
>> >You can just open a chain of libraries.
>> >>
>> >> BTW: are these common libraries (i mean ldap too) convenience build
>> >> libraries, or to save disk space?
>> >
>> >Not just to save disk space but to avoid duplicate symbols in multiple
>> >modules.
>> >
>> >Simo.
>> >
>>
>> I am sending rebased patch and patch where libsss_krb5_common.so was added
>> into dlopen-tests.
>>
>> LS
>
>> From 4318c59a8fc327fbc6013c8b424a35a2717fe838 Mon Sep 17 00:00:00 2001
>> From: Benjamin Franzke <benjaminfranzke at googlemail.com>
>> Date: Wed, 16 Oct 2013 13:23:48 +0200
>> Subject: [PATCH 1/3] BUILD: Link libsss_krb5_common.so to libkeyutils.so
>
>ACK
>
>
>> From e1639ee19549d645d84bf3206b2bd1f20964b555 Mon Sep 17 00:00:00 2001
>> From: Lukas Slebodnik <lslebodn at redhat.com>
>> Date: Mon, 11 Nov 2013 19:35:13 +0100
>> Subject: [PATCH 2/3] BUILD: move file find_uid.c into libsss_util.so
>>
>> ---
>> Makefile.am | 30 ++++++++----------------------
>> 1 file changed, 8 insertions(+), 22 deletions(-)
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index 102797cec02161b0553c2adb3cbf19e83fd50be0..62e31a6fe4a22e8d98f73a6fb3c3e39ae3710555 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -590,9 +590,13 @@ libsss_util_la_SOURCES = \
>> src/util/util_errors.c \
>> src/util/sss_ini.c \
>> src/util/io.c \
>> - src/util/util_sss_idmap.c
>> + src/util/util_sss_idmap.c \
>> + src/util/find_uid.c
>> +libsss_util_la_CFLAGS = \
>> + $(SYSTEMD_LOGIN_CFLAGS)
>> libsss_util_la_LIBADD = \
>> $(SSSD_LIBS) \
>> + $(SYSTEMD_LOGIN_LIBS) \
>> $(UNICODE_LIBS)
>> if BUILD_SUDO
>> libsss_util_la_SOURCES += src/db/sysdb_sudo.c
>> @@ -784,16 +788,13 @@ sss_useradd_LDADD = \
>>
>> sss_userdel_SOURCES = \
>> src/tools/sss_userdel.c \
>> - src/util/find_uid.c \
>> $(SSSD_LCL_TOOLS_OBJ)
>> sss_userdel_LDADD = \
>> $(TOOLS_LIBS) \
>> - $(SYSTEMD_LOGIN_LIBS) \
>> $(SSSD_INTERNAL_LTLIBS) \
>> $(CLIENT_LIBS)
>> sss_userdel_CFLAGS = \
>> - $(AM_CFLAGS) \
>> - $(SYSTEMD_LOGIN_CFLAGS)
>> + $(AM_CFLAGS)
>>
>> sss_groupadd_SOURCES = \
>> src/tools/sss_groupadd.c \
>> @@ -987,21 +988,18 @@ krb5_utils_tests_SOURCES = \
>> src/providers/krb5/krb5_become_user.c \
>> src/providers/krb5/krb5_common.c \
>> src/util/sss_krb5.c \
>> - src/util/find_uid.c \
>> src/providers/data_provider_fo.c \
>> src/providers/data_provider_opts.c \
>> src/providers/data_provider_callbacks.c \
>> $(SSSD_FAILOVER_OBJ)
>> krb5_utils_tests_CFLAGS = \
>> $(AM_CFLAGS) \
>> - $(CHECK_CFLAGS) \
>> - $(SYSTEMD_LOGIN_CFLAGS)
>> + $(CHECK_CFLAGS)
>> krb5_utils_tests_LDADD = \
>> $(SSSD_LIBS)\
>> $(CARES_LIBS) \
>> $(KRB5_LIBS) \
>> $(CHECK_LIBS) \
>> - $(SYSTEMD_LOGIN_LIBS) \
>> $(SSSD_INTERNAL_LTLIBS) \
>> libsss_test_common.la
>>
>> @@ -1251,7 +1249,6 @@ krb5_child_test_SOURCES = \
>> src/providers/krb5/krb5_become_user.c \
>> src/providers/krb5/krb5_common.c \
>> src/util/sss_krb5.c \
>> - src/util/find_uid.c \
>> src/providers/data_provider_fo.c \
>> src/providers/data_provider_opts.c \
>> src/providers/data_provider_callbacks.c \
>> @@ -1259,14 +1256,12 @@ krb5_child_test_SOURCES = \
>> krb5_child_test_CFLAGS = \
>> $(AM_CFLAGS) \
>> -DKRB5_CHILD_DIR=\"$(builddir)\" \
>> - $(CHECK_CFLAGS) \
>> - $(SYSTEMD_LOGIN_CFLAGS)
>> + $(CHECK_CFLAGS)
>> krb5_child_test_LDADD = \
>> $(SSSD_LIBS) \
>> $(CARES_LIBS) \
>> $(KRB5_LIBS) \
>> $(CHECK_LIBS) \
>> - $(SYSTEMD_LOGIN_LIBS) \
>> $(SSSD_INTERNAL_LTLIBS) \
>> libsss_test_common.la
>>
>> @@ -1392,12 +1387,10 @@ ad_access_filter_tests_SOURCES = \
>> $(sssd_be_SOURCES) \
>> src/util/sss_ldap.c \
>> src/util/sss_krb5.c \
>> - src/util/find_uid.c \
>> src/util/user_info_msg.c \
>> src/tests/cmocka/test_ad_access_filter.c
>> ad_access_filter_tests_CFLAGS = \
>> $(AM_CFLAGS) \
>> - $(SYSTEMD_LOGIN_CFLAGS) \
>> -DUNIT_TESTING
>> ad_access_filter_tests_LDADD = \
>> $(PAM_LIBS) \
>> @@ -1406,7 +1399,6 @@ ad_access_filter_tests_LDADD = \
>> $(CARES_LIBS) \
>> $(KRB5_LIBS) \
>> $(SSSD_INTERNAL_LTLIBS) \
>> - $(SYSTEMD_LOGIN_LIBS) \
>> libsss_ldap_common.la \
>> libsss_idmap.la \
>> libsss_krb5_common.la \
>> @@ -1606,14 +1598,12 @@ libsss_ldap_la_SOURCES = \
>> src/util/sss_krb5.c
>> libsss_ldap_la_CFLAGS = \
>> $(AM_CFLAGS) \
>> - $(SYSTEMD_LOGIN_CFLAGS) \
>> $(OPENLDAP_CFLAGS) \
>> $(KRB5_CFLAGS)
>> libsss_ldap_la_LIBADD = \
>> $(OPENLDAP_LIBS) \
>> $(DHASH_LIBS) \
>> $(KRB5_LIBS) \
>> - $(SYSTEMD_LOGIN_LIBS) \
>> libsss_ldap_common.la \
>> libsss_idmap.la
>> libsss_ldap_la_LDFLAGS = \
>> @@ -1749,21 +1739,17 @@ libsss_ad_la_SOURCES = \
>> src/providers/ad/ad_subdomains.h \
>> src/providers/ad/ad_domain_info.c \
>> src/providers/ad/ad_domain_info.h \
>> - src/util/find_uid.c \
>> src/util/user_info_msg.c \
>> src/util/sss_krb5.c \
>> src/util/sss_ldap.c
>>
>> libsss_ad_la_CFLAGS = \
>> $(AM_CFLAGS) \
>> - $(SYSTEMD_LOGIN_CFLAGS) \
>> $(OPENLDAP_CFLAGS) \
>> - $(SASL_CFLAGS) \
>
>Why was SASL_CFLAGS removed here?
>
It was a mistake.
>> $(DHASH_CFLAGS) \
>> $(KRB5_CFLAGS) \
>> $(NDR_NBT_CFLAGS)
>> libsss_ad_la_LIBADD = \
>> - $(SYSTEMD_LOGIN_LIBS) \
>> $(OPENLDAP_LIBS) \
>> $(SASL_LIBS) \
>> $(DHASH_LIBS) \
>> --
>> 1.8.3.1
>>
>
>> From b044b85ac073ed068796a9365715155c6edd8fd8 Mon Sep 17 00:00:00 2001
>> From: Lukas Slebodnik <lslebodn at redhat.com>
>> Date: Mon, 11 Nov 2013 19:39:17 +0100
>> Subject: [PATCH 3/3] TEST: Add libsss_krb5_common.so to dlopen test
>>
>> ---
>> Makefile.am | 6 ++++--
>> src/tests/dlopen-tests.c | 2 ++
>> 2 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index 62e31a6fe4a22e8d98f73a6fb3c3e39ae3710555..cb23fe4764d7aa831359e21b59a033c32c3a25fa 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -1580,9 +1580,11 @@ libsss_krb5_common_la_SOURCES = \
>> src/providers/krb5/krb5_auth.c \
>> src/providers/krb5/krb5_access.c \
>> src/providers/krb5/krb5_child_handler.c \
>> - src/providers/krb5/krb5_init_shared.c
>> + src/providers/krb5/krb5_init_shared.c \
>> + src/util/sss_krb5.c
>
>Why was sss_krb5.c and KRB5_LIBS added in this patch?
>
Variable KRB5_LIBS was added because libsss_krb5_common.so directly call krb5
functions and dlopen test failed without it.
bash$ objdump -T .libs/libsss_krb5_common.so | grep -E "UND.*krb5_" | tail -n5
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_cc_destroy
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_set_trace_callback
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_parse_name_flags
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_kt_resolve
0000000000000000 DF *UND* 0000000000000000 krb5_3_MIT krb5_cc_set_default_name
dlopen test failed without file sss_krb5.c
bash$ ./dlopen-tests
Running suite(s): dlopen
0%: Checks: 1, Failures: 1, Errors: 0
./src/tests/dlopen-tests.c:131:F:dlopen:test_dlopen_base:0:
Error opening libsss_krb5_common.so: [dlopen() failed: ./sssd_build/.libs/libsss_krb5_common.so: undefined symbol: check_fast]
Updated patches are attached.
LS
-------------- next part --------------
>From e99edbfc70824882ef48458a9eaaf2cc6c07e3ad Mon Sep 17 00:00:00 2001
From: Benjamin Franzke <benjaminfranzke at googlemail.com>
Date: Wed, 16 Oct 2013 13:23:48 +0200
Subject: [PATCH 1/3] BUILD: Link libsss_krb5_common.so to libkeyutils.so
The symbol add_key is used by
src/providers/krb5/krb5_delayed_online_authentication.c
which is part of libsss_krb5_common.so
Fixes following error:
[sssd[be[default]]] [load_backend_module]
(0x0010): Unable to load ad module with path
(/usr/lib64/sssd/libsss_ad.so), error:
/usr/lib64/sssd/libsss_krb5_common.so: undefined symbol: add_key
-lkeyutils was passed to the libraries libsss_{krb5,ipa,ad}.so,
but when compiling with -Wl,--as-needed this flag will be ignored,
since it is not used directly. So it was unavailable to
libsss_krb5_common.so which actually needs it.
This patch removes $(KEYUTILS_LIBS) from those libraries and adds it to
libsss_krb5_common.so
---
Makefile.am | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 992d5796ea3e729238a8d7664c128112291c40ab..102797cec02161b0553c2adb3cbf19e83fd50be0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1589,6 +1589,8 @@ libsss_krb5_common_la_SOURCES = \
src/providers/krb5/krb5_access.c \
src/providers/krb5/krb5_child_handler.c \
src/providers/krb5/krb5_init_shared.c
+libsss_krb5_common_la_LIBADD = \
+ $(KEYUTILS_LIBS)
libsss_krb5_common_la_LDFLAGS = \
-avoid-version
@@ -1655,7 +1657,6 @@ libsss_krb5_la_CFLAGS = \
libsss_krb5_la_LIBADD = \
$(SYSTEMD_LOGIN_LIBS) \
$(DHASH_LIBS) \
- $(KEYUTILS_LIBS) \
$(KRB5_LIBS) \
libsss_krb5_common.la
libsss_krb5_la_LDFLAGS = \
@@ -1710,7 +1711,6 @@ libsss_ipa_la_LIBADD = \
$(OPENLDAP_LIBS) \
$(DHASH_LIBS) \
$(NDR_NBT_LIBS) \
- $(KEYUTILS_LIBS) \
$(KRB5_LIBS) \
libsss_ldap_common.la \
libsss_krb5_common.la \
@@ -1767,7 +1767,6 @@ libsss_ad_la_LIBADD = \
$(OPENLDAP_LIBS) \
$(SASL_LIBS) \
$(DHASH_LIBS) \
- $(KEYUTILS_LIBS) \
$(KRB5_LIBS) \
$(NDR_NBT_LIBS) \
libsss_ldap_common.la \
--
1.8.3.1
-------------- next part --------------
>From 2ccba2c21c682cd3f1190f176f6a6fd0fc51e1c3 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 11 Nov 2013 19:35:13 +0100
Subject: [PATCH 2/3] BUILD: move file find_uid.c into libsss_util.so
---
Makefile.am | 30 +++++++++---------------------
1 file changed, 9 insertions(+), 21 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 102797cec02161b0553c2adb3cbf19e83fd50be0..6e1ea72a73e7254c653934006471baf469481fc5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -590,9 +590,14 @@ libsss_util_la_SOURCES = \
src/util/util_errors.c \
src/util/sss_ini.c \
src/util/io.c \
- src/util/util_sss_idmap.c
+ src/util/util_sss_idmap.c \
+ src/util/find_uid.c
+libsss_util_la_CFLAGS = \
+ $(AM_CFLAGS) \
+ $(SYSTEMD_LOGIN_CFLAGS)
libsss_util_la_LIBADD = \
$(SSSD_LIBS) \
+ $(SYSTEMD_LOGIN_LIBS) \
$(UNICODE_LIBS)
if BUILD_SUDO
libsss_util_la_SOURCES += src/db/sysdb_sudo.c
@@ -784,16 +789,13 @@ sss_useradd_LDADD = \
sss_userdel_SOURCES = \
src/tools/sss_userdel.c \
- src/util/find_uid.c \
$(SSSD_LCL_TOOLS_OBJ)
sss_userdel_LDADD = \
$(TOOLS_LIBS) \
- $(SYSTEMD_LOGIN_LIBS) \
$(SSSD_INTERNAL_LTLIBS) \
$(CLIENT_LIBS)
sss_userdel_CFLAGS = \
- $(AM_CFLAGS) \
- $(SYSTEMD_LOGIN_CFLAGS)
+ $(AM_CFLAGS)
sss_groupadd_SOURCES = \
src/tools/sss_groupadd.c \
@@ -987,21 +989,18 @@ krb5_utils_tests_SOURCES = \
src/providers/krb5/krb5_become_user.c \
src/providers/krb5/krb5_common.c \
src/util/sss_krb5.c \
- src/util/find_uid.c \
src/providers/data_provider_fo.c \
src/providers/data_provider_opts.c \
src/providers/data_provider_callbacks.c \
$(SSSD_FAILOVER_OBJ)
krb5_utils_tests_CFLAGS = \
$(AM_CFLAGS) \
- $(CHECK_CFLAGS) \
- $(SYSTEMD_LOGIN_CFLAGS)
+ $(CHECK_CFLAGS)
krb5_utils_tests_LDADD = \
$(SSSD_LIBS)\
$(CARES_LIBS) \
$(KRB5_LIBS) \
$(CHECK_LIBS) \
- $(SYSTEMD_LOGIN_LIBS) \
$(SSSD_INTERNAL_LTLIBS) \
libsss_test_common.la
@@ -1251,7 +1250,6 @@ krb5_child_test_SOURCES = \
src/providers/krb5/krb5_become_user.c \
src/providers/krb5/krb5_common.c \
src/util/sss_krb5.c \
- src/util/find_uid.c \
src/providers/data_provider_fo.c \
src/providers/data_provider_opts.c \
src/providers/data_provider_callbacks.c \
@@ -1259,14 +1257,12 @@ krb5_child_test_SOURCES = \
krb5_child_test_CFLAGS = \
$(AM_CFLAGS) \
-DKRB5_CHILD_DIR=\"$(builddir)\" \
- $(CHECK_CFLAGS) \
- $(SYSTEMD_LOGIN_CFLAGS)
+ $(CHECK_CFLAGS)
krb5_child_test_LDADD = \
$(SSSD_LIBS) \
$(CARES_LIBS) \
$(KRB5_LIBS) \
$(CHECK_LIBS) \
- $(SYSTEMD_LOGIN_LIBS) \
$(SSSD_INTERNAL_LTLIBS) \
libsss_test_common.la
@@ -1392,12 +1388,10 @@ ad_access_filter_tests_SOURCES = \
$(sssd_be_SOURCES) \
src/util/sss_ldap.c \
src/util/sss_krb5.c \
- src/util/find_uid.c \
src/util/user_info_msg.c \
src/tests/cmocka/test_ad_access_filter.c
ad_access_filter_tests_CFLAGS = \
$(AM_CFLAGS) \
- $(SYSTEMD_LOGIN_CFLAGS) \
-DUNIT_TESTING
ad_access_filter_tests_LDADD = \
$(PAM_LIBS) \
@@ -1406,7 +1400,6 @@ ad_access_filter_tests_LDADD = \
$(CARES_LIBS) \
$(KRB5_LIBS) \
$(SSSD_INTERNAL_LTLIBS) \
- $(SYSTEMD_LOGIN_LIBS) \
libsss_ldap_common.la \
libsss_idmap.la \
libsss_krb5_common.la \
@@ -1606,14 +1599,12 @@ libsss_ldap_la_SOURCES = \
src/util/sss_krb5.c
libsss_ldap_la_CFLAGS = \
$(AM_CFLAGS) \
- $(SYSTEMD_LOGIN_CFLAGS) \
$(OPENLDAP_CFLAGS) \
$(KRB5_CFLAGS)
libsss_ldap_la_LIBADD = \
$(OPENLDAP_LIBS) \
$(DHASH_LIBS) \
$(KRB5_LIBS) \
- $(SYSTEMD_LOGIN_LIBS) \
libsss_ldap_common.la \
libsss_idmap.la
libsss_ldap_la_LDFLAGS = \
@@ -1749,21 +1740,18 @@ libsss_ad_la_SOURCES = \
src/providers/ad/ad_subdomains.h \
src/providers/ad/ad_domain_info.c \
src/providers/ad/ad_domain_info.h \
- src/util/find_uid.c \
src/util/user_info_msg.c \
src/util/sss_krb5.c \
src/util/sss_ldap.c
libsss_ad_la_CFLAGS = \
$(AM_CFLAGS) \
- $(SYSTEMD_LOGIN_CFLAGS) \
$(OPENLDAP_CFLAGS) \
$(SASL_CFLAGS) \
$(DHASH_CFLAGS) \
$(KRB5_CFLAGS) \
$(NDR_NBT_CFLAGS)
libsss_ad_la_LIBADD = \
- $(SYSTEMD_LOGIN_LIBS) \
$(OPENLDAP_LIBS) \
$(SASL_LIBS) \
$(DHASH_LIBS) \
--
1.8.3.1
-------------- next part --------------
>From b2cba5f54072564c986e0e6b284dc3418b841592 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 11 Nov 2013 19:39:17 +0100
Subject: [PATCH 3/3] TEST: Add libsss_krb5_common.so to dlopen test
---
Makefile.am | 6 ++++--
src/tests/dlopen-tests.c | 2 ++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 6e1ea72a73e7254c653934006471baf469481fc5..ed6c5bad7a0fa68d613b06c2807d0b8ac8e09103 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1581,9 +1581,11 @@ libsss_krb5_common_la_SOURCES = \
src/providers/krb5/krb5_auth.c \
src/providers/krb5/krb5_access.c \
src/providers/krb5/krb5_child_handler.c \
- src/providers/krb5/krb5_init_shared.c
+ src/providers/krb5/krb5_init_shared.c \
+ src/util/sss_krb5.c
libsss_krb5_common_la_LIBADD = \
- $(KEYUTILS_LIBS)
+ $(KEYUTILS_LIBS) \
+ $(KRB5_LIBS)
libsss_krb5_common_la_LDFLAGS = \
-avoid-version
diff --git a/src/tests/dlopen-tests.c b/src/tests/dlopen-tests.c
index dd4cc754ac37621b953a462b5e73696d4556770c..9c09e3334005fdac03be84489777c0e96e84cf4e 100644
--- a/src/tests/dlopen-tests.c
+++ b/src/tests/dlopen-tests.c
@@ -80,6 +80,8 @@ struct so {
LIBPFX"libsss_ipa.so", NULL } },
{ "libsss_krb5.so", { LIBPFX"libdlopen_test_providers.so",
LIBPFX"libsss_krb5.so", NULL } },
+ { "libsss_krb5_common.so", { LIBPFX"libdlopen_test_providers.so",
+ LIBPFX"libsss_krb5_common.so", NULL } },
{ "libsss_ldap.so", { LIBPFX"libdlopen_test_providers.so",
LIBPFX"libsss_ldap.so", NULL } },
{ "libsss_proxy.so", { LIBPFX"libdlopen_test_providers.so",
--
1.8.3.1
More information about the sssd-devel
mailing list