]> granicus.if.org Git - curl/commitdiff
fix ldap related compilation issues
authorYang Tse <yangsita@gmail.com>
Tue, 1 Jun 2010 15:25:03 +0000 (17:25 +0200)
committerYang Tse <yangsita@gmail.com>
Tue, 1 Jun 2010 15:25:03 +0000 (17:25 +0200)
configure.ac
lib/curl_ldap.h
lib/ldap.c
lib/openldap.c
lib/url.c
lib/version.c

index 774fd95ea4c606a8b38ed57f17c6d3460499312c..f2fd9665d77cf5faeebf8f0b0c7d9722cd782ae2 100644 (file)
@@ -411,6 +411,7 @@ AC_HELP_STRING([--disable-ldaps],[Disable LDAPS support]),
        else
                AC_MSG_RESULT(yes)
                AC_DEFINE(HAVE_LDAP_SSL, 1, [Use LDAPS implementation])
+               AC_SUBST(HAVE_LDAP_SSL, [1])
                curl_ldaps_msg="enabled"
        fi
        ;;
@@ -2701,10 +2702,13 @@ fi
 if test "x$CURL_DISABLE_TELNET" != "x1"; then
   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS TELNET"
 fi
-if test "x$CURL_DISABLE_LDAP" != "x1" -o "x$USE_OPENLDAP" = "x1"; then
+if test "x$CURL_DISABLE_LDAP" != "x1"; then
   SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAP"
-  if test "x$CURL_DISABLE_LDAPS" != "x1" -o "x$USE_OPENLDAP$SSL_ENABLED" = "x11"; then
-    SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
+  if test "x$CURL_DISABLE_LDAPS" != "x1"; then
+    if (test "x$USE_OPENLDAP" = "x1" && test "x$SSL_ENABLED" = "x1") ||
+      (test "x$USE_OPENLDAP" != "x1"  && test "x$HAVE_LDAP_SSL" = "x1"); then
+      SUPPORT_PROTOCOLS="$SUPPORT_PROTOCOLS LDAPS"
+    fi
   fi
 fi
 if test "x$CURL_DISABLE_DICT" != "x1"; then
index a2b167fa0757df6a35528244e9d22dc07f852834..3cce4bf7b09d11b35c075d11e6c2c5417c1cab38 100644 (file)
@@ -8,7 +8,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
  * KIND, either express or implied.
  *
  ***************************************************************************/
-#if !defined(CURL_DISABLE_LDAP) || defined(USE_OPENLDAP)
+#ifndef CURL_DISABLE_LDAP
 extern const struct Curl_handler Curl_handler_ldap;
 
-#if defined(HAVE_LDAP_SSL) || defined(USE_OPENLDAP)
+#if (defined(USE_OPENLDAP) && defined(USE_SSL)) || \
+   (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL))
 extern const struct Curl_handler Curl_handler_ldaps;
 #endif
 
index 06c22904239b98d5990a73a01d868833e60993cd..e837dbfddaa834c9d239230463a173d48d93f054 100644 (file)
@@ -5,7 +5,7 @@
  *                | (__| |_| |  _ <| |___
  *                 \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
 #include "setup.h"
 
 #if !defined(CURL_DISABLE_LDAP) && !defined(USE_OPENLDAP)
+
+/*
+ * Notice that USE_OPENLDAP is only a source code selection switch. When
+ * libcurl is built with USE_OPENLDAP defined the libcurl source code that
+ * gets compiled is the code from openldap.c, otherwise the code that gets
+ * compiled is the code from ldap.c.
+ *
+ * When USE_OPENLDAP is defined a recent version of the OpenLDAP library
+ * might be required for compilation and runtime. In order to use ancient
+ * OpenLDAP library versions, USE_OPENLDAP shall not be defined.
+ */
+
 /* -- WIN32 approved -- */
 #include <stdio.h>
 #include <string.h>
@@ -715,4 +727,4 @@ static void _ldap_free_urldesc (LDAPURLDesc *ludp)
   free (ludp);
 }
 #endif  /* !HAVE_LDAP_URL_PARSE */
-#endif  /* CURL_DISABLE_LDAP */
+#endif  /* !CURL_DISABLE_LDAP && !USE_OPENLDAP */
index 16bf7b8c80c3f4195ad27537204bd67187533084..daba224eddd154082ac45fd0f7e4b71a5f560f1e 100644 (file)
 
 #include "setup.h"
 
-#ifdef USE_OPENLDAP
+#if !defined(CURL_DISABLE_LDAP) && defined(USE_OPENLDAP)
+
+/*
+ * Notice that USE_OPENLDAP is only a source code selection switch. When
+ * libcurl is built with USE_OPENLDAP defined the libcurl source code that
+ * gets compiled is the code from openldap.c, otherwise the code that gets
+ * compiled is the code from ldap.c.
+ *
+ * When USE_OPENLDAP is defined a recent version of the OpenLDAP library
+ * might be required for compilation and runtime. In order to use ancient
+ * OpenLDAP library versions, USE_OPENLDAP shall not be defined.
+ */
 
 #include "urldata.h"
 #include <curl/curl.h>
@@ -588,4 +599,4 @@ static Sockbuf_IO ldapsb_tls =
 };
 #endif /* USE_SSL */
 
-#endif  /* USE_OPENLDAP */
+#endif /* !CURL_DISABLE_LDAP && USE_OPENLDAP */
index 3f55f7bda2111c298cc6d20ad5f5e698b2f68fa2..6ec844a65679571f6efef56a139243f7cc21853e 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -181,9 +181,10 @@ static const struct Curl_handler * const protocols[] = {
   &Curl_handler_dict,
 #endif
 
-#if !defined(CURL_DISABLE_LDAP) || defined(USE_OPENLDAP)
+#ifndef CURL_DISABLE_LDAP
   &Curl_handler_ldap,
-#if defined(HAVE_LDAP_SSL) || (defined(USE_OPENLDAP) && defined(USE_SSL))
+#if (defined(USE_OPENLDAP) && defined(USE_SSL)) || \
+   (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL))
   &Curl_handler_ldaps,
 #endif
 #endif
index d482bff1e68d5b65b8f4adfaf99f117e1e5294fd..9a336a32d5ce5a47c6a73e47541b113714f7deb6 100644 (file)
@@ -170,9 +170,10 @@ static const char * const protocols[] = {
 #if defined(USE_SSL) && !defined(CURL_DISABLE_IMAP)
   "imaps",
 #endif
-#if !defined(CURL_DISABLE_LDAP) || defined(USE_OPENLDAP)
+#ifndef CURL_DISABLE_LDAP
   "ldap",
-#if defined(HAVE_LDAP_SSL) || (defined(USE_OPENLDAP) && defined(USE_SSL))
+#if (defined(USE_OPENLDAP) && defined(USE_SSL)) || \
+   (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL))
   "ldaps",
 #endif
 #endif