You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mi...@apache.org on 2024/04/18 07:32:13 UTC

svn commit: r1917094 [1/3] - in /apr/apr/trunk: ./ build/ docs/ include/ include/private/ ldap/ misc/unix/ test/

Author: minfrin
Date: Thu Apr 18 07:32:13 2024
New Revision: 1917094

URL: http://svn.apache.org/viewvc?rev=1917094&view=rev
Log:
apr_ldap: Add the new APR LDAP API.

- Async API, can be used safely in event driven code.
- Requests are tied into a pool lifetime, with abandon if the pool is
  cleaned early.
- Initial support for SASL bind, compare and search.
- Backportable to apr-util v1.7.
- Test case with example implementation.
- Unmaintained Mozilla/Netware API support removed.
- Rebind removed pending async re-implementation.
- Doxygen docs.

Added:
    apr/apr/trunk/build/ldap.m4
    apr/apr/trunk/include/private/apr_ldap_internal.h   (with props)
    apr/apr/trunk/ldap/
    apr/apr/trunk/ldap/apr_ldap.c   (with props)
    apr/apr/trunk/ldap/apr_ldap_stub.c   (with props)
    apr/apr/trunk/ldap/apr_ldap_url.c   (with props)
Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/CMakeLists.txt
    apr/apr/trunk/Makefile.in
    apr/apr/trunk/build.conf
    apr/apr/trunk/build/dso.m4
    apr/apr/trunk/configure.in
    apr/apr/trunk/docs/doxygen.conf
    apr/apr/trunk/include/apr.h.in
    apr/apr/trunk/include/apr.hnw
    apr/apr/trunk/include/apr.hw
    apr/apr/trunk/include/apr.hwc
    apr/apr/trunk/include/apu_errno.h
    apr/apr/trunk/misc/unix/errorcodes.c
    apr/apr/trunk/test/Makefile.in
    apr/apr/trunk/test/Makefile.win
    apr/apr/trunk/test/abts_tests.h
    apr/apr/trunk/test/testutil.h

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Thu Apr 18 07:32:13 2024
@@ -1,6 +1,8 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 2.0.0
 
+  *) apr_ldap: Add the new APR LDAP API. [Graham Leggett]
+
   *) Add APR_OFF_MAX to give the maximum value of apr_off_t. [Graham
      Leggett]
 

Modified: apr/apr/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CMakeLists.txt?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/CMakeLists.txt (original)
+++ apr/apr/trunk/CMakeLists.txt Thu Apr 18 07:32:13 2024
@@ -110,6 +110,7 @@ ENDIF()
 
 SET(apr_have_ipv6_10 0)
 SET(apu_have_crypto_10 0)
+SET(apu_have_ldap_10 0)
 SET(apu_use_libxml2_10 0)
 SET(apu_use_expat_10 0)
 SET(apu_use_xmllite_10 0)
@@ -125,6 +126,10 @@ IF(APU_HAVE_CRYPTO)
   SET(apu_have_crypto_10 1)
 ENDIF()
 
+IF(APU_HAVE_LDAP)
+  SET(apu_have_ldap_10 1)
+ENDIF()
+
 IF(APU_USE_EXPAT)
   SET(apu_use_expat_10 1)
 ELSEIF(APU_USE_LIBXML2)

Modified: apr/apr/trunk/Makefile.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/Makefile.in?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/Makefile.in (original)
+++ apr/apr/trunk/Makefile.in Thu Apr 18 07:32:13 2024
@@ -84,6 +84,7 @@ LDADD_dbm_db = @LDADD_dbm_db@
 LDADD_dbm_gdbm = @LDADD_dbm_gdbm@
 LDADD_dbm_ndbm = @LDADD_dbm_ndbm@
 LDADD_dbm_lmdb = @LDADD_dbm_lmdb@
+LDADD_ldap = @LDADD_ldap@
 LDADD_crypto_openssl = @LDADD_crypto_openssl@
 LDADD_crypto_nss = @LDADD_crypto_nss@
 LDADD_crypto_commoncrypto = @LDADD_crypto_commoncrypto@

Modified: apr/apr/trunk/build.conf
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build.conf?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/build.conf (original)
+++ apr/apr/trunk/build.conf Thu Apr 18 07:32:13 2024
@@ -28,6 +28,8 @@ paths =
   hooks/*.c
   jose/*.c
   json/*.c
+  ldap/apr_ldap_stub.c
+  ldap/apr_ldap_url.c
   misc/*.c
   memcache/*.c
   redis/*.c
@@ -59,7 +61,7 @@ dsp = libapr.dsp
 modules =
   crypto_openssl crypto_nss crypto_commoncrypto dbd_pgsql
   dbd_sqlite2 dbd_sqlite3 dbd_oracle dbd_mysql dbd_odbc
-  dbm_db dbm_gdbm dbm_ndbm dbm_lmdb
+  dbm_db dbm_gdbm dbm_ndbm dbm_lmdb ldap
 
 # gen_uri_delim.c
 
@@ -117,3 +119,8 @@ target = dbm/apr_dbm_ndbm.la
 [dbm_lmdb]
 paths = dbm/apr_dbm_lmdb.c
 target = dbm/apr_dbm_lmdb.la
+
+[ldap]
+paths = ldap/apr_ldap.c
+target = ldap/apr_ldap.la
+

Modified: apr/apr/trunk/build/dso.m4
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/dso.m4?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/build/dso.m4 (original)
+++ apr/apr/trunk/build/dso.m4 Thu Apr 18 07:32:13 2024
@@ -47,6 +47,7 @@ AC_DEFUN([APR_MODULAR_DSO], [
      test $apu_have_gdbm = 1 && objs="$objs dbm/apr_dbm_gdbm.lo"
      test $apu_have_ndbm = 1 && objs="$objs dbm/apr_dbm_ndbm.lo"
      test $apu_have_lmdb = 1 && objs="$objs dbm/apr_dbm_lmdb.lo"
+     test $apu_have_ldap = 1 && objs="$objs ldap/apr_ldap.lo"
      EXTRA_OBJECTS="$EXTRA_OBJECTS $objs"
 
      # Use libtool *.la for mysql if available
@@ -66,9 +67,11 @@ AC_DEFUN([APR_MODULAR_DSO], [
      LIBS="$LIBS $LDADD_crypto_openssl $LDADD_crypto_nss $LDADD_crypto_commoncrypto"
      LIBS="$LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_odbc"
      LIBS="$LIBS $LDADD_dbm_db $LDADD_dbm_gdbm $LDADD_dbm_ndbm $LDADD_dbm_lmdb"
+     LIBS="$LIBS $LDADD_ldap"
      APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_crypto_openssl $LDADD_crypto_nss $LDADD_crypto_commoncrypto"
      APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_dbd_pgsql $LDADD_dbd_sqlite2 $LDADD_dbd_sqlite3 $LDADD_dbd_oracle $LDADD_dbd_mysql $LDADD_dbd_odbc"
      APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_dbm_db $LDADD_dbm_gdbm $LDADD_dbm_ndbm $LDADD_dbm_lmdb"
+     APRUTIL_EXPORT_LIBS="$APRUTIL_EXPORT_LIBS $LDADD_ldap"
 
   else
 
@@ -87,6 +90,7 @@ AC_DEFUN([APR_MODULAR_DSO], [
      test $apu_have_gdbm = 1 && dsos="$dsos dbm/apr_dbm_gdbm.la"
      test $apu_have_ndbm = 1 && dsos="$dsos dbm/apr_dbm_ndbm.la"
      test $apu_have_lmdb = 1 && dsos="$dsos dbm/apr_dbm_lmdb.la"
+     test $apu_have_ldap = 1 && dsos="$dsos ldap/apr_ldap.la"
 
      if test -n "$dsos"; then
         APR_DSO_MODULES="$APR_DSO_MODULES $dsos"

Added: apr/apr/trunk/build/ldap.m4
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/ldap.m4?rev=1917094&view=auto
==============================================================================
--- apr/apr/trunk/build/ldap.m4 (added)
+++ apr/apr/trunk/build/ldap.m4 Thu Apr 18 07:32:13 2024
@@ -0,0 +1,238 @@
+dnl -------------------------------------------------------- -*- autoconf -*-
+dnl Copyright 2006 The Apache Software Foundation or its licensors, as
+dnl applicable.
+dnl
+dnl Licensed under the Apache License, Version 2.0 (the "License");
+dnl you may not use this file except in compliance with the License.
+dnl You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+
+dnl
+dnl LDAP module
+dnl
+
+# APU_SEARCH_FRAMEWORKS(FUNCTION, SEARCH-FRAMEWORKS,
+#                       [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+#                       [OTHER-LIBRARIES])
+# --------------------------------------------------------
+# Search for a framework defining FUNC, if it's not already available.
+AC_DEFUN([APU_SEARCH_FRAMEWORKS],
+[AS_VAR_PUSHDEF([ac_Search], [ac_cv_search_$1])dnl
+AC_CACHE_CHECK([for framework containing $1], [ac_Search],
+[ac_func_search_save_LIBS=$LIBS
+AC_LANG_CONFTEST([AC_LANG_CALL([], [$1])])
+for ac_framework in '' $2
+do
+  if test -z "$ac_framework"; then
+    ac_res="none required"
+  else
+    ac_res="-framework $ac_framework"
+    LIBS="-framework $ac_framework $5 $ac_func_search_save_LIBS"
+  fi
+  AC_LINK_IFELSE([], [AS_VAR_SET([ac_Search], [$ac_res])])
+  AS_VAR_SET_IF([ac_Search], [break])
+done
+AS_VAR_SET_IF([ac_Search], , [AS_VAR_SET([ac_Search], [no])])
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS])
+AS_VAR_COPY([ac_res], [ac_Search])
+AS_IF([test "$ac_res" != no],
+  [test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  $3],
+      [$4])
+AS_VAR_POPDEF([ac_Search])dnl
+])
+
+# APU_CHECK_FRAMEWORK(FRAMEWORK, FUNCTION,
+#                     [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND],
+#                     [OTHER-FRAMEWORKS])
+# ------------------------------------------------------
+#
+AC_DEFUN([APU_CHECK_FRAMEWORK],
+[m4_ifval([$3], , [AH_CHECK_LIB([$1])])dnl
+AS_LITERAL_WORD_IF([$1],
+	      [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1_$2])],
+	      [AS_VAR_PUSHDEF([ac_Lib], [ac_cv_lib_$1""_$2])])dnl
+AC_CACHE_CHECK([for $2 in -framework $1], [ac_Lib],
+[apu_check_framework_save_LIBS=$LIBS
+LIBS="-framework $1 $5 $LIBS"
+AC_LINK_IFELSE([AC_LANG_CALL([], [$2])],
+	       [AS_VAR_SET([ac_Lib], [yes])],
+	       [AS_VAR_SET([ac_Lib], [no])])
+LIBS=$apu_check_framework_save_LIBS])
+AS_VAR_IF([ac_Lib], [yes],
+      [m4_default([$3], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FRAMEWORK_$1))
+  LIBS="-framework $1 $LIBS"
+])],
+      [$4])
+AS_VAR_POPDEF([ac_Lib])dnl
+])# APU_CHECK_FRAMEWORK
+
+
+
+dnl 
+dnl Find a particular LDAP library
+dnl
+AC_DEFUN([APU_FIND_LDAPLIB], [
+  if test ${apu_have_ldap} != "1"; then
+    ldaplib=$1
+    extralib=$2
+    # Clear the cache entry for subsequent APU_FIND_LDAPLIB invocations.
+    changequote(,)
+    ldaplib_cache_id="`echo $ldaplib | sed -e 's/[^a-zA-Z0-9_]/_/g'`"
+    changequote([,])
+    unset ac_cv_lib_${ldaplib_cache_id}_ldap_init
+    unset ac_cv_lib_${ldaplib_cache_id}___ldap_init
+    AC_CHECK_LIB(${ldaplib}, ldap_init, 
+      [
+        LDADD_ldap_found="-l${ldaplib} ${extralib}"
+        apu_have_ldap="1";
+      ], , ${extralib})
+  fi
+])
+
+
+dnl
+dnl APU_FIND_LDAP: figure out where LDAP is located
+dnl
+AC_DEFUN([APU_FIND_LDAP],  [
+
+echo $ac_n "${nl}checking for ldap support..."
+
+apu_have_ldap="0";
+apu_have_ldap_openldap="0"
+apu_have_ldap_microsoft="0"
+apu_have_ldap_tivoli="0"
+apu_have_ldap_zos="0"
+apu_have_ldap_other="0"
+LDADD_ldap_found=""
+
+AC_ARG_WITH(lber,[  --with-lber=library     lber library to use],
+  [
+    if test "$withval" = "yes"; then
+      apu_liblber_name="lber"
+    else
+      apu_liblber_name="$withval"
+    fi
+  ],
+  [
+    apu_liblber_name="lber"
+  ])
+
+AC_ARG_WITH(ldap-include,[  --with-ldap-include=path  path to ldap include files with trailing slash])
+AC_ARG_WITH(ldap-lib,[  --with-ldap-lib=path    path to ldap lib file])
+AC_ARG_WITH(ldap,[  --with-ldap             enable ldap],
+  [
+    if test "$with_ldap" = "yes"; then
+
+      save_cppflags="$CPPFLAGS"
+      save_ldflags="$LDFLAGS"
+      save_libs="$LIBS"
+
+      if test -n "$with_ldap_include"; then
+        ldap_CPPFLAGS="-I$with_ldap_include"
+        APR_ADDTO(CPPFLAGS, [$ldap_CPPFLAGS])
+      fi
+      if test -n "$with_ldap_lib"; then
+        ldap_LDFLAGS="-L$with_ldap_lib"
+        APR_ADDTO(LDFLAGS, [$ldap_LDFLAGS])
+      fi
+
+      if test -z "$with_ldap_include" && test -z "$with_ldap_lib"; then
+        APU_CHECK_FRAMEWORK(LDAP, ldap_init,
+        [
+          LDADD_ldap_found="-framework LDAP"
+          apu_have_ldap="1";
+        ])
+      fi
+
+      APU_FIND_LDAPLIB("ldap", "-llber")
+
+      if test ${apu_have_ldap} != "1"; then
+        AC_MSG_ERROR(could not find an LDAP library)
+      else
+        APR_ADDTO(LDADD_ldap, [$LDADD_ldap_found $ldap_LDFLAGS])
+      fi
+
+      AC_CHECK_LIB($apu_liblber_name, ber_init,
+        [APR_ADDTO(LDADD_ldap, [-l${apu_liblber_name}])])
+
+      AC_CHECK_HEADERS(lber.h, lber_h=["#include <lber.h>"])
+      AC_CHECK_HEADERS(ldap.h, ldap_h=["#include <ldap.h>"])
+
+      if test -n "$ldap_h"; then
+        apr_cv_hdr_ldap_h=yes
+      fi
+
+      if test "$apr_cv_hdr_ldap_h" = "yes"; then
+        AC_CACHE_CHECK([for LDAP toolkit],
+                       [apr_cv_ldap_toolkit], [
+          if test "x$apr_cv_ldap_toolkit" = "x"; then
+            AC_EGREP_CPP([OpenLDAP], [$lber_h
+                         $ldap_h 
+                         LDAP_VENDOR_NAME], [apu_have_ldap_openldap="1"
+                                             apr_cv_ldap_toolkit="OpenLDAP"])
+          fi
+          if test "x$apr_cv_ldap_toolkit" = "x"; then
+            AC_EGREP_CPP([Sun Microsystems Inc.], [$lber_h
+                         $ldap_h
+                         LDAP_VENDOR_NAME], [apu_have_ldap_solaris="1"
+                                             apr_cv_ldap_toolkit="Solaris"])
+          fi
+          if test "x$apr_cv_ldap_toolkit" = "x"; then
+            AC_EGREP_CPP([Microsoft Corporation.], [$lber_h
+                         $ldap_h
+                         LDAP_VENDOR_NAME], [apu_have_ldap_microsoft="1"
+                                             apr_cv_ldap_toolkit="Microsoft"])
+          fi
+          if test "x$apr_cv_ldap_toolkit" = "x"; then
+            AC_EGREP_CPP([International Business Machines], [$lber_h
+                         $ldap_h
+                         LDAP_VENDOR_NAME], [apu_have_ldap_tivoli="1"
+                                             apr_cv_ldap_toolkit="Tivoli"])
+          fi
+          if test "x$apr_cv_ldap_toolkit" = "x"; then
+            case "$host" in
+            *-ibm-os390)
+              AC_EGREP_CPP([IBM], [$lber_h
+                                   $ldap_h], [apu_have_ldap_zos="1"
+                                              apr_cv_ldap_toolkit="z/OS"])
+              ;;
+            esac
+          fi
+          if test "x$apr_cv_ldap_toolkit" = "x"; then
+            apu_have_ldap_other="1"
+            apr_cv_ldap_toolkit="unknown"
+          fi
+        ])
+      fi
+
+      CPPFLAGS=$save_cppflags
+      LDFLAGS=$save_ldflags
+      LIBS=$save_libs
+    fi
+  ])
+
+AC_CHECK_HEADERS([sasl.h sasl/sasl.h])
+
+AC_SUBST(ldap_h)
+AC_SUBST(lber_h)
+AC_SUBST(apu_have_ldap)
+AC_SUBST(apu_have_ldap_openldap)
+AC_SUBST(apu_have_ldap_solaris)
+AC_SUBST(apu_have_ldap_microsoft)
+AC_SUBST(apu_have_ldap_tivoli)
+AC_SUBST(apu_have_ldap_zos)
+AC_SUBST(apu_have_ldap_other)
+AC_SUBST(LDADD_ldap)
+
+])
+
+

Modified: apr/apr/trunk/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/configure.in?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/configure.in (original)
+++ apr/apr/trunk/configure.in Thu Apr 18 07:32:13 2024
@@ -34,6 +34,7 @@ sinclude(build/dbm.m4)
 sinclude(build/dbd.m4)
 sinclude(build/dso.m4)
 sinclude(build/iconv.m4)
+sinclude(build/ldap.m4)
 
 sinclude(build/ax_prog_cc_for_build.m4)
 
@@ -3150,6 +3151,9 @@ APU_CHECK_DBD_SQLITE2
 APU_CHECK_DBD_ORACLE
 APU_CHECK_DBD_ODBC
 
+dnl Find LDAP backend
+APU_FIND_LDAP
+
 dnl select an XML parser
 APU_FIND_XML
 
@@ -3174,6 +3178,8 @@ if test "$crypt_r" = "1"; then
   APU_CHECK_CRYPT_R_STYLE
 fi
 
+AC_CHECK_HEADERS([sasl.h sasl/sasl.h])
+
 APRUTIL_LIBNAME="aprutil${libsuffix}"
 AC_SUBST(APRUTIL_LIBNAME)
 

Modified: apr/apr/trunk/docs/doxygen.conf
URL: http://svn.apache.org/viewvc/apr/apr/trunk/docs/doxygen.conf?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/docs/doxygen.conf (original)
+++ apr/apr/trunk/docs/doxygen.conf Thu Apr 18 07:32:13 2024
@@ -18,6 +18,7 @@ PREDEFINED="APR_DECLARE(x)=x" \
            "APR_POOL_DECLARE_ACCESSOR(x)=apr_pool_t* apr_##x##_pool_get (const apr_##x##_t *the##x)" \
            "APR_DECLARE_INHERIT_SET(x)=apr_status_t apr_##x##_inherit_set(apr_##x##_t *the##x)" \
            "APR_DECLARE_INHERIT_UNSET(x)=apr_status_t apr_##x##_inherit_unset(apr_##x##_t *the##x)" \
+           "APU_DECLARE_LDAP(x)=x" \
            "APR_HAS_THREADS" \
            "APR_HAS_MMAP" \
            "APR_HAS_XLATE" \

Modified: apr/apr/trunk/include/apr.h.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr.h.in?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/include/apr.h.in (original)
+++ apr/apr/trunk/include/apr.h.in Thu Apr 18 07:32:13 2024
@@ -705,6 +705,13 @@ typedef int apr_wait_t;
 #define APU_HAVE_NSS           @apu_have_nss@
 #define APU_HAVE_COMMONCRYPTO  @apu_have_commoncrypto@
 
+#define APR_HAS_LDAP              @apu_have_ldap@
+#define APR_HAS_OPENLDAP_LDAPSDK  @apu_have_ldap_openldap@
+#define APR_HAS_MICROSOFT_LDAPSDK @apu_have_ldap_microsoft@
+#define APR_HAS_TIVOLI_LDAPSDK    @apu_have_ldap_tivoli@
+#define APR_HAS_ZOS_LDAPSDK       @apu_have_ldap_zos@
+#define APR_HAS_OTHER_LDAPSDK     @apu_have_ldap_other@
+
 #define APU_HAVE_ICONV         @have_iconv@
 #define APR_HAS_XLATE          (APU_HAVE_ICONV)
 

Modified: apr/apr/trunk/include/apr.hnw
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr.hnw?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/include/apr.hnw (original)
+++ apr/apr/trunk/include/apr.hnw Thu Apr 18 07:32:13 2024
@@ -496,6 +496,11 @@ typedef int apr_wait_t;
 #define APU_HAVE_COMMONCRYPTO   0
 #endif
 
+#define APR_HAS_LDAP                0
+#define APR_HAS_OPENLDAP_LDAPSDK    0
+#define APR_HAS_MICROSOFT_LDAPSDK   0
+#define APR_HAS_OTHER_LDAPSDK       0
+
 #define APU_HAVE_ICONV          1
 #define APR_HAS_XLATE           (APU_HAVE_ICONV)
 

Modified: apr/apr/trunk/include/apr.hw
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr.hw?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/include/apr.hw (original)
+++ apr/apr/trunk/include/apr.hw Thu Apr 18 07:32:13 2024
@@ -673,6 +673,13 @@ typedef int apr_wait_t;
 #define APU_HAVE_COMMONCRYPTO   0
 #endif
 
+#define APR_HAS_LDAP                1
+#define APR_HAS_OPENLDAP_LDAPSDK    0
+#define APR_HAS_MICROSOFT_LDAPSDK   1
+#define APR_HAS_TIVOLI_LDAPSDK      0
+#define APR_HAS_ZOS_LDAPSDK         0
+#define APR_HAS_OTHER_LDAPSDK       0
+
 #define APU_HAVE_ICONV          0
 #define APR_HAS_XLATE           (APU_HAVE_ICONV)
 

Modified: apr/apr/trunk/include/apr.hwc
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr.hwc?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/include/apr.hwc (original)
+++ apr/apr/trunk/include/apr.hwc Thu Apr 18 07:32:13 2024
@@ -657,6 +657,13 @@ typedef int apr_wait_t;
 #define APU_HAVE_COMMONCRYPTO   0
 #define APU_HAVE_OPENSSL        @apu_have_crypto_10@
 
+#define APR_HAS_LDAP                @apu_have_ldap_10@
+#define APR_HAS_OPENLDAP_LDAPSDK    0
+#define APR_HAS_MICROSOFT_LDAPSDK   1
+#define APR_HAS_TIVOLI_LDAPSDK      0
+#define APR_HAS_ZOS_LDAPSDK         0
+#define APR_HAS_OTHER_LDAPSDK       0
+
 #define APU_HAVE_ICONV          @apu_have_iconv_10@
 #define APR_HAS_XLATE           (APU_HAVE_ICONV)
 

Modified: apr/apr/trunk/include/apu_errno.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apu_errno.h?rev=1917094&r1=1917093&r2=1917094&view=diff
==============================================================================
--- apr/apr/trunk/include/apu_errno.h (original)
+++ apr/apr/trunk/include/apu_errno.h Thu Apr 18 07:32:13 2024
@@ -53,6 +53,23 @@ extern "C" {
  * APR_EINITENGINE    The engine could not be initialised
  * APR_EREINIT        Underlying crypto has already been initialised
  * APR_ENOVERIFY      The signature verification failed
+ * APR_SERVER_DOWN    The server is down
+ * APR_AUTH_UNKNOWN   Unknown SASL mechanism 
+ * APR_PROXY_AUTH     Proxy authorization has failed
+ * APR_INAPPROPRIATE_AUTH  Authentication not appropriate for this entry
+ * APR_INVALID_CREDENTIALS Invalid credentials were presented
+ * APR_INSUFFICIENT_ACCESS The user has insufficient access
+ * APR_INSUFFICIENT_RIGHTS The user has insufficient rights
+ * APR_CONSTRAINT_VIOLATION A constraint was violated
+ * APR_FILTER_ERROR   The filter was malformed
+ * APR_NO_SUCH_OBJECT The object does not exist
+ * APR_NO_SUCH_ATTRIBUTE The attribute does not exist
+ * APR_COMPARE_TRUE   The comparison returned true
+ * APR_COMPARE_FALSE  The comparison returned false
+ * APR_NO_RESULTS_RETURNED No results were returned
+ * APR_WANT_READ      Call me again when the socket is ready for reading
+ * APR_WANT_WRITE     Call me again when the socket is ready for writing
+ * APR_USER_CANCELLED User has cancelled the request
  * </PRE>
  *
  * <PRE>
@@ -87,6 +104,40 @@ extern "C" {
 #define APR_EREINIT          (APR_UTIL_START_STATUS + 12)
 /** @see APR_STATUS_IS_ENOVERIFY */
 #define APR_ENOVERIFY        (APR_UTIL_START_STATUS + 13)
