]> arthur.barton.de Git - netatalk.git/commitdiff
Update acl/ldap defines part 2
authorFrank Lahm <franklahm@googlemail.com>
Sat, 30 Oct 2010 15:24:28 +0000 (17:24 +0200)
committerFrank Lahm <franklahm@googlemail.com>
Sat, 30 Oct 2010 15:24:28 +0000 (17:24 +0200)
bin/misc/Makefile.am
bin/misc/uuidtest.c
configure.in
libatalk/acl/uuid.c

index 93a0c256be6b45777c23d6dbea0eb655164bcb65..04a53e23e8b72fa1c59ff0af9944890f9a6188af 100644 (file)
@@ -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
+
index b0e5ef9f993034b0a5383d667b2201f7be978467..f3e3ff47354cae945fe21b6f00acc499418bda4b 100644 (file)
 #include "config.h"
 #endif /* HAVE_CONFIG_H */
 
-#ifdef HAVE_ACLS
-
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
-#include <ldap.h>
 
 #include <atalk/ldapconfig.h>
 #include <atalk/uuid.h>
@@ -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 */
index 47417f4546a11bbffed2da26f4ada9fb9db8b2a0..f7c8a4c428fa7c0d8641d6ffdd6a1a8521f4b0de 100644 (file)
@@ -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
index 1ac47f8de4a9251dccc36eeeeae2dbc0faf0791e..8993acc21f61fa38bc0c58dda11bd720eebc0cf4 100644 (file)
@@ -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: