On (06/05/15 16:25), Sumit Bose wrote:
Hi,
with Samba-4.2.x libwbclient has a new interface version because new
calls were added which have an opaque context as an argument to allow
threaded applications to send multiple requests to winbind in parallel.
This patch adds the new interface but so far does not implement any calls.
We have a similar issue in SSSD, all applications either single all
multi-threaded use a single file-descriptor to talk to the SSSD
responders and the requests are serialized. Originally the only clients
were the NSS and PAM client code where there was no way around it
because the PAM and NSS interface do not provide a way to pass a
thread-local context.
Nowadays there are applications like 389ds running on a FreeIPA server
which want to get data exclusively from SSSD which can use more enhanced
interface. So I think it would make sense to consider an enhancement to
the low-level client communication code similar to the changes done in
Samba so that threads can get an individual file-descriptors to talk to
the responders. When this is done the new context aware libwbclient
calls can be implemented (as long as it is possible).
bye,
Sumit
From 137f33cdb7429ec4aeafd8ca4856bc1527e30443 Mon Sep 17 00:00:00
2001
From: Sumit Bose <sbose(a)redhat.com>
Date: Wed, 6 May 2015 13:07:54 +0200
Subject: [PATCH] libwbclient-sssd: update interface to version 0.12
This patch adds the new interface version 0.12 to libwbclient-sssd. The
old version can still be generated with the --with-libwbclient-011
configure option.
This patch does not add an implementation of the new calls because first
the SSSD client code has to be made thread friendly similar to Samba's
libwbclient.
---
Makefile.am | 30 +-
configure.ac | 1 +
src/conf_macros.m4 | 26 +
src/sss_client/libwbclient/wbc_ctx_sssd.c | 396 ++++++++++
.../{wbclient.exports => wbclient-0.11.exports} | 4 +-
src/sss_client/libwbclient/wbclient.exports | 62 +-
.../{wbclient_sssd.h => wbclient_sssd-0.11.h} | 0
src/sss_client/libwbclient/wbclient_sssd.h | 853 ++++++++++++++++++---
src/sss_client/libwbclient/wbclient_sssd.pc.in | 2 +-
9 files changed, 1267 insertions(+), 107 deletions(-)
create mode 100644 src/sss_client/libwbclient/wbc_ctx_sssd.c
copy src/sss_client/libwbclient/{wbclient.exports => wbclient-0.11.exports} (98%)
copy src/sss_client/libwbclient/{wbclient_sssd.h => wbclient_sssd-0.11.h} (100%)
diff --git a/Makefile.am b/Makefile.am
index 0aad222c1276b76607ec2d0e5c6b411d3b17b0a7..ce83e2ecd9151179e05ad37cbfe5aee86d384741
100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -887,7 +887,10 @@ libwbclient_LTLIBRARIES = libwbclient.la
pkgconfig_DATA += src/sss_client/libwbclient/wbclient_sssd.pc
EXTRA_libwbclient_la_DEPENDENCIES = \
- src/sss_client/libwbclient/wbclient.exports
+ src/sss_client/libwbclient/wbclient.exports \
+ src/sss_client/libwbclient/wbclient-0.11.exports \
+ $(NULL)
+
libwbclient_la_SOURCES = \
src/sss_client/libwbclient/wbc_guid.c \
src/sss_client/libwbclient/wbc_idmap_common.c \
@@ -900,17 +903,34 @@ libwbclient_la_SOURCES = \
src/sss_client/libwbclient/wbc_sid_sssd.c \
src/sss_client/libwbclient/wbc_sssd_internal.h \
src/sss_client/libwbclient/wbc_util_common.c \
- src/sss_client/libwbclient/wbc_util_sssd.c
+ src/sss_client/libwbclient/wbc_util_sssd.c \
+ src/sss_client/libwbclient/wbc_ctx_sssd.c \
+ $(NULL)
libwbclient_la_LIBADD = \
libsss_nss_idmap.la \
- $(CLIENT_LIBS)
+ $(CLIENT_LIBS) \
+ $(NULL)
+
+if BUILD_LIBWBCLIENT_011
libwbclient_la_LDFLAGS = \
- -Wl,--version-script,$(srcdir)/src/sss_client/libwbclient/wbclient.exports \
+ -Wl,--version-script,$(srcdir)/src/sss_client/libwbclient/wbclient-0.11.exports \
-version-info 11:0:11
-dist_noinst_DATA += src/sss_client/libwbclient/wbclient.exports
+include_HEADERS += src/sss_client/libwbclient/wbclient_sssd-0.11.h
+dist_noinst_HEADERS += src/sss_client/libwbclient/wbclient_sssd.h
+else #BUILD_LIBWBCLIENT_011
+libwbclient_la_LDFLAGS = \
+ -Wl,--version-script,$(srcdir)/src/sss_client/libwbclient/wbclient.exports \
+ -version-info 12:0:12
include_HEADERS += src/sss_client/libwbclient/wbclient_sssd.h
+dist_noinst_HEADERS += src/sss_client/libwbclient/wbclient_sssd-0.11.h
+endif
+
+dist_noinst_DATA += src/sss_client/libwbclient/wbclient.exports \
+ src/sss_client/libwbclient/wbclient-0.11.exports \
+ $(NULL)
+
endif #BUILD_LIBWBCLIENT
if BUILD_IFP
diff --git a/configure.ac b/configure.ac
index 1f9c6f86772890bb0e269287d58aa6ea46e59ee1..15b421515aab4dc6e9f5a9e29670bdbe76313e0c
100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,7 @@ WITH_SAMBA
WITH_NFS
WITH_NFS_LIB_PATH
WITH_LIBWBCLIENT
+WITH_LIBWBCLIENT_011
WITH_SSSD_USER
m4_include([src/external/pkg.m4])
diff --git a/src/conf_macros.m4 b/src/conf_macros.m4
index 9ed0a4c44c209e88fc896d0cd3040cb572b358c9..728da445282d76d4048ef2a105b45954a961cbdb
100644
--- a/src/conf_macros.m4
+++ b/src/conf_macros.m4
@@ -698,10 +698,36 @@ AC_DEFUN([WITH_LIBWBCLIENT],
if test x"$with_libwbclient" = xyes; then
AC_DEFINE(BUILD_LIBWBCLIENT, 1, [whether to build SSSD implementation of
libwbclient])
+
+ libwbclient_version="0.12"
+ AC_SUBST(libwbclient_version)
fi
AM_CONDITIONAL([BUILD_LIBWBCLIENT], [test x"$with_libwbclient" = xyes])
+ AM_CONDITIONAL([BUILD_LIBWBCLIENT_011], [test x = y])
])
+AC_DEFUN([WITH_LIBWBCLIENT_011],
+ [ AC_ARG_WITH([libwbclient_011],
+ [AC_HELP_STRING([--with-libwbclient-0.11],
+ [Whether to build version 0.11 of SSSD implementation of
libwbclient [no]]
+ )
+ ],
+ [with_libwbclient_011=$withval],
+ with_libwbclient_011=no
+ )
+
+ if test x"$with_libwbclient_011" = xyes; then
+ AC_DEFINE(BUILD_LIBWBCLIENT, 1, [whether to build SSSD implementation of
libwbclient])
+ AC_DEFINE(BUILD_LIBWBCLIENT_011, 1, [whether to build version 0.11 of SSSD
implementation of libwbclient])
+
+ libwbclient_version="0.11"
+ AC_SUBST(libwbclient_version)
+ fi
+ AM_CONDITIONAL([BUILD_LIBWBCLIENT], [test x"$with_libwbclient" = xyes])
+ AM_CONDITIONAL([BUILD_LIBWBCLIENT_011], [test x"$with_libwbclient_011" =
xyes])
+ ])
+
+
I would prefer to keep it simple.
libwbclient.so.0.12 is backward compatible with libwbclient.so.0.11.
Just new functions were added.
It means that each program which was compiled with libwbclient.so.0.11 will
work with libwbclient.so.0.12 as well. We needn't complicate our life with two
versions of libwbclient.
We would need to do it in case of soname bump libwbclient.so.1.0
BTW. Functions from version 0.11 are not used by samba either
[root@7d9680173b99 /]# rpm -q --requires samba-winbind | grep -i wbclient
[root@7d9680173b99 /]# rpm -q --requires samba-winbind-modules | grep -i wbclient
libwbclient = 2:4.2.1-7.fc23
libwbclient.so.0()(64bit)
libwbclient.so.0(WBCLIENT_0.9)(64bit)
[root@7d9680173b99 /]# rpm -q --requires samba-winbind-clients | grep -i wbclient
libwbclient = 2:4.2.1-7.fc23
libwbclient.so.0()(64bit)
libwbclient.so.0(WBCLIENT_0.10)(64bit)
libwbclient.so.0(WBCLIENT_0.9)(64bit)
[root@7d9680173b99 /]# objdump -p /usr/lib64/sssd/modules/libwbclient.so.0.11.0 | grep
-A7 "Version definitions:"
Version definitions:
1 0x01 0x08faa220 libwbclient.so.0
2 0x00 0x0d90a3c9 WBCLIENT_0.9
3 0x00 0x090a3c90 WBCLIENT_0.10
WBCLIENT_0.9
4 0x00 0x090a3c91 WBCLIENT_0.11
Version References:
[root@7d9680173b99 /]# objdump -p /usr/lib64/samba/wbclient/libwbclient.so.0.12 | grep
-A9 "Version definitions:"
Version definitions:
1 0x01 0x08faa220 libwbclient.so.0
2 0x00 0x0d90a3c9 WBCLIENT_0.9
3 0x00 0x090a3c90 WBCLIENT_0.10
WBCLIENT_0.9
4 0x02 0x090a3c91 WBCLIENT_0.11
WBCLIENT_0.10
5 0x00 0x090a3c92 WBCLIENT_0.12
Version References:
LS