+/** @see APR_STATUS_IS_SERVER_DOWN */
+#define APR_SERVER_DOWN                (APR_UTIL_START_STATUS + 101)
+/** @see APR_STATUS_IS_AUTH_UNKNOWN */
+#define APR_AUTH_UNKNOWN               (APR_UTIL_START_STATUS + 102)
+/** @see APR_STATUS_IS_PROXY_AUTH */
+#define APR_PROXY_AUTH                 (APR_UTIL_START_STATUS + 103)
+/** @see APR_STATUS_IS_INAPPROPRIATE_AUTH */
+#define APR_INAPPROPRIATE_AUTH         (APR_UTIL_START_STATUS + 104)
+/** @see APR_STATUS_IS_INVALID_CREDENTIALS */
+#define APR_INVALID_CREDENTIALS        (APR_UTIL_START_STATUS + 105)
+/** @see APR_STATUS_IS_INSUFFICIENT_ACCESS */
+#define APR_INSUFFICIENT_ACCESS        (APR_UTIL_START_STATUS + 106)
+/** @see APR_STATUS_IS_INSUFFICIENT_RIGHTS */
+#define APR_INSUFFICIENT_RIGHTS        (APR_UTIL_START_STATUS + 107)
+/** @see APR_STATUS_IS_CONSTRAINT_VIOLATION */
+#define APR_CONSTRAINT_VIOLATION       (APR_UTIL_START_STATUS + 108)
+/** @see APR_STATUS_IS_FILTER_ERROR */
+#define APR_FILTER_ERROR               (APR_UTIL_START_STATUS + 109)
+/** @see APR_STATUS_IS_NO_SUCH_OBJECT */
+#define APR_NO_SUCH_OBJECT             (APR_UTIL_START_STATUS + 110)
+/** @see APR_STATUS_IS_NO_SUCH_ATTRIBUTE */
+#define APR_NO_SUCH_ATTRIBUTE          (APR_UTIL_START_STATUS + 111)
+/** @see APR_STATUS_IS_COMPARE_TRUE */
+#define APR_COMPARE_TRUE               (APR_UTIL_START_STATUS + 112)
+/** @see APR_STATUS_IS_COMPARE_FALSE */
+#define APR_COMPARE_FALSE              (APR_UTIL_START_STATUS + 113)
+/** @see APR_STATUS_IS_NO_RESULTS_RETURNED */
+#define APR_NO_RESULTS_RETURNED        (APR_UTIL_START_STATUS + 114)
+/** @see APR_STATUS_IS_WANT_READ */
+#define APR_WANT_READ                  (APR_UTIL_START_STATUS + 115)
+/** @see APR_STATUS_IS_WANT_WRITE */
+#define APR_WANT_WRITE                 (APR_UTIL_START_STATUS + 116)
+/** @see APR_STATUS_IS_USER_CANCELLED */
+#define APR_USER_CANCELLED             (APR_UTIL_START_STATUS + 117)
 /** @} */
 
 /**
@@ -159,6 +210,75 @@ extern "C" {
  * The signature verification failed
  */
 #define APR_STATUS_IS_ENOVERIFY(s)        ((s) == APR_ENOVERIFY)
