summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2010-07-07 20:21:28 +0000
committerArthur de Jong <arthur@arthurdejong.org>2010-07-07 20:21:28 +0000
commit83304390a5014fd275df7112199c83bfa973faa4 (patch)
treea0c4fb47b5c298062caf0ff93d66ef9a985bbb77
parent816e66a8455b25fb39e2c4d06e8ee43617a56c28 (diff)
allow configuring NSS module's SONAME from configure and use this in nslcd to dlopen() the correct library (thanks to Alexander V. Chernikov for the idea)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1161 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--configure.ac9
-rw-r--r--nslcd/nslcd.c2
-rw-r--r--nss/Makefile.am10
3 files changed, 13 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index c376790..9284a75 100644
--- a/configure.ac
+++ b/configure.ac
@@ -198,6 +198,15 @@ AC_ARG_WITH(nslcd-socket,
AC_DEFINE_UNQUOTED(NSLCD_SOCKET,"$NSLCD_SOCKET",[The location of the socket used for communicating.])
AC_SUBST(NSLCD_SOCKET)
+# the SONAME to use for the NSS module
+AC_ARG_WITH(nss-ldap-soname,
+ AS_HELP_STRING([--with-nss-ldap-soname=SONAME],
+ [name of NSS module @<:@libnss_ldap.so.2@:>@]),
+ [ NSS_LDAP_SONAME="$with_nslcd_socket" ],
+ [ NSS_LDAP_SONAME="libnss_ldap.so.2" ])
+AC_DEFINE_UNQUOTED(NSS_LDAP_SONAME,"$NSS_LDAP_SONAME",[The SONAME of the NSS library module.])
+AC_SUBST(NSS_LDAP_SONAME)
+
# checks for availability of header files
AC_CHECK_HEADERS([ctype.h strings.h pthread.h fcntl.h limits.h])
AC_CHECK_HEADERS([nss.h grp.h shadow.h aliases.h netdb.h rpc/rpcent.h])
diff --git a/nslcd/nslcd.c b/nslcd/nslcd.c
index 047d168..348a817 100644
--- a/nslcd/nslcd.c
+++ b/nslcd/nslcd.c
@@ -574,7 +574,7 @@ static void disable_nss_ldap(void)
char *error;
int *enable_flag;
/* try to load the NSS module */
- handle=dlopen("libnss_ldap.so.2",RTLD_LAZY|RTLD_NODELETE);
+ handle=dlopen(NSS_LDAP_SONAME,RTLD_LAZY|RTLD_NODELETE);
if (handle==NULL)
{
log_log(LOG_WARNING,"Warning: LDAP NSS module not loaded: %s",dlerror());
diff --git a/nss/Makefile.am b/nss/Makefile.am
index d373dc9..76bcdb3 100644
--- a/nss/Makefile.am
+++ b/nss/Makefile.am
@@ -24,17 +24,13 @@ noinst_PROGRAMS = nss_ldap.so
AM_CPPFLAGS=-I$(top_srcdir)
AM_CFLAGS = -fPIC
-# determin version numbers to use in installed files
-NSS_VERS = 2
-NSS_LDAP_NSS_VERSIONED = libnss_ldap.so.$(NSS_VERS)
-
nss_ldap_so_SOURCES = common.c common.h prototypes.h \
../nslcd.h ../common/nslcd-prot.h \
../compat/attrs.h \
aliases.c ethers.c group.c hosts.c netgroup.c \
networks.c passwd.c protocols.c rpc.c services.c \
shadow.c
-nss_ldap_so_LDFLAGS = -shared -Wl,-soname,$(NSS_LDAP_NSS_VERSIONED)
+nss_ldap_so_LDFLAGS = -shared -Wl,-soname,$(NSS_LDAP_SONAME)
if HAVE_VERSION_SCRIPT_FLAG
nss_ldap_so_LDFLAGS += $(VERSION_SCRIPT_FLAG)\$(srcdir)/nss_ldap.map
endif
@@ -47,6 +43,6 @@ uninstall-local: uninstall-nss_ldap_so
# install libnss_ldap.so.2
install-nss_ldap_so: nss_ldap.so
- $(INSTALL_PROGRAM) -D nss_ldap.so $(DESTDIR)$(libdir)/$(NSS_LDAP_NSS_VERSIONED)
+ $(INSTALL_PROGRAM) -D nss_ldap.so $(DESTDIR)$(libdir)/$(NSS_LDAP_SONAME)
uninstall-nss_ldap_so:
- -rm -f $(DESTDIR)$(libdir)/$(NSS_LDAP_NSS_VERSIONED)
+ -rm -f $(DESTDIR)$(libdir)/$(NSS_LDAP_SONAME)