Author: minfrin
Date: Tue Mar 11 13:27:42 2025
New Revision: 1924295
URL: http://svn.apache.org/viewvc?rev=1924295&view=rev
Log:
apr_ldap: Add write capability to the LDAP API. Support for
add, modify, rename, delete, and extended operations.
Modified:
apr/apr/trunk/CHANGES
apr/apr/trunk/CMakeLists.txt
apr/apr/trunk/build/ldap.m4
apr/apr/trunk/include/apr_ldap.h
apr/apr/trunk/include/apu_errno.h
apr/apr/trunk/include/private/apr_ldap_internal.h
apr/apr/trunk/include/private/apu_ldap_internal.h.in
apr/apr/trunk/include/private/apu_ldap_internal.hw
apr/apr/trunk/ldap/apr_ldap.c
apr/apr/trunk/ldap/apr_ldap_stub.c
apr/apr/trunk/misc/unix/errorcodes.c
apr/apr/trunk/test/testldap.c
Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=1924295&r1=1924294&r2=1924295&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Tue Mar 11 13:27:42 2025
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes for APR 2.0.0
+ *) apr_ldap: Add write capability to the LDAP API. Support for
+ add, modify, rename, delete, and extended operations.
+ [Graham Leggett]
+
*) apr_ldap: Explicitly detect the case where OpenLDAP has been
installed with SASL support, but the SASL headers are missing.
[Graham Leggett]
Modified: apr/apr/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CMakeLists.txt?rev=1924295&r1=1924294&r2=1924295&view=diff
==============================================================================
--- apr/apr/trunk/CMakeLists.txt (original)
+++ apr/apr/trunk/CMakeLists.txt Tue Mar 11 13:27:42 2025
@@ -54,6 +54,7 @@ option(APU_HAVE_SQLITE3 "Build SQLit
option(APU_HAVE_PGSQL "Build PostgreSQL DBD driver" OFF)
option(APU_HAVE_CRYPTO "Crypto support" OFF)
option(APU_HAVE_ICONV "Xlate support" OFF)
+option(APR_HAS_LDAP "LDAP support" ON)
option(APR_HAVE_IPV6 "IPv6 support" ON)
option(INSTALL_PDB "Install .pdb files (if generated)" ON)
option(APR_BUILD_TESTAPR "Build the test suite" ON)
@@ -112,6 +113,11 @@ if(APU_HAVE_PGSQL)
find_package(PostgreSQL REQUIRED)
endif()
+set(LDAP_LIBRARIES)
+if(APR_HAS_LDAP)
+ set(LDAP_LIBRARIES wldap32)
+endif()
+
if(APR_POOL_DEBUG)
add_compile_definitions(APR_POOL_DEBUG=1)
endif()
@@ -132,6 +138,9 @@ string(REGEX REPLACE ".*#define APR_PATC
configure_file(include/apr.hwc
${PROJECT_BINARY_DIR}/apr.h)
# "COPYONLY" just because anything else isn't implemented ;)
+configure_file(include/private/apu_ldap_internal.hw
+ ${PROJECT_BINARY_DIR}/apu_ldap_internal.h
+ COPYONLY)
configure_file(include/private/apu_select_dbm.hw
${PROJECT_BINARY_DIR}/apu_select_dbm.h
COPYONLY)
@@ -392,6 +401,10 @@ set(APR_SOURCES
xml/apr_xml_xmllite.c
)
+if(APR_HAS_LDAP)
+ set(APR_SOURCES ${APR_SOURCES} ldap/apr_ldap_stub.c ldap/apr_ldap_url.c)
+endif()
+
# Sources and libraries for APR builtin drivers. Used when APR_MODULAR_DSO=OFF.
set(APR_EXTRA_SOURCES)
set(APR_EXTRA_LIBRARIES)
@@ -512,6 +525,14 @@ if(APU_HAVE_CRYPTO)
"OpenSSL::Crypto")
endif()
+IF(APR_HAS_LDAP)
+ ADD_APR_MODULE(
+ apr_ldap-2 "apr_ldap"
+ "ldap/apr_ldap.c"
+ ${LDAP_LIBRARIES}
+ )
+ENDIF()
+
if(APU_HAVE_ODBC)
list(APPEND dbd_drivers odbc)
@@ -770,6 +791,7 @@ message(STATUS " IPv6 .................
message(STATUS " DBD ODBC driver ................. : ${APU_HAVE_ODBC}")
message(STATUS " DBD SQLite3 driver .............. : ${APU_HAVE_SQLITE3}")
message(STATUS " DBD PostgreSQL .................. : ${APU_HAVE_PGSQL}")
+message(STATUS " LDAP driver ..................... : ${APR_HAS_LDAP}")
message(STATUS " XML backend ..................... : ${APR_XML_BACKEND}")
message(STATUS " Have Crypto ..................... : ${APU_HAVE_CRYPTO}")
message(STATUS " Have Iconv ...................... : ${APU_HAVE_ICONV}")
Modified: apr/apr/trunk/build/ldap.m4
URL: http://svn.apache.org/viewvc/apr/apr/trunk/build/ldap.m4?rev=1924295&r1=1924294&r2=1924295&view=diff
==============================================================================
--- apr/apr/trunk/build/ldap.m4 (original)
+++ apr/apr/trunk/build/ldap.m4 Tue Mar 11 13:27:42 2025
@@ -94,6 +94,7 @@ AC_DEFUN([APU_FIND_LDAPLIB], [
[
LDADD_ldap_found="-l${ldaplib} ${extralib}"
AC_CHECK_LIB(${ldaplib}, ldap_sasl_interactive_bind, apu_have_ldap_sasl_interactive_bind="1", , ${extralib})
+ AC_CHECK_LIB(${ldaplib}, ldap_connect, apu_have_ldap_connect="1", , ${extralib})
apu_have_ldap="1";
], , ${extralib})
fi
@@ -108,6 +109,7 @@ AC_DEFUN([APU_FIND_LDAP], [
echo $ac_n "${nl}checking for ldap support..."
apu_have_ldap_sasl_interactive_bind="0"
+apu_have_ldap_connect="0"
apu_have_ldap="0";
apu_have_ldap_openldap="0"
apu_have_ldap_microsoft="0"
@@ -227,6 +229,7 @@ AC_CHECK_HEADERS([sasl.h sasl/sasl.h])
AC_SUBST(ldap_h)
AC_SUBST(lber_h)
AC_SUBST(apu_have_ldap_sasl_interactive_bind)
+AC_SUBST(apu_have_ldap_connect)
AC_SUBST(apu_have_ldap)
AC_SUBST(apu_have_ldap_openldap)
AC_SUBST(apu_have_ldap_solaris)
Modified: apr/apr/trunk/include/apr_ldap.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_ldap.h?rev=1924295&r1=1924294&r2=1924295&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_ldap.h (original)
+++ apr/apr/trunk/include/apr_ldap.h Tue Mar 11 13:27:42 2025
@@ -81,6 +81,7 @@
#include "apu_errno.h"
#include "apr_escape.h"
#include "apr_buffer.h"
+#include "apr_hash.h"
/*
* LDAP URL handling
@@ -238,6 +239,11 @@ APR_DECLARE(int) apr_ldap_url_parse(apr_
#define apr_ldap_bind apr__ldap_bind
#define apr_ldap_compare apr__ldap_compare
#define apr_ldap_search apr__ldap_search
+#define apr_ldap_add apr__ldap_add
+#define apr_ldap_modify apr__ldap_modify
+#define apr_ldap_delete apr__ldap_delete
+#define apr_ldap_rename apr__ldap_rename
+#define apr_ldap_extended apr__ldap_extended
#define apr_ldap_unbind apr__ldap_unbind
#define APU_DECLARE_LDAP(type) type
@@ -914,6 +920,221 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_
apu_err_t *result_err)
__attribute__((nonnull(1,5)));
+
+/**
+ * LDAP control types.
+ *
+ * This enumeration represents the controls processed by
+ * the library.
+ *
+ * Most controls are simple, consisting of an OID and a
+ * binary or text value. These controls need no special
+ * processing.
+ *
+ * Some controls have values consisting of BER structures.
+ * For convenience, three such controls are understood by
+ * the library, paged control, sort control, and the vlv
+ * control.
+ *
+ * Controls not specifically recognised can be created
+ * using APR_LDAP_CONTROL_OID and the binary control value,
+ * and will be parsed to APR_LDAP_CONTROL_OID and the binary
+ * control value.
+ */
+typedef enum {
+ /** Control specified by OID */
+ APR_LDAP_CONTROL_OID = 0,
+ /** Sort request control RFC 2891 */
+ APR_LDAP_CONTROL_SORT_REQUEST = 1,
+ /** Sort response control RFC 2891 */
+ APR_LDAP_CONTROL_SORT_RESPONSE = 2,
+ /** Page request control RFC 2696 */
+ APR_LDAP_CONTROL_PAGE_REQUEST = 3,
+ /** Page response control RFC 2696 */
+ APR_LDAP_CONTROL_PAGE_RESPONSE = 4,
+ /** VLV request control draft-ietf-ldapext-ldapv3-vlv-09 */
+ APR_LDAP_CONTROL_VLV_REQUEST = 5,
+ /** VLV response control draft-ietf-ldapext-ldapv3-vlv-09 */
+ APR_LDAP_CONTROL_VLV_RESPONSE = 6,
+} apr_ldap_control_e;
+
+
+/**
+ * RFC 2696 Paged control OID.
+ */
+#define APR_LDAP_CONTROL_PAGE_OID "1.2.840.113556.1.4.319" /* RFC 2696 */
+
+/**
+ * RFC 2891 Sort request control OID.
+ */
+#define APR_LDAP_CONTROL_SORT_REQUEST_OID "1.2.840.113556.1.4.473" /* RFC 2891 */
+
+/**
+ * RFC 2891 Sort response control OID.
+ */
+#define APR_LDAP_CONTROL_SORT_RESPONSE_OID "1.2.840.113556.1.4.474" /* RFC 2891 */
+
+/**
+ * VLV request control OID.
+ */
+#define APR_LDAP_CONTROL_VLV_REQUEST_OID "2.16.840.1.113730.3.4.9"
+
+/**
+ * VLV response control OID.
+ */
+#define APR_LDAP_CONTROL_VLV_RESPONSE_OID "2.16.840.1.113730.3.4.10"
+
+/**
+ * Control specified by OID and value.
+ *
+ * All controls unrecognised by this API can be parsed
+ * and returned as this type.
+ */
+typedef struct apr_ldap_control_oid_t {
+ /** The OID of the control */
+ const char *oid;
+ /** The raw value of the control */
+ apr_buffer_t val;
+} apr_ldap_control_oid_t;
+
+/**
+ * Sort request control RFC 2891.
+ */
+typedef struct apr_ldap_control_sortrequest_t {
+ /** The keys to sort by */
+ apr_array_header_t *keys;
+} apr_ldap_control_sortrequest_t;
+
+typedef enum {
+ /** Sort forwards */
+ APR_LDAP_CONTROL_SORT_FORWARD = 0,
+ /** Sort backwards */
+ APR_LDAP_CONTROL_SORT_REVERSE = 1,
+} apr_ldap_control_sortkey_e;
+
+/**
+ * Sort key list.
+ */
+typedef struct apr_ldap_control_sortkey_t {
+ /** The attribute to sort by */
+ const char *attribute;
+ /** The ordering rule to use */
+ const char *order;
+ /** Reverse or forward order */
+ apr_ldap_control_sortkey_e direction;
+} apr_ldap_control_sortkey_t;
+
+/**
+ * Sort Response Control RFC 2891.
+ */
+typedef struct apr_ldap_control_sortresponse_t {
+ /** The attribute involved in a sort failure */
+ const char *attribute;
+ /** Result of the sort */
+ apr_status_t result;
+} apr_ldap_control_sortresponse_t;
+
+/**
+ * Page request control RFC 2696.
+ */
+typedef struct apr_ldap_control_pagerequest_t {
+ /** The page size */
+ apr_size_t size;
+ /** The opaque cookie identifing this page */
+ apr_buffer_t cookie;
+} apr_ldap_control_pagerequest_t;
+
+/**
+ * Page Response Control RFC 2696.
+ */
+typedef struct apr_ldap_control_pageresponse_t {
+ /** The total count */
+ apr_size_t count;
+ /** The opaque cookie identifing this page */
+ apr_buffer_t cookie;
+} apr_ldap_control_pageresponse_t;
+
+/**
+ * VLV request control draft-ietf-ldapext-ldapv3-vlv-09.
+ */
+typedef struct apr_ldap_control_vlvrequest_t {
+ /** Before count */
+ apr_size_t before;
+ /** After count */
+ apr_size_t after;
+ /** Offset */
+ apr_size_t offset;
+ /** Count */
+ apr_size_t count;
+ /** Optional search value as an alternative to offset */
+ apr_buffer_t attrvalue;
+ /** The opaque cookie identifing this vlv result */
+ apr_buffer_t context;
+} apr_ldap_control_vlvrequest_t;
+
+/**
+ * VLV Response Control draft-ietf-ldapext-ldapv3-vlv-09.
+ */
+typedef struct apr_ldap_control_vlvresponse_t {
+ /** Offset */
+ apr_size_t offset;
+ /** Count */
+ apr_size_t count;
+ /** Result of the sort */
+ apr_status_t result;
+ /** The opaque cookie identifing this page */
+ apr_buffer_t context;
+} apr_ldap_control_vlvresponse_t;
+
+
+
+
+/**
+ * LDAP parsed control structures.
+ *
+ * Use this structure to pass or receive the parameters
+ * required when creating or parsing a control.
+ *
+ * Unrecognised controls can be created or parsed using the
+ * APR_LDAP_CONTROL_OID type and a raw binary value.
+ *
+ * @see apr_ldap_bind_cb
+ * @see apr_ldap_compare_cb
+ * @see apr_ldap_search_result_cb
+ * @see apr_ldap_compare
+ * @see apr_ldap_search
+ * @see apr_ldap_add
+ * @see apr_ldap_modify
+ * @see apr_ldap_rename
+ * @see apr_ldap_delete
+ * @see apr_ldap_extended
+ */
+typedef struct apr_ldap_control_t {
+ /** The type of the control. */
+ apr_ldap_control_e type;
+ /** Is the control critical */
+ int critical;
+ /** Control specified by OID and value */
+ apr_ldap_control_oid_t oid;
+ /** Details of each control, based on the control type. */
+ union {
+ /** Sort request control */
+ apr_ldap_control_sortrequest_t sortrq;
+ /** Sort response control */
+ apr_ldap_control_sortresponse_t sortrs;
+ /** Page request control */
+ apr_ldap_control_pagerequest_t pagerq;
+ /** Page response control */
+ apr_ldap_control_pageresponse_t pagers;
+ /** VLV request control */
+ apr_ldap_control_vlvrequest_t vlvrq;
+ /** VLV response control */
+ apr_ldap_control_vlvresponse_t vlvrs;
+ } c;
+} apr_ldap_control_t;
+
+
+
/**
* LDAP interaction identifiers during LDAP binding
*
@@ -987,20 +1208,6 @@ typedef apr_status_t (apr_ldap_rebind_pr
/**
- * LDAP Control structure
- *
- * @see apr_ldap_bind_cb
- * @see apr_ldap_compare_cb
- * @see apr_ldap_search_result_cb
- * @see apr_ldap_compare
- * @see apr_ldap_search
- */
-typedef struct apr_ldap_control_t apr_ldap_control_t;
-
-
-
-
-/**
* APR LDAP connect function.
*
* This function makes an attempt to connect to the server initialised
@@ -1353,8 +1560,8 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_
const char *dn,
const char *attr,
const apr_buffer_t *val,
- apr_ldap_control_t **serverctrls,
- apr_ldap_control_t **clientctrls,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
apr_interval_time_t timeout,
apr_ldap_compare_cb compare_cb, void *ctx,
apu_err_t *err)
@@ -1403,10 +1610,36 @@ typedef enum {
*/
typedef apr_status_t (*apr_ldap_search_result_cb)(apr_ldap_t *ldap, apr_status_t status,
apr_size_t count, const char *matcheddn,
- apr_ldap_control_t **serverctrls,
+ apr_hash_t *serverctrls,
void *ctx, apu_err_t *err);
/**
+ * Search entry attribute value callback structure.
+ *
+ * The callback is passed a pointer to the following structure
+ * containing the current state of the attribute values being
+ * returned.
+ *
+ * @see apr_ldap_search
+ */
+typedef struct apr_ldap_search_entry_t {
+ /** Total number of attributes */
+ apr_size_t nattrs;
+ /** Attribute index - counts up for each attribute returned */
+ apr_size_t aidx;
+ /** Attribute */
+ const char *attr;
+ /** Total number of values */
+ apr_size_t nvals;
+ /** Value index - counts up for each value returned */
+ apr_size_t vidx;
+ /** Value */
+ apr_buffer_t val;
+ /** Flags */
+ int flags;
+} apr_ldap_search_entry_t;
+
+/**
* Callback to receive the entries of a search operation.
*
* This callback is fired once for every attribute and value combination,
@@ -1420,9 +1653,8 @@ typedef apr_status_t (*apr_ldap_search_r
* @see apr_ldap_result
*/
typedef apr_status_t (*apr_ldap_search_entry_cb)(apr_ldap_t *ldap, const char *dn,
- int eidx, int nattrs, int aidx,
- const char *attr, int nvals,
- int vidx, apr_buffer_t *val, int binary,
+ apr_size_t eidx,
+ apr_ldap_search_entry_t *entry,
void *ctx, apu_err_t *err);
@@ -1494,8 +1726,8 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_
const char *filter,
const char **attrs,
apr_ldap_switch_e attrsonly,
- apr_ldap_control_t **serverctrls,
- apr_ldap_control_t **clientctrls,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
apr_interval_time_t timeout,
apr_ssize_t sizelimit,
apr_ldap_search_result_cb search_result_cb,
@@ -1505,6 +1737,485 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_
__attribute__((nonnull(1,2,3,15)));
/**
+ * Attribute-value pair.
+ *
+ * An array of pairs is passed to apr_ldap_add(), and
+ * a pair forms part of the apr_ldap_modify_t that is
+ * passed to apr_ldap_modify().
+ *
+ * @see apr_ldap_add
+ * @see apr_ldap_modify
+ */
+typedef struct apr_ldap_pair_t {
+ /** Attribute to perform the operation on */
+ const char *attr;
+ /** Array of apr_buffer_t values */
+ apr_array_header_t *vals;
+} apr_ldap_pair_t;
+
+/**
+ * Callback to receive the results of an add operation.
+ *
+ * When an addition is successful, this function is called with a status of
+ * APR_SUCCESS.
+ *
+ * If the addition fails, status will carry the error code, and err will return
+ * the human readable details.
+ *
+ * If the underlying LDAP connection has failed, status will return details
+ * of the error, allowing an opportunity to clean up.
+ *
+ * When complete, return APR_SUCCESS to indicate you want to continue, or
+ * a different code if you want the event loop to give up. This code will
+ * be returned from apr_ldap_result().
+ *
+ * If this callback was called during a pool cleanup, the return value is
+ * ignored.
+ * @see apr_ldap_add
+ * @see apr_ldap_result
+ */
+typedef apr_status_t (*apr_ldap_add_cb)(apr_ldap_t *ldap, apr_status_t status,
+ const char *matcheddn,
+ apr_ldap_control_t **serverctrls,
+ void *ctx, apu_err_t *err);
+
+
+/**
+ * APR LDAP add function
+ *
+ * This function allows addition of an entry containing attributes and values
+ * described by the given distinguished name stored in the directory.
+ *
+ * Additions are attempted asynchronously. For non blocking
+ * behaviour, this function must be called after the underlying
+ * socket has indicated that it is ready to write.
+ *
+ * In the absence of an error, apr_ldap_add will return
+ * APR_WANT_READ or APR_WANT_WRITE to indicate that the next message
+ * in the conversation be retrieved using apr_ldap_result().
+ *
+ * The outcome of the addition will be retrieved and handled by
+ * the apr_ldap_process() function, and the outcome is passed to the
+ * apr_ldap_add_cb provided.
+ *
+ * @param pool The pool that keeps track of the lifetime of the add conversation.
+ * If this pool is cleaned up, the add conversation will be gracefully
+ * abandoned without affecting other LDAP requests in progress. This pool need
+ * not have any relationship with the LDAP connection pool.
+ * @param ldap The ldap handle
+ * @param dn The distinguished named of the object to add.
+ * @param adds Array of apr_ldap_pair_t attributes and values.
+ * @param serverctrls NULL terminated array of server controls.
+ * @param clientctrls NULL terminated array of client controls.
+ * @param timeout The timeout to use for writes.
+ * @param add_cb The addition result callback function. When the add process has
+ * completed the success or failure of the addition is returned here. The callback
+ * is triggered from inside apr_ldap_process() so that it is safe to write the
+ * next LDAP request.
+ * @param ctx Context passed to the add callback.
+ * @param err Error structure for reporting detailed results.
+ *
+ * @return APR_WANT_READ means that processing has occurred, and
+ * the message in reply needs to be fetched using apr_ldap_result().
+ * APR_SUCCESS means that the processing is complete, and the addition
+ * has been successful. Other error codes indicate that the addition
+ * was not successful.
+ * @see apr_ldap_add_cb
+ * @see apr_ldap_process
+ * @see apr_ldap_result
+ */
+APU_DECLARE_LDAP(apr_status_t) apr_ldap_add(apr_pool_t *pool,
+ apr_ldap_t *ldap,
+ const char *dn,
+ apr_array_header_t *adds,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_add_cb add_cb, void *ctx,
+ apu_err_t *err)
+ __attribute__((nonnull(1,2,3,4,10)));
+
+
+/**
+ * LDAP modification operations
+ *
+ * @see apr_ldap_modify
+ */
+typedef enum {
+ /** Add an attribute or entry */
+ APR_LDAP_MOD_ADD = 0,
+ /** Remove an attribute or entry */
+ APR_LDAP_MOD_DELETE = 1,
+ /** Replace an attribute or entry */
+ APR_LDAP_MOD_REPLACE = 2,
+ /** Increment an attribute, see RFC4525 */
+ APR_LDAP_MOD_INCREMENT = 3
+} apr_ldap_operation_e;
+
+/**
+ * Modification to be performed by apr_ldap_modify().
+ *
+ * Modifications can take the form of additions, deletions, or
+ * the in place modification or increment of an attribute.
+ *
+ * @see apr_ldap_pair_t
+ * @see apr_ldap_modify
+ */
+typedef struct apr_ldap_modify_t {
+ /** Operation to be performed */
+ apr_ldap_operation_e op;
+ /** Attribute-value pair to perform the operation on */
+ apr_ldap_pair_t pair;
+} apr_ldap_modify_t;
+
+
+/**
+ * Callback to receive the results of a modify operation.
+ *
+ * When a modification is successful, this function is called with a status of
+ * APR_SUCCESS.
+ *
+ * If the modify fails, status will carry the error code, and err will return
+ * the human readable details.
+ *
+ * If the underlying LDAP connection has failed, status will return details
+ * of the error, allowing an opportunity to clean up.
+ *
+ * When complete, return APR_SUCCESS to indicate you want to continue, or
+ * a different code if you want the event loop to give up. This code will
+ * be returned from apr_ldap_result().
+ *
+ * If this callback was called during a pool cleanup, the return value is
+ * ignored.
+ * @see apr_ldap_modify
+ * @see apr_ldap_result
+ */
+typedef apr_status_t (*apr_ldap_modify_cb)(apr_ldap_t *ldap, apr_status_t status,
+ const char *matcheddn,
+ apr_ldap_control_t **serverctrls,
+ void *ctx, apu_err_t *err);
+
+
+
+/**
+ * APR LDAP modify function
+ *
+ * This function allows modification of attributes and values
+ * within an entry described by the given distinguished name stored
+ * in the directory.
+ *
+ * Modifications are attempted asynchronously. For non blocking
+ * behaviour, this function must be called after the underlying
+ * socket has indicated that it is ready to write.
+ *
+ * In the absence of an error, apr_ldap_modify will return
+ * APR_WANT_READ or APR_WANT_WRITE to indicate that the next message
+ * in the conversation be retrieved using apr_ldap_result().
+ *
+ * The outcome of the modification will be retrieved and handled by
+ * the apr_ldap_process() function, and the outcome is passed to the
+ * apr_ldap_modify_cb provided.
+ *
+ * @param pool The pool that keeps track of the lifetime of the modify conversation.
+ * If this pool is cleaned up, the modify conversation will be gracefully
+ * abandoned without affecting other LDAP requests in progress. This pool need
+ * not have any relationship with the LDAP connection pool.
+ * @param ldap The ldap handle
+ * @param dn The distinguished named of the object to modify.
+ * @param mods Array of apr_ldap_modify_t operations.
+ * @param serverctrls NULL terminated array of server controls.
+ * @param clientctrls NULL terminated array of client controls.
+ * @param timeout The timeout to use for writes.
+ * @param modify_cb The modify result callback function. When the modify process has
+ * completed the success or failure of the modification is returned here. The callback
+ * is triggered from inside apr_ldap_process() so that it is safe to write the
+ * next LDAP request.
+ * @param ctx Context passed to the modify callback.
+ * @param err Error structure for reporting detailed results.
+ *
+ * @return APR_WANT_READ means that processing has occurred, and
+ * the message in reply needs to be fetched using apr_ldap_result().
+ * APR_SUCCESS means that the processing is complete, and the modify
+ * has been successful. Other error codes indicate that the modify
+ * was not successful.
+ * @see apr_ldap_modify_cb
+ * @see apr_ldap_process
+ * @see apr_ldap_result
+ */
+APU_DECLARE_LDAP(apr_status_t) apr_ldap_modify(apr_pool_t *pool,
+ apr_ldap_t *ldap,
+ const char *dn,
+ apr_array_header_t *mods,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_modify_cb modify_cb, void *ctx,
+ apu_err_t *err)
+ __attribute__((nonnull(1,2,3,4,10)));
+
+/**
+ * LDAP rename flags
+ *
+ * @see apr_ldap_rename
+ */
+typedef enum {
+ /** No flags */
+ APR_LDAP_RENAME_NONE = 0,
+ /** Delete the old relative distinguished name from the entry */
+ APR_LDAP_RENAME_DELETEOLDRDN = 1,
+} apr_ldap_rename_e;
+
+/**
+ * Callback to receive the results of a rename operation.
+ *
+ * When a rename is successful, this function is called with a status of
+ * APR_SUCCESS.
+ *
+ * If the rename fails, status will carry the error code, and err will return
+ * the human readable details.
+ *
+ * If the underlying LDAP connection has failed, status will return details
+ * of the error, allowing an opportunity to clean up.
+ *
+ * When complete, return APR_SUCCESS to indicate you want to continue, or
+ * a different code if you want the event loop to give up. This code will
+ * be returned from apr_ldap_result().
+ *
+ * If this callback was called during a pool cleanup, the return value is
+ * ignored.
+ * @see apr_ldap_rename
+ * @see apr_ldap_result
+ */
+typedef apr_status_t (*apr_ldap_rename_cb)(apr_ldap_t *ldap, apr_status_t status,
+ const char *matcheddn,
+ apr_ldap_control_t **serverctrls,
+ void *ctx, apu_err_t *err);
+
+
+
+/**
+ * APR LDAP rename function
+ *
+ * This function allows moving or renaming of an entry from the given
+ * distinguished name, to a new relative distinguished name, a new
+ * parent object, or both.
+ *
+ * Renamed are attempted asynchronously. For non blocking
+ * behaviour, this function must be called after the underlying
+ * socket has indicated that it is ready to write.
+ *
+ * In the absence of an error, apr_ldap_rename will return
+ * APR_WANT_READ or APR_WANT_WRITE to indicate that the next message
+ * in the conversation be retrieved using apr_ldap_result().
+ *
+ * The outcome of the deletion will be retrieved and handled by
+ * the apr_ldap_process() function, and the outcome is passed to the
+ * apr_ldap_rename_cb provided.
+ *
+ * @param pool The pool that keeps track of the lifetime of the rename conversation.
+ * If this pool is cleaned up, the rename conversation will be gracefully
+ * abandoned without affecting other LDAP requests in progress. This pool need
+ * not have any relationship with the LDAP connection pool.
+ * @param ldap The ldap handle
+ * @param dn The distinguished named of the object to rename.
+ * @param newrdn The new relative distinguished named of the object.
+ * @param newparent The distinguished named of the parent object to move to.
+ * @param flags If APR_LDAP_RENAME_DELETEOLDRDN is passed, the old RDN in the entry will be removed.
+ * @param serverctrls NULL terminated array of server controls.
+ * @param clientctrls NULL terminated array of client controls.
+ * @param timeout The timeout to use for writes.
+ * @param rename_cb The rename result callback function. When the rename process has
+ * completed the success or failure of the rename is returned here. The callback
+ * is triggered from inside apr_ldap_process() so that it is safe to write the
+ * next LDAP request.
+ * @param ctx Context passed to the rename callback.
+ * @param err Error structure for reporting detailed results.
+ *
+ * @return APR_WANT_READ means that processing has occurred, and
+ * the message in reply needs to be fetched using apr_ldap_result().
+ * APR_SUCCESS means that the processing is complete, and the rename
+ * has been successful. Other error codes indicate that the rename
+ * was not successful.
+ * @see apr_ldap_rename_cb
+ * @see apr_ldap_process
+ * @see apr_ldap_result
+ */
+APU_DECLARE_LDAP(apr_status_t) apr_ldap_rename(apr_pool_t *pool,
+ apr_ldap_t *ldap,
+ const char *dn, const char *newrdn, const char *newparent,
+ apr_ldap_rename_e flags,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_rename_cb rename_cb, void *ctx,
+ apu_err_t *err)
+ __attribute__((nonnull(1,2,3,4,12)));
+
+/**
+ * Callback to receive the results of a delete operation.
+ *
+ * When a deletion is successful, this function is called with a status of
+ * APR_SUCCESS.
+ *
+ * If the delete fails, status will carry the error code, and err will return
+ * the human readable details.
+ *
+ * If the underlying LDAP connection has failed, status will return details
+ * of the error, allowing an opportunity to clean up.
+ *
+ * When complete, return APR_SUCCESS to indicate you want to continue, or
+ * a different code if you want the event loop to give up. This code will
+ * be returned from apr_ldap_result().
+ *
+ * If this callback was called during a pool cleanup, the return value is
+ * ignored.
+ * @see apr_ldap_delete
+ * @see apr_ldap_result
+ */
+typedef apr_status_t (*apr_ldap_delete_cb)(apr_ldap_t *ldap, apr_status_t status,
+ const char *matcheddn,
+ apr_ldap_control_t **serverctrls,
+ void *ctx, apu_err_t *err);
+
+
+
+/**
+ * APR LDAP delete function
+ *
+ * This function allows deletion of an entry described by the given
+ * distinguished name stored in the directory.
+ *
+ * Deletions are attempted asynchronously. For non blocking
+ * behaviour, this function must be called after the underlying
+ * socket has indicated that it is ready to write.
+ *
+ * In the absence of an error, apr_ldap_delete will return
+ * APR_WANT_READ or APR_WANT_WRITE to indicate that the next message
+ * in the conversation be retrieved using apr_ldap_result().
+ *
+ * The outcome of the deletion will be retrieved and handled by
+ * the apr_ldap_process() function, and the outcome is passed to the
+ * apr_ldap_modify_cb provided.
+ *
+ * @param pool The pool that keeps track of the lifetime of the delete conversation.
+ * If this pool is cleaned up, the delete conversation will be gracefully
+ * abandoned without affecting other LDAP requests in progress. This pool need
+ * not have any relationship with the LDAP connection pool.
+ * @param ldap The ldap handle
+ * @param dn The distinguished named of the object to delete.
+ * @param serverctrls NULL terminated array of server controls.
+ * @param clientctrls NULL terminated array of client controls.
+ * @param timeout The timeout to use for writes.
+ * @param delete_cb The delete result callback function. When the delete process has
+ * completed the success or failure of the deletion is returned here. The callback
+ * is triggered from inside apr_ldap_process() so that it is safe to write the
+ * next LDAP request.
+ * @param ctx Context passed to the delete callback.
+ * @param err Error structure for reporting detailed results.
+ *
+ * @return APR_WANT_READ means that processing has occurred, and
+ * the message in reply needs to be fetched using apr_ldap_result().
+ * APR_SUCCESS means that the processing is complete, and the delete
+ * has been successful. Other error codes indicate that the delete
+ * was not successful.
+ * @see apr_ldap_delete_cb
+ * @see apr_ldap_process
+ * @see apr_ldap_result
+ */
+APU_DECLARE_LDAP(apr_status_t) apr_ldap_delete(apr_pool_t *pool,
+ apr_ldap_t *ldap,
+ const char *dn,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_delete_cb delete_cb, void *ctx,
+ apu_err_t *err)
+ __attribute__((nonnull(1,2,3,9)));
+
+/**
+ * Callback to receive the results of an extended operation.
+ *
+ * When an extended operation is successful, this function is called with a
+ * status of APR_SUCCESS.
+ *
+ * If the extended operation fails, status will carry the error code, and err
+ * will return the human readable details.
+ *
+ * If the underlying LDAP connection has failed, status will return details
+ * of the error, allowing an opportunity to clean up.
+ *
+ * When complete, return APR_SUCCESS to indicate you want to continue, or
+ * a different code if you want the event loop to give up. This code will
+ * be returned from apr_ldap_result().
+ *
+ * If this callback was called during a pool cleanup, the return value is
+ * ignored.
+ * @see apr_ldap_extended
+ * @see apr_ldap_result
+ */
+typedef apr_status_t (*apr_ldap_extended_cb)(apr_ldap_t *ldap, apr_status_t status,
+ const char *roid,
+ apr_buffer_t *rdata,
+ void *ctx, apu_err_t *err);
+
+
+
+/**
+ * APR LDAP extended operation function
+ *
+ * This function allows extended operations to be performed on
+ * the directory.
+ *
+ * Extended operations are attempted asynchronously. For non blocking
+ * behaviour, this function must be called after the underlying
+ * socket has indicated that it is ready to write.
+ *
+ * In the absence of an error, apr_ldap_extended_operation will return
+ * APR_WANT_READ or APR_WANT_WRITE to indicate that the next message
+ * in the conversation be retrieved using apr_ldap_result().
+ *
+ * The outcome of the extended operation will be retrieved and handled by
+ * the apr_ldap_process() function, and the outcome is passed to the
+ * apr_ldap_extended_operation_cb provided.
+ *
+ * @param pool The pool that keeps track of the lifetime of the extended operation conversation.
+ * If this pool is cleaned up, the extended operation conversation will be gracefully
+ * abandoned without affecting other LDAP requests in progress. This pool need
+ * not have any relationship with the LDAP connection pool.
+ * @param ldap The ldap handle
+ * @param oid The OID of the extended operation.
+ * @param data The data used by the extended operation.
+ * @param serverctrls NULL terminated array of server controls.
+ * @param clientctrls NULL terminated array of client controls.
+ * @param timeout The timeout to use for writes.
+ * @param ext_cb The extended operation result callback function. When the extended operation process has
+ * completed the success or failure of the extended operation is returned here. The callback
+ * is triggered from inside apr_ldap_process() so that it is safe to write the
+ * next LDAP request.
+ * @param ctx Context passed to the delete callback.
+ * @param err Error structure for reporting detailed results.
+ *
+ * @return APR_WANT_READ means that processing has occurred, and
+ * the message in reply needs to be fetched using apr_ldap_result().
+ * APR_SUCCESS means that the processing is complete, and the
+ * extended operation has been successful. Other error codes indicate
+ * that the extended operation was not successful.
+ * @see apr_ldap_extended_cb
+ * @see apr_ldap_process
+ * @see apr_ldap_result
+ */
+APU_DECLARE_LDAP(apr_status_t) apr_ldap_extended(apr_pool_t *pool,
+ apr_ldap_t *ldap,
+ const char *oid,
+ apr_buffer_t *data,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_extended_cb ext_cb, void *ctx,
+ apu_err_t *err)
+ __attribute__((nonnull(1,2,3,10)));
+
+/**
* APR LDAP unbind function
*
* This function unbinds from the LDAP server, and frees the connection handle.
@@ -1515,8 +2226,8 @@ APU_DECLARE_LDAP(apr_status_t) apr_ldap_
* @see apr_ldap_initialise
*/
APU_DECLARE_LDAP(apr_status_t) apr_ldap_unbind(apr_ldap_t *ldap,
- apr_ldap_control_t **serverctrls,
- apr_ldap_control_t **clientctrls,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
apu_err_t *err)
__attribute__((nonnull(1,4)));
Modified: apr/apr/trunk/include/apu_errno.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apu_errno.h?rev=1924295&r1=1924294&r2=1924295&view=diff
==============================================================================
--- apr/apr/trunk/include/apu_errno.h (original)
+++ apr/apr/trunk/include/apu_errno.h Tue Mar 11 13:27:42 2025
@@ -70,6 +70,8 @@ extern "C" {
* 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
+ * APR_ALREADY_EXISTS The object already exists
+ * APR_OBJECT_CLASS_VIOLATION Add or modify results in an objectclass violation
* </PRE>
*
* <PRE>
@@ -104,40 +106,84 @@ 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_WANT_READ */
+#define APR_WANT_READ (APR_UTIL_START_STATUS + 98)
+/** @see APR_STATUS_IS_WANT_WRITE */
+#define APR_WANT_WRITE (APR_UTIL_START_STATUS + 99)
+
+/** @see APR_STATUS_IS_OTHER */
+#define APR_OTHER (APR_UTIL_START_STATUS + 100)
/** @see APR_STATUS_IS_SERVER_DOWN */
#define APR_SERVER_DOWN (APR_UTIL_START_STATUS + 101)
+/** @see APR_STATUS_IS_LOCAL_ERROR */
+#define APR_LOCAL_ERROR (APR_UTIL_START_STATUS + 102)
+/** @see APR_STATUS_IS_ENCODING_ERROR */
+#define APR_ENCODING_ERROR (APR_UTIL_START_STATUS + 103)
+/** @see APR_STATUS_IS_DECODING_ERROR */
+#define APR_DECODING_ERROR (APR_UTIL_START_STATUS + 104)
+/** @see APR_STATUS_IS_TIMEOUT */
+#define APR_TIMEOUT (APR_ETIMEDOUT)
/** @see APR_STATUS_IS_AUTH_UNKNOWN */
-#define APR_AUTH_UNKNOWN (APR_UTIL_START_STATUS + 102)
+#define APR_AUTH_UNKNOWN (APR_UTIL_START_STATUS + 106)
+/** @see APR_STATUS_IS_FILTER_ERROR */
+#define APR_FILTER_ERROR (APR_UTIL_START_STATUS + 107)
+/** @see APR_STATUS_IS_USER_CANCELLED */
+#define APR_USER_CANCELLED (APR_UTIL_START_STATUS + 108)
+/** @see APR_STATUS_IS_PARAM_ERROR */
+#define APR_PARAM_ERROR (APR_UTIL_START_STATUS + 109)
+/** @see APR_STATUS_IS_NO_MEMORY */
+#define APR_NO_MEMORY (APR_ENOMEM)
+/** @see APR_STATUS_IS_CONNECT_ERROR */
+#define APR_CONNECT_ERROR (APR_UTIL_START_STATUS + 111)
+/** @see APR_STATUS_IS_NOT_SUPPORTED */
+#define APR_NOT_SUPPORTED (APR_UTIL_START_STATUS + 112)
+/** @see APR_STATUS_IS_CONTROL_NOT_FOUND */
+#define APR_CONTROL_NOT_FOUND (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_MORE_RESULTS_TO_RETURN */
+#define APR_MORE_RESULTS_TO_RETURN (APR_UTIL_START_STATUS + 115)
+/** @see APR_STATUS_IS_CLIENT_LOOP */
+#define APR_CLIENT_LOOP (APR_UTIL_START_STATUS + 116)
+/** @see APR_STATUS_IS_REFERRAL_LIMIT_EXCEEDED */
+#define APR_REFERRAL_LIMIT_EXCEEDED (APR_UTIL_START_STATUS + 117)
+/** @see APR_STATUS_IS_CONNECTING */
+#define APR_CONNECTING (APR_UTIL_START_STATUS + 118)
+
+/** @see APR_STATUS_IS_OPERATIONS_ERROR */
+#define APR_OPERATIONS_ERROR (APR_UTIL_START_STATUS + 200 + 0x01)
+/** @see APR_STATUS_IS_PROTOCOL_ERROR */
+#define APR_PROTOCOL_ERROR (APR_UTIL_START_STATUS + 200 + 0x02)
+/** @see APR_STATUS_IS_TIMELIMIT_EXCEEDED */
+#define APR_TIMELIMIT_EXCEEDED (APR_UTIL_START_STATUS + 200 + 0x03)
+/** @see APR_STATUS_IS_SIZELIMIT_EXCEEDED */
+#define APR_SIZELIMIT_EXCEEDED (APR_UTIL_START_STATUS + 200 + 0x04)
+/** @see APR_STATUS_IS_COMPARE_FALSE */
+#define APR_COMPARE_FALSE (APR_UTIL_START_STATUS + 200 + 0x05)
+/** @see APR_STATUS_IS_COMPARE_TRUE */
+#define APR_COMPARE_TRUE (APR_UTIL_START_STATUS + 200 + 0x06)
/** @see APR_STATUS_IS_PROXY_AUTH */
-#define APR_PROXY_AUTH (APR_UTIL_START_STATUS + 103)
+#define APR_PROXY_AUTH (APR_UTIL_START_STATUS + 200 + 0x2F)
/** @see APR_STATUS_IS_INAPPROPRIATE_AUTH */
-#define APR_INAPPROPRIATE_AUTH (APR_UTIL_START_STATUS + 104)
+#define APR_INAPPROPRIATE_AUTH (APR_UTIL_START_STATUS + 200 + 0x30)
/** @see APR_STATUS_IS_INVALID_CREDENTIALS */
-#define APR_INVALID_CREDENTIALS (APR_UTIL_START_STATUS + 105)
+#define APR_INVALID_CREDENTIALS (APR_UTIL_START_STATUS + 200 + 0x31)
/** @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)
+#define APR_INSUFFICIENT_ACCESS (APR_UTIL_START_STATUS + 200 + 0x32)
+/** @see APR_STATUS_IS_UNAVAILABLE */
+#define APR_UNAVAILABLE (APR_UTIL_START_STATUS + 200 + 0x34)
/** @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)
+#define APR_CONSTRAINT_VIOLATION (APR_UTIL_START_STATUS + 200 + 0x13)
/** @see APR_STATUS_IS_NO_SUCH_OBJECT */
-#define APR_NO_SUCH_OBJECT (APR_UTIL_START_STATUS + 110)
+#define APR_NO_SUCH_OBJECT (APR_UTIL_START_STATUS + 200 + 0x20)
/** @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)
+#define APR_NO_SUCH_ATTRIBUTE (APR_UTIL_START_STATUS + 200 + 0x10)
+/** @see APR_STATUS_IS_ALREADY_EXISTS */
+#define APR_ALREADY_EXISTS (APR_UTIL_START_STATUS + 200 + 0x44)
+/** @see APR_STATUS_IS_OBJECT_CLASS_VIOLATION */
+#define APR_OBJECT_CLASS_VIOLATION (APR_UTIL_START_STATUS + 200 + 0x41)
+
/** @} */
/**
@@ -210,15 +256,110 @@ extern "C" {
* The signature verification failed
*/
#define APR_STATUS_IS_ENOVERIFY(s) ((s) == APR_ENOVERIFY)
+
+/**
+ * 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)
+
+/**
+ * An internal LDAP error has occurred
+ */
+#define APR_STATUS_IS_OTHER(s) ((s) == APR_OTHER)
/**
* The server is down
*/
#define APR_STATUS_IS_SERVER_DOWN(s) ((s) == APR_SERVER_DOWN)
/**
- * Authentication mechanism not supoorted by this server
+ * An error has occurred locally
+ */
+#define APR_STATUS_IS_LOCAL_ERROR(s) ((s) == APR_LOCAL_ERROR)
+/**
+ * Encoding has failed
+ */
+#define APR_STATUS_IS_ENCODING_ERROR(s) ((s) == APR_ENCODING_ERROR)
+/**
+ * Decoding has failed
+ */
+#define APR_STATUS_IS_DECODING_ERROR(s) ((s) == APR_DECODING_ERROR)
+/**
+ * Timeout has occurred
+ */
+#define APR_STATUS_IS_TIMEOUT(s) ((s) == APR_TIMEOUT)
+/**
+ * Authentication mechanism not supported by this server
*/
#define APR_STATUS_IS_AUTH_UNKNOWN(s) ((s) == APR_AUTH_UNKNOWN)
/**
+ * The filter was malformed
+ */
+#define APR_STATUS_IS_FILTER_ERROR(s) ((s) == APR_FILTER_ERROR)
+/**
+ * User has cancelled the request
+ */
+#define APR_STATUS_IS_USER_CANCELLED(s) ((s) == APR_USER_CANCELLED)
+/**
+ * Parameter error
+ */
+#define APR_STATUS_IS_PARAM_ERROR(s) ((s) == APR_PARAM_ERROR)
+/**
+ * No memory
+ */
+#define APR_STATUS_IS_NO_MEMORY(s) ((s) == APR_NO_MEMORY)
+/**
+ * Connect error
+ */
+#define APR_STATUS_IS_CONNECT_ERROR(s) ((s) == APR_CONNECT_ERROR)
+/**
+ * Not supported
+ */
+#define APR_STATUS_IS_NOT_SUPPORTED(s) ((s) == APR_NOT_SUPPORTED)
+/**
+ * Control not found
+ */
+#define APR_STATUS_IS_CONTROL_NOT_FOUND(s) ((s) == APR_CONTROL_NOT_FOUND)
+/**
+ * No results returned
+ */
+#define APR_STATUS_IS_NO_RESULTS_RETURNED(s) ((s) == APR_NO_RESULTS_RETURNED)
+/**
+ * More results to be returned
+ */
+#define APR_STATUS_IS_MORE_RESULTS_TO_RETURN(s) ((s) == APR_MORE_RESULTS_TO_RETURN)
+/**
+ * Client loop has occurred
+ */
+#define APR_STATUS_IS_CLIENT_LOOP(s) ((s) == APR_CLIENT_LOOP)
+/**
+ * Referral limit exceeded
+ */
+#define APR_STATUS_IS_REFERRAL_LIMIT_EXCEEDED(s) ((s) == APR_REFERRAL_LIMIT_EXCEEDED)
+/**
+ * Connecting
+ */
+#define APR_STATUS_IS_CONNECTING(s) ((s) == APR_CONNECTING)
+
+/**
+ * An operations error has occurred
+ */
+#define APR_STATUS_IS_OPERATIONS_ERROR(s) ((s) == APR_OPERATIONS_ERROR)
+/**
+ * An protocol error has occurred
+ */
+#define APR_STATUS_IS_PROTOCOL_ERROR(s) ((s) == APR_PROTOCOL_ERROR)
+/**
+ * Time limit has been exceeded
+ */
+#define APR_STATUS_IS_TIMELIMIT_EXCEEDED(s) ((s) == APR_TIMELIMIT_EXCEEDED)
+/**
+ * Size limit has been exceeded
+ */
+#define APR_STATUS_IS_SIZELIMIT_EXCEEDED(s) ((s) == APR_SIZELIMIT_EXCEEDED)
+/**
* Proxy authorization has failed
*/
#define APR_STATUS_IS_PROXY_AUTH(s) ((s) == APR_PROXY_AUTH)
@@ -236,18 +377,14 @@ extern "C" {
*/
#define APR_STATUS_IS_INSUFFICIENT_ACCESS(s) ((s) == APR_INSUFFICIENT_ACCESS)
/**
- * The user has insufficient rights to perform the operation.
+ * Unavailable.
*/
-#define APR_STATUS_IS_INSUFFICIENT_RIGHTS(s) ((s) == APR_INSUFFICIENT_RIGHTS)
+#define APR_STATUS_IS_UNAVAILABLE(s) ((s) == APR_UNAVAILABLE)
/**
* 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)
@@ -264,21 +401,13 @@ extern "C" {
*/
#define APR_STATUS_IS_COMPARE_FALSE(s) ((s) == APR_COMPARE_FALSE)
/**
- * No results were returned.
+ * Object already exists.
*/
-#define APR_STATUS_IS_NO_RESULTS_RETURNED(s) ((s) == APR_NO_RESULTS_RETURNED)
+#define APR_STATUS_IS_ALREADY_EXISTS(s) ((s) == APR_ALREADY_EXISTS)
/**
- * Call us back when the socket is ready for a read.
+ * Object class violation.
*/
-#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)
+#define APR_STATUS_IS_OBJECT_CLASS_VIOLATION(s) ((s) == APR_OBJECT_CLASS_VIOLATION)
/** @} */
/**
Modified: 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=1924295&r1=1924294&r2=1924295&view=diff
==============================================================================
--- apr/apr/trunk/include/private/apr_ldap_internal.h (original)
+++ apr/apr/trunk/include/private/apr_ldap_internal.h Tue Mar 11 13:27:42 2025
@@ -124,61 +124,6 @@ extern "C" {
#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 */
@@ -210,21 +155,52 @@ struct apr__ldap_dso_fntable {
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_array_header_t *serverctrls,
+ apr_array_header_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_array_header_t *serverctrls,
+ apr_array_header_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);
+ apr_status_t (*add)(apr_pool_t *pool, apr_ldap_t *ldap,
+ const char *dn, apr_array_header_t *adds,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_add_cb add_cb, void *ctx, apu_err_t *err);
+ apr_status_t (*modify)(apr_pool_t *pool, apr_ldap_t *ldap,
+ const char *dn, apr_array_header_t *mods,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_modify_cb modify_cb, void *ctx, apu_err_t *err);
+ apr_status_t (*rename)(apr_pool_t *pool, apr_ldap_t *ldap,
+ const char *dn, const char *newrdn, const char *newparent,
+ apr_ldap_rename_e flags,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_rename_cb rename_cb, void *ctx, apu_err_t *err);
+ apr_status_t (*delete)(apr_pool_t *pool, apr_ldap_t *ldap,
+ const char *dn,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_delete_cb delete_cb, void *ctx, apu_err_t *err);
+ apr_status_t (*extended)(apr_pool_t *pool, apr_ldap_t *ldap,
+ const char *dn, apr_buffer_t *data,
+ apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls,
+ apr_interval_time_t timeout,
+ apr_ldap_extended_cb ext_cb, void *ctx, apu_err_t *err);
+ apr_status_t (*unbind)(apr_ldap_t *ldap, apr_array_header_t *serverctrls,
+ apr_array_header_t *clientctrls, apu_err_t *err);
};
#endif /* APR_HAVE_MODULAR_DSO */
Modified: apr/apr/trunk/include/private/apu_ldap_internal.h.in
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/private/apu_ldap_internal.h.in?rev=1924295&r1=1924294&r2=1924295&view=diff
==============================================================================
--- apr/apr/trunk/include/private/apu_ldap_internal.h.in (original)
+++ apr/apr/trunk/include/private/apu_ldap_internal.h.in Tue Mar 11 13:27:42 2025
@@ -21,5 +21,6 @@
** The following macros control what features APRUTIL will use
*/
#define APR_HAVE_LDAP_SASL_INTERACTIVE_BIND @apu_have_ldap_sasl_interactive_bind@
+#define APR_HAVE_LDAP_CONNECT @apu_have_ldap_connect@
-#endif /* !APU_LDAP_INTERNAL_H */
+#endif /* !APU_LDAP_INTERNAL_H */
Modified: apr/apr/trunk/include/private/apu_ldap_internal.hw
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/private/apu_ldap_internal.hw?rev=1924295&r1=1924294&r2=1924295&view=diff
==============================================================================
--- apr/apr/trunk/include/private/apu_ldap_internal.hw (original)
+++ apr/apr/trunk/include/private/apu_ldap_internal.hw Tue Mar 11 13:27:42 2025
@@ -21,5 +21,6 @@
** The following macros control what features APRUTIL will use
*/
#define APR_HAVE_LDAP_SASL_INTERACTIVE_BIND 0
+#define APR_HAVE_LDAP_CONNECT 1
-#endif /* !APU_LDAP_INTERNAL_H */
+#endif /* !APU_LDAP_INTERNAL_H */
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.