+/**
+ * The server is down
+ */
+#define APR_STATUS_IS_SERVER_DOWN(s)        ((s) == APR_SERVER_DOWN)
+/**
+ * Authentication mechanism not supoorted by this server
+ */
+#define APR_STATUS_IS_AUTH_UNKNOWN(s)        ((s) == APR_AUTH_UNKNOWN)
+/**
+ * Proxy authorization has failed
+ */
+#define APR_STATUS_IS_PROXY_AUTH(s)        ((s) == APR_PROXY_AUTH)
+/**
+ * Inappropriate authentication was specified (e.g., simple auth
+ * was specified but the entry does not have a userPassword attribute).
+ */
+#define APR_STATUS_IS_INAPPROPRIATE_AUTH(s)        ((s) == APR_INAPPROPRIATE_AUTH)
+/**
+ * Invalid credentials were presented (e.g., the wrong password).
+ */
+#define APR_STATUS_IS_INVALID_CREDENTIALS(s)        ((s) == APR_INVALID_CREDENTIALS)
+/**
+ * The user has insufficient access to perform the operation.
+ */
+#define APR_STATUS_IS_INSUFFICIENT_ACCESS(s)        ((s) == APR_INSUFFICIENT_ACCESS)
+/**
+ * The user has insufficient rights to perform the operation.
+ */
+#define APR_STATUS_IS_INSUFFICIENT_RIGHTS(s)        ((s) == APR_INSUFFICIENT_RIGHTS)
+/**
+ * A constraint was violated.
+ */
+#define APR_STATUS_IS_CONSTRAINT_VIOLATION(s)        ((s) == APR_CONSTRAINT_VIOLATION)
+/**
+ * The filter was malformed.
+ */
+#define APR_STATUS_IS_FILTER_ERROR(s)        ((s) == APR_FILTER_ERROR)
+/**
+ * No such object.
+ */
+#define APR_STATUS_IS_NO_SUCH_OBJECT(s)        ((s) == APR_NO_SUCH_OBJECT)
+/**
+ * No such attribute.
+ */
+#define APR_STATUS_IS_NO_SUCH_ATTRIBUTE(s)        ((s) == APR_NO_SUCH_ATTRIBUTE)
+/**
+ * Comparison is true.
+ */
+#define APR_STATUS_IS_COMPARE_TRUE(s)        ((s) == APR_COMPARE_TRUE)
+/**
+ * Comparison is false.
+ */
+#define APR_STATUS_IS_COMPARE_FALSE(s)        ((s) == APR_COMPARE_FALSE)
+/**
+ * No results were returned.
+ */
+#define APR_STATUS_IS_NO_RESULTS_RETURNED(s)        ((s) == APR_NO_RESULTS_RETURNED)
+/**
+ * Call us back when the socket is ready for a read.
+ */
+#define APR_STATUS_IS_WANT_READ(s)        ((s) == APR_WANT_READ)
+/**
+ * Call us back when the socket is ready for a write.
+ */
+#define APR_STATUS_IS_WANT_WRITE(s)        ((s) == APR_WANT_WRITE)
+/**
+ * User has cancelled the request.
+ */
+#define APR_STATUS_IS_USER_CANCELLED(s)        ((s) == APR_USER_CANCELLED)
 /** @} */
 
 /**
@@ -167,8 +287,11 @@ extern "C" {
  * what really happened.
  */
 typedef struct apu_err_t {
+    /** What was APR trying to do when the error occurred */
     const char *reason;
+    /** Error message from the underlying system */
     const char *msg;
+    /** Native return code from the underlying system */
     int rc;
 } apu_err_t;
 

