[SSSD] [PATCH] Making the ldb check configurable

Lukas Slebodnik lslebodn at redhat.com
Wed Mar 20 10:58:42 UTC 2013


On (19/03/13 14:26), Lukas Slebodnik wrote:
>On (19/03/13 13:53), Jakub Hrozek wrote:
>>On Tue, Mar 19, 2013 at 09:30:55AM +0100, Lukas Slebodnik wrote:
>>> On (18/03/13 11:22), Jakub Hrozek wrote:
>>> >On Wed, Mar 13, 2013 at 11:23:07AM +0100, Lukas Slebodnik wrote:
>>> >> Hi,
>>> >> 
>>> >> attached patch should fix ticket
>>> >> https://fedorahosted.org/sssd/ticket/1813
>>> >> 
>>> >> Comments welcomed.
>>> >> 
>>> >> LS
>>> >
>>
>>I have two more comments, sorry I haven't realized them the first time
>>around:
>>
>>1) can you rename the LDB_VERSION_CHECK to not begin with LDB_ ? We
>>should not define new constants in libldb's namespace. Maybe something
>>like SSS_LDB_VERSION_CHECK would do..
>>
>>2) Instead of two nested #ifdefs right after one another I think the
>>following is more readable:
>>
>>#if defined LDB_VERSION_CHECK && defined LDB_MODULE_CHECK_VERSION
>>    /* Do the check */
>>#endif
>>
>>I have tested the approach and was able to run sssd with a different ldb
>>than it was built for.
>
>namespace changed.
>#if condition changed.
>
>patch attached.
>
>LS

More readable version of previous patch.

LS
-------------- next part --------------
>From 1aedcd9ce60d48e0550eff744519eac2a13b3f7a Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Wed, 13 Mar 2013 11:09:11 +0100
Subject: [PATCH] Making the ldb check configurable

It is possible to enable/disable checking in LDB memberof plugin
whether it was built against the same version of LDB that is present
on the system. This feature is turned off by default
and enabled in Fedora/RHEL spec file.

https://fedorahosted.org/sssd/ticket/1813
---
 src/external/libldb.m4     | 15 +++++++++++++++
 src/ldb_modules/memberof.c |  4 ++--
 2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/external/libldb.m4 b/src/external/libldb.m4
index d3d3ccecec303d17102cedccfaba0db70329002d..3e26b15a0815e60106f12bf1ffdc34fd0dee4cc4 100644
--- a/src/external/libldb.m4
+++ b/src/external/libldb.m4
@@ -24,5 +24,20 @@ else
         ldblibdir="${libdir}/ldb"
     fi
 fi
+
+AC_MSG_CHECKING([feature ldb runtime version check])
+AC_ARG_ENABLE(ldb-version-check,
+              [AS_HELP_STRING([--enable-ldb-version-check],
+                              [compile with ldb runtime version check [default=no]])],
+              enable_ldb_version_check="$enableval",
+              enable_ldb_version_check="no")
+if test x"$enable_ldb_version_check" = xyes ; then
+    AC_MSG_RESULT([yes])
+    AC_DEFINE([SSS_LDB_VERSION_CHECK], [1],
+              [Define to 1 if you want ldb version check.])
+else
+    AC_MSG_RESULT([no])
+fi
+
 AC_MSG_NOTICE([ldb lib directory: $ldblibdir])
 AC_SUBST(ldblibdir)
diff --git a/src/ldb_modules/memberof.c b/src/ldb_modules/memberof.c
index f7eeb4070748d4a4f517c44520f9a501dd48a245..4a9328482b1d3999ea0f57051249dfe5415b995f 100644
--- a/src/ldb_modules/memberof.c
+++ b/src/ldb_modules/memberof.c
@@ -4566,8 +4566,8 @@ const struct ldb_module_ops ldb_memberof_module_ops = {
 
 int ldb_init_module(const char *version)
 {
-#ifdef LDB_MODULE_CHECK_VERSION
+#if defined(SSS_LDB_VERSION_CHECK) && defined(LDB_MODULE_CHECK_VERSION)
     LDB_MODULE_CHECK_VERSION(version);
-#endif
+#endif /* SSS_LDB_VERSION_CHECK && LDB_MODULE_CHECK_VERSION */
     return ldb_register_module(&ldb_memberof_module_ops);
 }
-- 
1.8.1.4



More information about the sssd-devel mailing list