From 168f7dcf65791d16b89055370d78ac23f04570a2 Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Sat, 30 Oct 2010 17:24:28 +0200 Subject: [PATCH] Update acl/ldap defines part 2 --- bin/misc/Makefile.am | 3 +-- bin/misc/uuidtest.c | 8 ++++---- configure.in | 29 ++++++++++++++++------------- libatalk/acl/uuid.c | 2 ++ 4 files changed, 23 insertions(+), 19 deletions(-) diff --git a/bin/misc/Makefile.am b/bin/misc/Makefile.am index 93a0c256..04a53e23 100644 --- a/bin/misc/Makefile.am +++ b/bin/misc/Makefile.am @@ -11,9 +11,8 @@ netacnv_LDADD = $(top_builddir)/libatalk/libatalk.la logger_test_SOURCES = logger_test.c logger_test_LDADD = $(top_builddir)/libatalk/libatalk.la -if HAVE_ACLS bin_PROGRAMS += afpldaptest afpldaptest_SOURCES = uuidtest.c afpldaptest_CFLAGS = -D_PATH_ACL_LDAPCONF=\"$(pkgconfdir)/afp_ldap.conf\" afpldaptest_LDADD = $(top_builddir)/libatalk/libatalk.la -endif + diff --git a/bin/misc/uuidtest.c b/bin/misc/uuidtest.c index b0e5ef9f..f3e3ff47 100644 --- a/bin/misc/uuidtest.c +++ b/bin/misc/uuidtest.c @@ -16,14 +16,11 @@ #include "config.h" #endif /* HAVE_CONFIG_H */ -#ifdef HAVE_ACLS - #include #include #include #include #include -#include #include #include @@ -41,6 +38,7 @@ static void parse_ldapconf() static int inited = 0; if (! inited) { +#ifdef HAVE_LDAP /* Parse afp_ldap.conf */ printf("Start parsing afp_ldap.conf\n"); acl_ldap_readconfig(_PATH_ACL_LDAPCONF); @@ -58,6 +56,9 @@ static void parse_ldapconf() } else { printf("afp_ldap.conf is not ok, not using LDAP. Only local UUID testing available.\n"); } +#else + printf("Built without LDAP support, only local UUID testing available.\n"); +#endif inited = 1; } } @@ -144,4 +145,3 @@ int main( int argc, char **argv) return 0; } -#endif /* HAVE_ACLS */ diff --git a/configure.in b/configure.in index 47417f45..f7c8a4c4 100644 --- a/configure.in +++ b/configure.in @@ -984,21 +984,24 @@ AC_ARG_WITH(ldap, *) with_ldap=auto ;; - esac ], - [with_ldap=auto]) + esac ]) AC_MSG_RESULT($with_ldap) -if test x"$with_ldap" = x"no"; then - AC_MSG_RESULT(Disabling LDAP support) -else - with_ldap=yes - AC_MSG_NOTICE([Checking for LDAP header and library]) - AC_CHECK_HEADER([ldap.h],, - [AC_MSG_ERROR([LDAP client headers not found.]) - with_ldap=no]) - AC_CHECK_LIB(ldap, ldap_init,, - [AC_MSG_ERROR([LDAP client libs not found.]) - with_ldap=no]) + +if test x"$with_ldap" != x"no" ; then + AC_CHECK_HEADER([ldap.h], with_ldap=yes, + [ if test x"$with_ldap" = x"yes" ; then + AC_MSG_ERROR([Missing LDAP headers]) + fi + with_ldap=no + ]) + AC_CHECK_LIB(ldap, ldap_init, with_ldap=yes, + [ if test x"$with_ldap" = x"yes" ; then + AC_MSG_ERROR([Missing LDAP library]) + fi + with_ldap=no + ]) fi + if test x"$with_ldap" = x"yes"; then AC_DEFINE(HAVE_LDAP,1,[Whether LDAP is available]) fi diff --git a/libatalk/acl/uuid.c b/libatalk/acl/uuid.c index 1ac47f8d..8993acc2 100644 --- a/libatalk/acl/uuid.c +++ b/libatalk/acl/uuid.c @@ -204,6 +204,7 @@ int getnamefromuuid(const uuidp_t uuidp, char **name, uuidtype_t *type) { return 0; } +#ifdef HAVE_LDAP ret = ldap_getnamefromuuid(uuid_bin2string(uuidp), name, type); if (ret != 0) { LOG(log_warning, logtype_afpd, "getnamefromuuid(%s): no result from ldap_getnamefromuuid", @@ -213,6 +214,7 @@ int getnamefromuuid(const uuidp_t uuidp, char **name, uuidtype_t *type) { add_cachebyuuid( uuidp, *name, *type, 0); LOG(log_debug, logtype_afpd, "getnamefromuuid{LDAP}: UUID: %s -> name: %s, type:%s", uuid_bin2string(uuidp), *name, uuidtype[*type]); +#endif } cleanup: -- 2.39.2