Added: apr/apr/trunk/include/private/apr_ldap_internal.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/private/apr_ldap_internal.h?rev=1917094&view=auto
==============================================================================
--- apr/apr/trunk/include/private/apr_ldap_internal.h (added)
+++ apr/apr/trunk/include/private/apr_ldap_internal.h Thu Apr 18 07:32:13 2024
@@ -0,0 +1,240 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef APR_LDAP_INTERNAL_H
+#define APR_LDAP_INTERNAL_H
+
+#include "apr_private.h"
+#include "apr_ldap.h"
+#include "apr_skiplist.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if APR_HAS_LDAP
+
+/*
+ * Include the standard LDAP header files.
+ */
+
+#if APR_HAS_MICROSOFT_LDAPSDK
+#include <winldap.h>
+#else
+#include <lber.h>
+#include <ldap.h>
+#endif
+
+
+/*
+ * Make sure the secure LDAP port is defined
+ */
+#ifndef LDAPS_PORT
+#define LDAPS_PORT 636  /* ldaps:/// default LDAP over TLS port */
+#endif
+
+/*
+ * For ldap function calls that input a size limit on the number of returned elements
+ * Some SDKs do not have the define for LDAP_DEFAULT_LIMIT (-1) or LDAP_NO_LIMIT (0)
+ * LDAP_DEFAULT_LIMIT is preferred as it allows inheritance from whatever the SDK
+ * or process is configured for.
+ */
+#ifdef LDAP_DEFAULT_LIMIT
+#define APR_LDAP_SIZELIMIT LDAP_DEFAULT_LIMIT
+#else
+#ifdef LDAP_NO_LIMIT
+#define APR_LDAP_SIZELIMIT LDAP_NO_LIMIT
+#endif
+#endif
+
+#ifndef APR_LDAP_SIZELIMIT
+#define APR_LDAP_SIZELIMIT 0 /* equivalent to LDAP_NO_LIMIT, and what goes on the wire */
+#endif
+
+/*
+ * z/OS is missing some defines
+ */
+#ifndef LDAP_VERSION_MAX
+#define LDAP_VERSION_MAX  LDAP_VERSION
+#endif
+#if APR_HAS_ZOS_LDAPSDK
+#define LDAP_VENDOR_NAME "IBM z/OS"
+#endif
+
+/*
+ * LDAP v2.0 is history.
+ */
+#if LDAP_VERSION_MAX <= 2
+#error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.
+#endif 
+
+
+
+/* The MS SDK returns LDAP_UNAVAILABLE when the backend has closed the connection
+ * between LDAP calls. Protect with APR_HAS_MICROSOFT_LDAPSDK in case someone 
+ * manually chooses another SDK on Windows 
+ */
+#if APR_HAS_MICROSOFT_LDAPSDK
+#define APR_LDAP_IS_SERVER_DOWN(s)    ((s) == LDAP_SERVER_DOWN \
+                                    || (s) == LDAP_UNAVAILABLE)
+#else
+#define APR_LDAP_IS_SERVER_DOWN(s)    ((s) == LDAP_SERVER_DOWN)
+#endif
+
+
+
+/**
+ * Macro to detect security related return values.
+ */
+#if defined(LDAP_INSUFFICIENT_ACCESS)
+#define APU_LDAP_INSUFFICIENT_ACCESS LDAP_INSUFFICIENT_ACCESS
+#elif defined(LDAP_INSUFFICIENT_RIGHTS)
+#define APU_LDAP_INSUFFICIENT_ACCESS LDAP_INSUFFICIENT_RIGHTS
+#elif defined(APR_HAS_MICROSOFT_LDAPSDK)
+/* The macros above fail to contemplate that LDAP_RETCODE values
+ * may be represented by an enum.  autoconf tests would be much
+ * more robust.
+ */
+#define APU_LDAP_INSUFFICIENT_ACCESS LDAP_INSUFFICIENT_RIGHTS
+#else
+#error The security return codes must be added to support this LDAP toolkit.
+#endif
+
+#if defined(LDAP_SECURITY_ERROR)
+#define APU_LDAP_SECURITY_ERROR LDAP_SECURITY_ERROR
+#else
+#define APU_LDAP_SECURITY_ERROR(n)      \
+    (LDAP_INAPPROPRIATE_AUTH == n) ? 1 \
+    : (LDAP_INVALID_CREDENTIALS == n) ? 1 \
+    : (APU_LDAP_INSUFFICIENT_ACCESS == n) ? 1 \
+    : 0
+#endif
+
+
+typedef struct apr_ldap_t {
+    apr_pool_t *pool;
+    LDAP *ld;
+    apr_socket_t *socket;
+    apr_skiplist *results;
+    apr_array_header_t *abandons;
+    apr_array_header_t *prepares;
+    LDAPControl **serverctrls;
+    LDAPControl **clientctrls;
+    apu_err_t err;
+    apr_status_t status;
+} apr_ldap_t;
+
+
+typedef struct apr_ldap_prepare_t {
+    apr_pool_t *pool;
+    apr_ldap_prepare_cb cb;
+    void *ctx;
+} apr_ldap_prepare_t;
+ 
+
+
+typedef struct apr_ldap_result_t {
+    apr_pool_t *pool;
+    apr_ldap_t *ld;
+    const char *mech;
+    const char *rmech;
+    LDAPMessage *message;
+    int msgid;
+    int msgtype;
+    union {
+        apr_ldap_bind_cb bind;
+        apr_ldap_compare_cb compare;
+        apr_ldap_search_result_cb search;
+    } cb;
+    union {
+        apr_ldap_search_entry_cb search;
+    } entry_cb;
+    void *ctx;
+    apr_size_t nentries;
+} apr_ldap_result_t;
+
+
+
+APU_DECLARE_LDAP(apr_status_t) apr_ldap_status(int rc, apr_status_t status);
+
+APU_DECLARE_LDAP(void) apr_ldap_result_add(apr_pool_t *pool,
+                                           apr_ldap_t *ldap,
+                                           apr_ldap_result_t *res,
+                                           int msgid)
+                                           __attribute__((nonnull(1,2,3)));
+
+
+
+
+#if APR_HAVE_MODULAR_DSO
+
+/* For LDAP internal builds, wrap our LDAP namespace */
+
+struct apr__ldap_dso_fntable {
+    int (*info)(apr_pool_t *pool, apu_err_t **err);
+    apr_status_t (*initialise)(apr_pool_t *pool, apr_ldap_t **ldap,
+                               apu_err_t *err);
+    apr_status_t (*option_get)(apr_pool_t *pool, apr_ldap_t *ldap, int option,
+                               apr_ldap_opt_t *outvalue, apu_err_t *err);
+    apr_status_t (*option_set)(apr_pool_t *pool, apr_ldap_t *ldap, int option,
+                               const apr_ldap_opt_t *invalue, apu_err_t *err);
+    apr_status_t (*connect)(apr_pool_t *pool, apr_ldap_t *ldap,
+                            apr_interval_time_t timeout, apu_err_t *err);
+    apr_status_t (*prepare)(apr_pool_t *pool, apr_ldap_t *ldap,
+                            apr_ldap_prepare_cb prepare_cb,
+                            void *prepare_ctx);
+    apr_status_t (*process)(apr_pool_t *pool, apr_ldap_t *ldap,
+                            apr_interval_time_t timeout, apu_err_t *err);
+    apr_status_t (*result)(apr_pool_t *pool, apr_ldap_t *ldap,
+                           apr_interval_time_t timeout, apu_err_t *err);
+    apr_status_t (*poll)(apr_pool_t *pool, apr_ldap_t *ldap, apr_pollcb_t *poll,
+                         apr_interval_time_t timeout, apu_err_t *err);
+    apr_status_t (*bind)(apr_pool_t *pool, apr_ldap_t *ldap,
+                         const char *mech, apr_ldap_bind_interact_cb *interact_cb,
+                         void *interact_ctx, apr_interval_time_t timeout,
+                         apr_ldap_bind_cb bind_cb, void *bind_ctx,
+                         apu_err_t *err);
+    apr_status_t (*compare)(apr_pool_t *pool, apr_ldap_t *ldap,
+                            const char *dn, const char *attr,
+                            const apr_buffer_t *bval,
+                            apr_ldap_control_t **serverctrls,
+                            apr_ldap_control_t **clientctrls,
+                            apr_interval_time_t timeout,
+                            apr_ldap_compare_cb compare_cb, void *ctx, apu_err_t *err);
+    apr_status_t (*search)(apr_pool_t *pool, apr_ldap_t *ldap, const char *dn,
+                           apr_ldap_search_scope_e scope, const char *filter,
+                           const char **attrs, apr_ldap_switch_e attrsonly,
+                           apr_ldap_control_t **serverctrls,
+                           apr_ldap_control_t **clientctrls,
+                           apr_interval_time_t timeout, apr_ssize_t sizelimit,
+                           apr_ldap_search_result_cb search_result_cb,          
+                           apr_ldap_search_entry_cb search_entry_cb,                                          
+                           void *search_ctx, apu_err_t *err);
+    apr_status_t (*unbind)(apr_ldap_t *ldap, apr_ldap_control_t **serverctrls,
+                           apr_ldap_control_t **clientctrls, apu_err_t *err);
+};
+
+#endif /* APR_HAVE_MODULAR_DSO */
+
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+

