Skip to contentSkip to conversation

make ldap support in libnfsidmap optional

patch/rfc Mike Frysinger 2 participants 2 messages Aug 22, 2006

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

find attached a patch that allows libnfsidmap to be built without ldap support -mike

configure.in +15 -0
@@ -13,6 +13,21 @@
 
 # Checks for libraries.
 
+AC_ARG_ENABLE([ldap],
+	[AC_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:@default=detect@:>@])])
+if test "x$enable_ldap" != "xno" ; then
+	AC_CHECK_HEADER([ldap.h],
+		[AC_CHECK_LIB([ldap], [ldap_initialize],
+		              [have_ldap="yes"],[have_ldap="no"])],
+		[have_ldap="no"])
+	if test "x$have_ldap" = "xyes" ; then
+		AC_DEFINE([ENABLE_LDAP], 1, [Enable LDAP Support])
+		LIBS="$LIBS -lldap"
+	elif test "x$enable_ldap$have_ldap" = "xyesno" ; then
+		AC_MSG_ERROR(LDAP support not found!)
+	fi
+fi
+
 # Checks for header files.
 AC_HEADER_STDC
 AC_CHECK_HEADERS([stdlib.h string.h unistd.h errno.h])
Makefile.am +0 -1
@@ -4,7 +4,6 @@
 libnfsidmap_la_LDFLAGS = -version-info 2:0:2
 include_HEADERS = nfsidmap.h
 EXTRA_DIST = $(man_MANS) libtest.c idmapd.conf
-LIBS = -lldap
 
 #	XXX: also exclude debian/files and debian/files.new ? do a clean??
 dist-hook:
libnfsidmap.c +6 -4
@@ -166,11 +166,13 @@
 extern struct trans_func nss_trans;
 extern struct trans_func umichldap_trans;
 
-#define TR_SIZE 2
-static struct trans_func * t_array[TR_SIZE] = {
-	[0] = &nss_trans,
-	[1] = &umichldap_trans,
+static struct trans_func * t_array[] = {
+	&nss_trans,
+#ifdef ENABLE_LDAP
+	&umichldap_trans,
+#endif
 };
+#define TR_SIZE (sizeof(t_array)/sizeof(*t_array))
 
 int
 set_trans_method(char *method)
umich_ldap.c +4 -0
@@ -32,6 +32,8 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef ENABLE_LDAP
+
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netdb.h>
@@ -1019,3 +1021,5 @@
 	.gid_to_name    = umichldap_gid_to_name,
 	.gss_princ_to_grouplist = umichldap_gss_princ_to_grouplist,
 };
+
+#endif

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw
Quoted 2 lines · Mike Frysinger

find attached a patch that allows libnfsidmap to be built without ldap support -mike

Thanks. I think this is very reasonable. If I don't hear any objections, I'll add this to the next release.

K.C.

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs