[SSSD] [PATCH] BUILD: Link just libsss_crypto with crypto libraries

Lukas Slebodnik lslebodn at redhat.com
Thu Oct 8 07:49:51 UTC 2015


On (04/10/15 21:51), Jakub Hrozek wrote:
>On Fri, Oct 02, 2015 at 11:26:33AM +0200, Lukas Slebodnik wrote:
>> ehlo,
>> 
>> Attached patch should prevent such failures as in commit
>> 73ec8fdfddb2d4bf99977f758eec80e1b1ee8542
>>     BUILD: Link test_data_provider_be with -ldl
>> 
>> SSS_CRYPT_LIBS should not be part of SSSD_LIBS.
>> all necessary program and libraries should be linked with
>> libsss_cryto.so an do not use SSS_CRYPT_LIBS directly.
>> 
>> LS
>
>Can you add a comment to the definition of SSS_CRYPT_LIBS saying that
>they shouldn't be used directly, but libsss_cryto should be used
>instead?
Is the comment sufficient?

LS
-------------- next part --------------
>From 22659495827d2e5f3ea06ef25c2ff27dc5c3d4ab Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Fri, 2 Oct 2015 09:33:28 +0200
Subject: [PATCH 1/3] BUILD: Link just libsss_crypto with crypto libraries

It should prevent such failures as in commit
73ec8fdfddb2d4bf99977f758eec80e1b1ee8542
    BUILD: Link test_data_provider_be with -ldl
---
 Makefile.am | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index ce3166716eab20c7b98005faf938f32458dbd673..6ed3de0c2aca12f156a1b8341f10827f722f5a06 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -488,7 +488,6 @@ SSSD_LIBS = \
     $(INI_CONFIG_LIBS) \
     $(COLLECTION_LIBS) \
     $(DHASH_LIBS) \
-    $(SSS_CRYPT_LIBS) \
     $(OPENLDAP_LIBS) \
     $(TDB_LIBS)
 
@@ -719,6 +718,11 @@ libsss_child_la_LDFLAGS = -avoid-version
 
 pkglib_LTLIBRARIES += libsss_crypt.la
 
+# NOTE:
+# Please try to avoid using SSS_CRYPT_{CFLAGS,LIBS} directly for compiling and
+# linking programs or libraries. This is purpose of wrapper library
+# libsss_crypt.so to hide internals. SSS_CRYPT_{CFLAGS,LIBS} might be used
+# in unit tests if you directly uses functions from underlining crypto libraries
 if HAVE_NSS
     SSS_CRYPT_SOURCES = src/util/crypto/nss/nss_base64.c \
                         src/util/crypto/nss/nss_hmac_sha1.c \
@@ -2244,7 +2248,6 @@ sdap_tests_SOURCES = \
     $(NULL)
 sdap_tests_CFLAGS = \
     $(AM_CFLAGS) \
-    $(SSS_CRYPT_CFLAGS) \
     $(NULL)
 sdap_tests_LDFLAGS = \
     -Wl,-wrap,ldap_set_option \
@@ -2261,7 +2264,6 @@ sdap_tests_LDADD = \
     $(LDB_LIBS) \
     $(POPT_LIBS) \
     $(SSSD_INTERNAL_LTLIBS) \
-    $(SSS_CRYPT_LIBS) \
     $(OPENLDAP_LIBS) \
     libsss_test_common.la \
     $(NULL)
-- 
2.5.0

-------------- next part --------------
>From 4d03142990d1e893306fa15a5aa5cd011fb3582f Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 21 Sep 2015 21:37:41 +0200
Subject: [PATCH 2/3] BUILD: Link crypto_tests with existing library

It's not necessary to bundle libsss_crypto to crypto_tests.
We can link it directly.
---
 Makefile.am | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 6ed3de0c2aca12f156a1b8341f10827f722f5a06..e2f63475802db8c1b2c9de22c9c12deae2d71abb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1723,17 +1723,16 @@ debug_tests_LDADD = \
     libsss_debug.la
 
 crypto_tests_SOURCES = \
-    $(SSS_CRYPT_SOURCES) \
     src/tests/crypto-tests.c
 crypto_tests_CFLAGS = \
-    $(SSS_CRYPT_CFLAGS) \
     $(AM_CFLAGS) \
     $(CHECK_CFLAGS)
 crypto_tests_LDADD = \
-    libsss_debug.la \
-    $(SSS_CRYPT_LIBS) \
-    $(SSSD_LIBS) \
     $(CHECK_LIBS) \
+    $(POPT_LIBS) \
+    $(TALLOC_LIBS) \
+    libsss_crypt.la \
+    libsss_debug.la \
     libsss_test_common.la
 
 ipa_hbac_tests_SOURCES = \
-- 
2.5.0

-------------- next part --------------
>From 514bd05cb95e2514a4d49c7db6931d912071f985 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 21 Sep 2015 16:05:00 +0200
Subject: [PATCH 3/3] BUILD: Remove unused variable TEST_MOCK_OBJ

---
 Makefile.am | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index e2f63475802db8c1b2c9de22c9c12deae2d71abb..235980e793e33b26bf227ccf38cd0e6f391a124c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2066,7 +2066,6 @@ fqnames_tests_LDADD = \
     libsss_test_common.la
 
 nestedgroups_tests_SOURCES = \
-    $(TEST_MOCK_OBJ) \
     $(TEST_MOCK_PROVIDER_OBJ) \
     src/providers/ldap/sdap_idmap.c \
     src/tests/cmocka/test_nested_groups.c \
@@ -2437,7 +2436,6 @@ test_child_common_LDADD = \
     $(NULL)
 
 responder_cache_req_tests_SOURCES = \
-    $(TEST_MOCK_OBJ) \
     $(TEST_MOCK_RESP_OBJ) \
     src/tests/cmocka/test_responder_cache_req.c \
     $(NULL)
-- 
2.5.0



More information about the sssd-devel mailing list