Propchange: apr/apr/trunk/include/private/apr_ldap_internal.h
------------------------------------------------------------------------------
    svn:eol-style = native



Re: svn commit: r1917094 [1/3] - in /apr/apr/trunk: ./ build/ docs/ include/ include/private/ ldap/ misc/unix/ test/

Posted by Ruediger Pluem <rp...@apache.org>.

On 4/18/24 9:32 AM, minfrin@apache.org wrote:
> Author: minfrin
> Date: Thu Apr 18 07:32:13 2024
> New Revision: 1917094
> 
> URL: http://svn.apache.org/viewvc?rev=1917094&view=rev
> Log:
> apr_ldap: Add the new APR LDAP API.
> 
> - Async API, can be used safely in event driven code.
> - Requests are tied into a pool lifetime, with abandon if the pool is
>   cleaned early.
> - Initial support for SASL bind, compare and search.
> - Backportable to apr-util v1.7.
> - Test case with example implementation.
> - Unmaintained Mozilla/Netware API support removed.
> - Rebind removed pending async re-implementation.
> - Doxygen docs.
> 
> Added:
>     apr/apr/trunk/build/ldap.m4
>     apr/apr/trunk/include/private/apr_ldap_internal.h   (with props)
>     apr/apr/trunk/ldap/
>     apr/apr/trunk/ldap/apr_ldap.c   (with props)
>     apr/apr/trunk/ldap/apr_ldap_stub.c   (with props)
>     apr/apr/trunk/ldap/apr_ldap_url.c   (with props)
> Modified:
>     apr/apr/trunk/CHANGES
>     apr/apr/trunk/CMakeLists.txt
>     apr/apr/trunk/Makefile.in
>     apr/apr/trunk/build.conf
>     apr/apr/trunk/build/dso.m4
>     apr/apr/trunk/configure.in
>     apr/apr/trunk/docs/doxygen.conf
>     apr/apr/trunk/include/apr.h.in
>     apr/apr/trunk/include/apr.hnw
>     apr/apr/trunk/include/apr.hw
>     apr/apr/trunk/include/apr.hwc
>     apr/apr/trunk/include/apu_errno.h
>     apr/apr/trunk/misc/unix/errorcodes.c
>     apr/apr/trunk/test/Makefile.in
>     apr/apr/trunk/test/Makefile.win
>     apr/apr/trunk/test/abts_tests.h
>     apr/apr/trunk/test/testutil.h
> 

This causes httpd trunk to fail compile against apr trunk even when I apply the following patch to

include/util_ldap.h

Index: include/util_ldap.h
===================================================================
--- include/util_ldap.h	(revision 1920017)
+++ include/util_ldap.h	(working copy)
@@ -29,12 +29,7 @@
 #include "apr_tables.h"
 #include "apr_time.h"
 #include "apr_version.h"
-#if APR_MAJOR_VERSION < 2
-/* The LDAP API is currently only present in APR 1.x */
 #include "apr_ldap.h"
-#else
-#define APR_HAS_LDAP 0
-#endif

 #if APR_HAS_SHARED_MEMORY
 #include "apr_rmm.h"


In file included from exports.c:55:
/usr/src/apache/httpd-trunk/include/util_ldap.h:94:11: error: ‘LDAP_DEREF_NEVER’ undeclared here (not in a function); did you mean
‘APR_LDAP_DEREF_NEVER’?
     never=LDAP_DEREF_NEVER,
           ^~~~~~~~~~~~~~~~
           APR_LDAP_DEREF_NEVER
/usr/src/apache/httpd-trunk/include/util_ldap.h:95:15: error: ‘LDAP_DEREF_SEARCHING’ undeclared here (not in a function); did you
mean ‘APR_LDAP_DEREF_SEARCHING’?
     searching=LDAP_DEREF_SEARCHING,
               ^~~~~~~~~~~~~~~~~~~~
               APR_LDAP_DEREF_SEARCHING
/usr/src/apache/httpd-trunk/include/util_ldap.h:96:13: error: ‘LDAP_DEREF_FINDING’ undeclared here (not in a function); did you
mean ‘APR_LDAP_DEREF_FINDING’?
     finding=LDAP_DEREF_FINDING,
             ^~~~~~~~~~~~~~~~~~
             APR_LDAP_DEREF_FINDING
/usr/src/apache/httpd-trunk/include/util_ldap.h:97:12: error: ‘LDAP_DEREF_ALWAYS’ undeclared here (not in a function); did you
mean ‘APR_LDAP_DEREF_ALWAYS’?
     always=LDAP_DEREF_ALWAYS
            ^~~~~~~~~~~~~~~~~
            APR_LDAP_DEREF_ALWAYS
/usr/src/apache/httpd-trunk/include/util_ldap.h:102:5: error: unknown type name ‘LDAP’
     LDAP *ldap;
     ^~~~
make[2]: *** [/usr/src/apache/httpd-trunk/build/rules.mk:207: exports.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/usr/src/apache/httpd-trunk/build/rules.mk:75: all-recursive] Error 1
make: *** [/usr/src/apache/httpd-trunk/build/rules.mk:75: all-recursive] Error 1
In file included from exports.c:55:
/usr/src/apache/httpd-trunk/include/util_ldap.h:94:11: error: ‘LDAP_DEREF_NEVER’ undeclared here (not in a function); did you mean
‘APR_LDAP_DEREF_NEVER’?
     never=LDAP_DEREF_NEVER,
           ^~~~~~~~~~~~~~~~
           APR_LDAP_DEREF_NEVER
/usr/src/apache/httpd-trunk/include/util_ldap.h:95:15: error: ‘LDAP_DEREF_SEARCHING’ undeclared here (not in a function); did you
mean ‘APR_LDAP_DEREF_SEARCHING’?
     searching=LDAP_DEREF_SEARCHING,
               ^~~~~~~~~~~~~~~~~~~~
               APR_LDAP_DEREF_SEARCHING
/usr/src/apache/httpd-trunk/include/util_ldap.h:96:13: error: ‘LDAP_DEREF_FINDING’ undeclared here (not in a function); did you
mean ‘APR_LDAP_DEREF_FINDING’?
     finding=LDAP_DEREF_FINDING,
             ^~~~~~~~~~~~~~~~~~
             APR_LDAP_DEREF_FINDING
/usr/src/apache/httpd-trunk/include/util_ldap.h:97:12: error: ‘LDAP_DEREF_ALWAYS’ undeclared here (not in a function); did you
mean ‘APR_LDAP_DEREF_ALWAYS’?
     always=LDAP_DEREF_ALWAYS
            ^~~~~~~~~~~~~~~~~
            APR_LDAP_DEREF_ALWAYS
/usr/src/apache/httpd-trunk/include/util_ldap.h:102:5: error: unknown type name ‘LDAP’
     LDAP *ldap;
     ^~~~
make[2]: *** [/usr/src/apache/httpd-trunk/build/rules.mk:207: exports.lo] Error 1
make[1]: *** [/usr/src/apache/httpd-trunk/build/rules.mk:75: install-recursive] Error 1
make: *** [/usr/src/apache/httpd-trunk/build/rules.mk:75: install-recursive] Error 1


Regards

Rüdiger


Re: svn commit: r1917094 [1/3] - in /apr/apr/trunk: ./ build/ docs/ include/ include/private/ ldap/ misc/unix/ test/

Posted by Ruediger Pluem <rp...@apache.org>.

On 4/18/24 9:32 AM, minfrin@apache.org wrote:
> Author: minfrin
> Date: Thu Apr 18 07:32:13 2024
> New Revision: 1917094
> 
> URL: http://svn.apache.org/viewvc?rev=1917094&view=rev
> Log:
> apr_ldap: Add the new APR LDAP API.
> 
> - Async API, can be used safely in event driven code.
> - Requests are tied into a pool lifetime, with abandon if the pool is
>   cleaned early.
> - Initial support for SASL bind, compare and search.
> - Backportable to apr-util v1.7.
> - Test case with example implementation.
> - Unmaintained Mozilla/Netware API support removed.
> - Rebind removed pending async re-implementation.
> - Doxygen docs.
> 
> Added:
>     apr/apr/trunk/build/ldap.m4
>     apr/apr/trunk/include/private/apr_ldap_internal.h   (with props)
>     apr/apr/trunk/ldap/
>     apr/apr/trunk/ldap/apr_ldap.c   (with props)
>     apr/apr/trunk/ldap/apr_ldap_stub.c   (with props)
>     apr/apr/trunk/ldap/apr_ldap_url.c   (with props)
> Modified:
>     apr/apr/trunk/CHANGES
>     apr/apr/trunk/CMakeLists.txt
>     apr/apr/trunk/Makefile.in
>     apr/apr/trunk/build.conf
>     apr/apr/trunk/build/dso.m4
>     apr/apr/trunk/configure.in
>     apr/apr/trunk/docs/doxygen.conf
>     apr/apr/trunk/include/apr.h.in
>     apr/apr/trunk/include/apr.hnw
>     apr/apr/trunk/include/apr.hw
>     apr/apr/trunk/include/apr.hwc
>     apr/apr/trunk/include/apu_errno.h
>     apr/apr/trunk/misc/unix/errorcodes.c
>     apr/apr/trunk/test/Makefile.in
>     apr/apr/trunk/test/Makefile.win
>     apr/apr/trunk/test/abts_tests.h
>     apr/apr/trunk/test/testutil.h
> 

> 
> Modified: apr/apr/trunk/configure.in
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/configure.in?rev=1917094&r1=1917093&r2=1917094&view=diff
> ==============================================================================
> --- apr/apr/trunk/configure.in (original)
> +++ apr/apr/trunk/configure.in Thu Apr 18 07:32:13 2024
> @@ -34,6 +34,7 @@ sinclude(build/dbm.m4)
>  sinclude(build/dbd.m4)
>  sinclude(build/dso.m4)
>  sinclude(build/iconv.m4)
> +sinclude(build/ldap.m4)
>  
>  sinclude(build/ax_prog_cc_for_build.m4)
>  
> @@ -3150,6 +3151,9 @@ APU_CHECK_DBD_SQLITE2
>  APU_CHECK_DBD_ORACLE
>  APU_CHECK_DBD_ODBC
>  
> +dnl Find LDAP backend
> +APU_FIND_LDAP
> +
>  dnl select an XML parser
>  APU_FIND_XML
>  
> @@ -3174,6 +3178,8 @@ if test "$crypt_r" = "1"; then
>    APU_CHECK_CRYPT_R_STYLE
>  fi
>  
> +AC_CHECK_HEADERS([sasl.h sasl/sasl.h])
> +

Why do we check for sasl.h again (besides in ldap.m4) and do so uncoditionally?

>  APRUTIL_LIBNAME="aprutil${libsuffix}"
>  AC_SUBST(APRUTIL_LIBNAME)
>  
> 

Regards

Rüdiger


Re: svn commit: r1917094 [1/3] - in /apr/apr/trunk: ./ build/ docs/ include/ include/private/ ldap/ misc/unix/ test/

Posted by Ruediger Pluem <rp...@apache.org>.

On 4/18/24 9:32 AM, minfrin@apache.org wrote:
> Author: minfrin
> Date: Thu Apr 18 07:32:13 2024
> New Revision: 1917094
> 
> URL: http://svn.apache.org/viewvc?rev=1917094&view=rev
> Log:
> apr_ldap: Add the new APR LDAP API.
> 
> - Async API, can be used safely in event driven code.
> - Requests are tied into a pool lifetime, with abandon if the pool is
>   cleaned early.
> - Initial support for SASL bind, compare and search.
> - Backportable to apr-util v1.7.
> - Test case with example implementation.
> - Unmaintained Mozilla/Netware API support removed.
> - Rebind removed pending async re-implementation.
> - Doxygen docs.
> 
> Added:
>     apr/apr/trunk/build/ldap.m4
>     apr/apr/trunk/include/private/apr_ldap_internal.h   (with props)
>     apr/apr/trunk/ldap/
>     apr/apr/trunk/ldap/apr_ldap.c   (with props)
>     apr/apr/trunk/ldap/apr_ldap_stub.c   (with props)
>     apr/apr/trunk/ldap/apr_ldap_url.c   (with props)
> Modified:
>     apr/apr/trunk/CHANGES
>     apr/apr/trunk/CMakeLists.txt
>     apr/apr/trunk/Makefile.in
>     apr/apr/trunk/build.conf
>     apr/apr/trunk/build/dso.m4
>     apr/apr/trunk/configure.in
>     apr/apr/trunk/docs/doxygen.conf
>     apr/apr/trunk/include/apr.h.in
>     apr/apr/trunk/include/apr.hnw
>     apr/apr/trunk/include/apr.hw
>     apr/apr/trunk/include/apr.hwc
>     apr/apr/trunk/include/apu_errno.h
>     apr/apr/trunk/misc/unix/errorcodes.c
>     apr/apr/trunk/test/Makefile.in
>     apr/apr/trunk/test/Makefile.win
>     apr/apr/trunk/test/abts_tests.h
>     apr/apr/trunk/test/testutil.h
> 

> Added: apr/apr/trunk/build/ldap.m4
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/ldap.m4?rev=1917094&view=auto
> ==============================================================================
> --- apr/apr/trunk/build/ldap.m4 (added)
> +++ apr/apr/trunk/build/ldap.m4 Thu Apr 18 07:32:13 2024

> +  ])
> +
> +AC_CHECK_HEADERS([sasl.h sasl/sasl.h])
> +
> +AC_SUBST(ldap_h)
> +AC_SUBST(lber_h)
> +AC_SUBST(apu_have_ldap)
> +AC_SUBST(apu_have_ldap_openldap)
> +AC_SUBST(apu_have_ldap_solaris)
> +AC_SUBST(apu_have_ldap_microsoft)
> +AC_SUBST(apu_have_ldap_tivoli)
> +AC_SUBST(apu_have_ldap_zos)
> +AC_SUBST(apu_have_ldap_other)
> +AC_SUBST(LDADD_ldap)
> +
> +])
> +
> +
> 
> Modified: apr/apr/trunk/configure.in
> URL: http://svn.apache.org/viewvc/apr/apr/trunk/configure.in?rev=1917094&r1=1917093&r2=1917094&view=diff
> ==============================================================================
> --- apr/apr/trunk/configure.in (original)
> +++ apr/apr/trunk/configure.in Thu Apr 18 07:32:13 2024
> @@ -34,6 +34,7 @@ sinclude(build/dbm.m4)
>  sinclude(build/dbd.m4)
>  sinclude(build/dso.m4)
>  sinclude(build/iconv.m4)
> +sinclude(build/ldap.m4)
>  
>  sinclude(build/ax_prog_cc_for_build.m4)
>  
> @@ -3150,6 +3151,9 @@ APU_CHECK_DBD_SQLITE2
>  APU_CHECK_DBD_ORACLE
>  APU_CHECK_DBD_ODBC
>  
> +dnl Find LDAP backend
> +APU_FIND_LDAP
> +
>  dnl select an XML parser
>  APU_FIND_XML
>  
> @@ -3174,6 +3178,8 @@ if test "$crypt_r" = "1"; then
>    APU_CHECK_CRYPT_R_STYLE
>  fi
>  
> +AC_CHECK_HEADERS([sasl.h sasl/sasl.h])
> +

Why do we need AC_CHECK_HEADERS twice? Here and in ldap.m4

>  APRUTIL_LIBNAME="aprutil${libsuffix}"
>  AC_SUBST(APRUTIL_LIBNAME)
>  
> 

Regards

Rüdiger