From 75d55a9ac5b627bbe1490027cee586de4a1cd961 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sat, 31 May 2003 21:01:38 +0000 Subject: [PATCH] Suck in changes from HEAD --- clients/tools/ldapsearch.c | 33 ++++---- configure.in | 2 +- include/lber.h | 57 -------------- include/lber_pvt.h | 59 +++++++++++++++ include/ldap.h | 33 ++------ include/ldap_rq.h | 9 ++- libraries/libldap/error.c | 4 +- libraries/libldap/extended.c | 124 +------------------------------ libraries/libldap/os-local.c | 4 +- libraries/libldap/result.c | 14 ++-- libraries/libldap/search.c | 2 +- libraries/libldap_r/rq.c | 3 - servers/slapd/back-bdb/search.c | 2 +- servers/slapd/back-ldap/config.c | 3 +- servers/slapd/connection.c | 4 +- servers/slapd/controls.c | 10 ++- servers/slapd/extended.c | 49 ++++++++---- servers/slapd/proto-slap.h | 7 +- servers/slapd/result.c | 22 ++++-- servers/slapd/root_dse.c | 15 +--- servers/slapd/schema_init.c | 4 +- servers/slapd/schema_prep.c | 51 +++++++------ servers/slapd/slap.h | 94 +++++++++++++++-------- servers/slapd/syncrepl.c | 18 ++--- 24 files changed, 273 insertions(+), 350 deletions(-) diff --git a/clients/tools/ldapsearch.c b/clients/tools/ldapsearch.c index f73700491f..399933196c 100644 --- a/clients/tools/ldapsearch.c +++ b/clients/tools/ldapsearch.c @@ -1044,12 +1044,6 @@ static int dosearch( goto done; } #endif - - break; - - case LDAP_RES_EXTENDED_PARTIAL: - npartial++; - print_partial( ld, msg ); break; case LDAP_RES_SEARCH_RESULT: @@ -1077,22 +1071,27 @@ static int dosearch( goto done; -#ifdef LDAP_SYNC - case LDAP_RES_INTERMEDIATE_RESP: - ldap_parse_intermediate_resp_result( ld, msg, &retoid, &retdata, 0 ); + case LDAP_RES_INTERMEDIATE: + npartial++; +#ifndef LDAP_SYNC + print_partial( ld, msg ); +#else + ldap_parse_intermediate( ld, msg, + &retoid, &retdata, NULL, 0 ); + nresponses_psearch = 0; - if ( strcmp( retoid, LDAP_SYNC_INFO ) ) { - printf(_("Unexpected Intermediate Response\n")); - ldap_memfree( retoid ); - ber_bvfree( retdata ); - goto done; - } else { + if ( strcmp( retoid, LDAP_SYNC_INFO ) == 0 ) { printf(_("SyncInfo Received\n")); ldap_memfree( retoid ); ber_bvfree( retdata ); break; } + + print_partial( ld, msg ); + ldap_memfree( retoid ); + ber_bvfree( retdata ); + goto done; #endif } @@ -1463,11 +1462,11 @@ static void print_partial( printf(_("# extended partial response\n")); } - rc = ldap_parse_extended_partial( ld, partial, + rc = ldap_parse_intermediate( ld, partial, &retoid, &retdata, &ctrls, 0 ); if( rc != LDAP_SUCCESS ) { - ldap_perror(ld, "ldap_parse_extended_partial"); + ldap_perror(ld, "ldap_parse_intermediate"); exit( EXIT_FAILURE ); } diff --git a/configure.in b/configure.in index 5243f355e6..bfc7c447ed 100644 --- a/configure.in +++ b/configure.in @@ -180,7 +180,7 @@ dnl OL_ARG_ENABLE(multimaster,[ --enable-multimaster enable multimaster repl ol_enable_multimaster=${ol_enable_multimaster-no} OL_ARG_ENABLE(rewrite,[ --enable-rewrite enable DN rewriting in back-ldap and back-meta], no)dnl OL_ARG_ENABLE(rlookups,[ --enable-rlookups enable reverse lookups of client hostnames], no)dnl -OL_ARG_ENABLE(slapi,[ --enable-slapi enable installation of slapi library], no)dnl +OL_ARG_ENABLE(slapi,[ --enable-slapi enable SLAPI support (experimental)], no)dnl OL_ARG_ENABLE(slp,[ --enable-slp enable SLPv2 support], no)dnl OL_ARG_ENABLE(wrappers,[ --enable-wrappers enable tcp wrapper support], no)dnl diff --git a/include/lber.h b/include/lber.h index 20095179a6..5db9fb39f3 100644 --- a/include/lber.h +++ b/include/lber.h @@ -602,63 +602,6 @@ ber_bvarray_free LDAP_P(( BerVarray p )); LBER_F( int ) ber_bvarray_add LDAP_P(( BerVarray *p, BerValue *bv )); -LBER_F( void * ) -ber_memalloc_x LDAP_P(( - ber_len_t s, void *ctx)); - -LBER_F( void * ) -ber_memrealloc_x LDAP_P(( - void* p, - ber_len_t s, void *ctx )); - -LBER_F( void * ) -ber_memcalloc_x LDAP_P(( - ber_len_t n, - ber_len_t s, void *ctx )); - -LBER_F( void ) -ber_memfree_x LDAP_P(( - void* p, void *ctx )); - -LBER_F( void ) -ber_memvfree_x LDAP_P(( - void** vector, void *ctx )); - -LBER_F( void ) -ber_bvfree_x LDAP_P(( - struct berval *bv, void *ctx )); - -LBER_F( void ) -ber_bvecfree_x LDAP_P(( - struct berval **bv, void *ctx )); - -LBER_F( int ) -ber_bvecadd_x LDAP_P(( - struct berval ***bvec, - struct berval *bv, void *ctx )); - -LBER_F( struct berval * ) -ber_dupbv_x LDAP_P(( - struct berval *dst, struct berval *src, void *ctx )); - -LBER_F( struct berval * ) -ber_str2bv_x LDAP_P(( - LDAP_CONST char *, ber_len_t len, int dup, struct berval *bv, void *ctx)); - -LBER_F( struct berval * ) -ber_mem2bv_x LDAP_P(( - LDAP_CONST char *, ber_len_t len, int dup, struct berval *bv, void *ctx)); - -LBER_F( char * ) -ber_strdup_x LDAP_P(( - LDAP_CONST char *, void *ctx )); - -LBER_F( void ) -ber_bvarray_free_x LDAP_P(( BerVarray p, void *ctx )); - -LBER_F( int ) -ber_bvarray_add_x LDAP_P(( BerVarray *p, BerValue *bv, void *ctx )); - #define ber_bvcmp(v1,v2) \ ((v1)->bv_len < (v2)->bv_len \ ? -1 : ((v1)->bv_len > (v2)->bv_len \ diff --git a/include/lber_pvt.h b/include/lber_pvt.h index 7f5a141e1f..48817d1b01 100644 --- a/include/lber_pvt.h +++ b/include/lber_pvt.h @@ -61,6 +61,65 @@ ber_pvt_sb_copy_out LDAP_P(( Sockbuf_Buf *sbb, char *buf, ber_len_t len )); LBER_F( int ) ber_pvt_socket_set_nonblock LDAP_P(( ber_socket_t sd, int nb )); +/* + * memory.c + */ +LBER_F( void * ) +ber_memalloc_x LDAP_P(( + ber_len_t s, void *ctx)); + +LBER_F( void * ) +ber_memrealloc_x LDAP_P(( + void* p, + ber_len_t s, void *ctx )); + +LBER_F( void * ) +ber_memcalloc_x LDAP_P(( + ber_len_t n, + ber_len_t s, void *ctx )); + +LBER_F( void ) +ber_memfree_x LDAP_P(( + void* p, void *ctx )); + +LBER_F( void ) +ber_memvfree_x LDAP_P(( + void** vector, void *ctx )); + +LBER_F( void ) +ber_bvfree_x LDAP_P(( + struct berval *bv, void *ctx )); + +LBER_F( void ) +ber_bvecfree_x LDAP_P(( + struct berval **bv, void *ctx )); + +LBER_F( int ) +ber_bvecadd_x LDAP_P(( + struct berval ***bvec, + struct berval *bv, void *ctx )); + +LBER_F( struct berval * ) +ber_dupbv_x LDAP_P(( + struct berval *dst, struct berval *src, void *ctx )); + +LBER_F( struct berval * ) +ber_str2bv_x LDAP_P(( + LDAP_CONST char *, ber_len_t len, int dup, struct berval *bv, void *ctx)); + +LBER_F( struct berval * ) +ber_mem2bv_x LDAP_P(( + LDAP_CONST char *, ber_len_t len, int dup, struct berval *bv, void *ctx)); + +LBER_F( char * ) +ber_strdup_x LDAP_P(( + LDAP_CONST char *, void *ctx )); + +LBER_F( void ) +ber_bvarray_free_x LDAP_P(( BerVarray p, void *ctx )); + +LBER_F( int ) +ber_bvarray_add_x LDAP_P(( BerVarray *p, BerValue *bv, void *ctx )); #if 0 #define ber_bvstrcmp(v1,v2) \ diff --git a/include/ldap.h b/include/ldap.h index 73b8efe152..c59c91720d 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -193,15 +193,7 @@ typedef struct ldapcontrol { #define LDAP_CONTROL_DUPENT LDAP_CONTROL_DUPENT_REQUEST #endif -#ifdef LDAP_DEVEL #define LDAP_CONTROL_PAGEDRESULTS "1.2.840.113556.1.4.319" -#endif - -#ifdef LDAP_DEVEL -#define LDAP_CLIENT_UPDATE 1 -#define LDAP_SYNC 2 -#define LDAP_SYNCREPL 1 -#endif #ifdef LDAP_CLIENT_UPDATE #define LDAP_CONTROL_CLIENT_UPDATE "1.3.6.1.4.1.4203.666.5.3" @@ -210,7 +202,11 @@ typedef struct ldapcontrol { #define LDAP_CUP_COOKIE_OID "1.3.6.1.4.1.4203.666.10.1" #endif +#ifdef LDAP_DEVEL +#define LDAP_SYNC 2 +#endif #ifdef LDAP_SYNC +#define LDAP_SYNCREPL 1 #define LDAP_CONTROL_SYNC "1.3.6.1.4.1.4203.666.5.6" #define LDAP_CONTROL_SYNC_STATE "1.3.6.1.4.1.4203.666.5.7" #define LDAP_CONTROL_SYNC_DONE "1.3.6.1.4.1.4203.666.5.8" @@ -230,10 +226,9 @@ typedef struct ldapcontrol { #define LDAP_CONTROL_VLVREQUEST "2.16.840.1.113730.3.4.9" #define LDAP_CONTROL_VLVRESPONSE "2.16.840.1.113730.3.4.10" -#ifdef LDAP_DEVEL +/* controls for MSAD compatibility */ #define LDAP_CONTROL_X_DOMAIN_SCOPE "1.2.840.113556.1.4.1339" #define LDAP_CONTROL_X_PERMISSIVE_MODIFY "1.2.840.113556.1.4.1413" -#endif /* LDAP Unsolicited Notifications */ #define LDAP_NOTICE_OF_DISCONNECTION "1.3.6.1.4.1.1466.20036" @@ -249,10 +244,7 @@ typedef struct ldapcontrol { #define LDAP_TAG_EXOP_MODIFY_PASSWD_GEN ((ber_tag_t) 0x80U) #define LDAP_EXOP_X_WHO_AM_I "1.3.6.1.4.1.4203.1.11.3" - -#ifdef LDAP_DEVEL #define LDAP_EXOP_X_CANCEL "1.3.6.1.4.1.4203.666.6.3" -#endif /* LDAP Features */ #define LDAP_FEATURE_ALL_OPERATIONAL_ATTRS "1.3.6.1.4.1.4203.1.5.1" /* + */ @@ -338,10 +330,7 @@ typedef struct ldapcontrol { #define LDAP_RES_RENAME LDAP_RES_MODDN /* application + constructed */ #define LDAP_RES_COMPARE ((ber_tag_t) 0x6fU) /* application + constructed */ #define LDAP_RES_EXTENDED ((ber_tag_t) 0x78U) /* V3: application + constructed */ -#define LDAP_RES_EXTENDED_PARTIAL ((ber_tag_t) 0x79U) /* V3+: application + constructed */ -#ifdef LDAP_DEVEL -#define LDAP_RES_INTERMEDIATE_RESP ((ber_tag_t) 0x7aU) -#endif +#define LDAP_RES_INTERMEDIATE ((ber_tag_t) 0x79U) /* V3+: application + constructed */ #define LDAP_RES_ANY (-1) #define LDAP_RES_UNSOLICITED (0) @@ -702,7 +691,7 @@ ldap_parse_extended_result LDAP_P(( int freeit )); LDAP_F( int ) -ldap_parse_extended_partial LDAP_P(( +ldap_parse_intermediate LDAP_P(( LDAP *ld, LDAPMessage *res, char **retoidp, @@ -710,14 +699,6 @@ ldap_parse_extended_partial LDAP_P(( LDAPControl ***serverctrls, int freeit )); -LDAP_F( int ) -ldap_parse_intermediate_resp_result LDAP_P(( - LDAP *ld, - LDAPMessage *res, - char **retoidp, - struct berval **retdatap, - int freeit )); - /* * in abandon.c: */ diff --git a/include/ldap_rq.h b/include/ldap_rq.h index 084684eb31..de6f32a936 100644 --- a/include/ldap_rq.h +++ b/include/ldap_rq.h @@ -10,7 +10,12 @@ * top-level directory of the distribution. */ -#ifdef LDAP_SYNCREPL +#ifndef LDAP_RQ_H +#define LDAP_RQ_H 1 + +#include + +LDAP_BEGIN_DECL typedef struct re_s { struct timeval next_sched; @@ -76,4 +81,6 @@ ldap_pvt_runqueue_persistent_backload( struct runqueue_s* rq ); +LDAP_END_DECL + #endif diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c index 477cf88984..464b9e5172 100644 --- a/libraries/libldap/error.c +++ b/libraries/libldap/error.c @@ -265,7 +265,7 @@ ldap_parse_result( /* skip over entries and references */ if( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY && lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE && - lm->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL ) + lm->lm_msgtype != LDAP_RES_INTERMEDIATE ) { break; } @@ -378,7 +378,7 @@ ldap_parse_result( /* skip over entries and references */ if( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY && lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE && - lm->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL ) + lm->lm_msgtype != LDAP_RES_INTERMEDIATE ) { /* more results to return */ errcode = LDAP_MORE_RESULTS_TO_RETURN; diff --git a/libraries/libldap/extended.c b/libraries/libldap/extended.c index 9102e9ccc3..4fd921dd60 100644 --- a/libraries/libldap/extended.c +++ b/libraries/libldap/extended.c @@ -283,7 +283,7 @@ ldap_parse_extended_result ( /* Parse an extended partial */ int -ldap_parse_extended_partial ( +ldap_parse_intermediate ( LDAP *ld, LDAPMessage *res, char **retoidp, @@ -303,9 +303,9 @@ ldap_parse_extended_partial ( assert( res != NULL ); #ifdef NEW_LOGGING - LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_extended_partial\n", 0,0,0 ); + LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_intermediate\n", 0,0,0 ); #else - Debug( LDAP_DEBUG_TRACE, "ldap_parse_extended_partial\n", 0, 0, 0 ); + Debug( LDAP_DEBUG_TRACE, "ldap_parse_intermediate\n", 0, 0, 0 ); #endif if( ld->ld_version < LDAP_VERSION3 ) { @@ -313,7 +313,7 @@ ldap_parse_extended_partial ( return ld->ld_errno; } - if( res->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL ) { + if( res->lm_msgtype != LDAP_RES_INTERMEDIATE ) { ld->ld_errno = LDAP_PARAM_ERROR; return ld->ld_errno; } @@ -396,119 +396,3 @@ free_and_return: return LDAP_SUCCESS; } -#ifdef LDAP_RES_INTERMEDIATE_RESP -/* Parse an intermediate response result */ -int -ldap_parse_intermediate_resp_result ( - LDAP *ld, - LDAPMessage *res, - char **retoidp, - struct berval **retdatap, - int freeit ) -{ - BerElement *ber; - ber_tag_t rc; - ber_tag_t tag; - ber_len_t len; - struct berval *resdata; - ber_int_t errcode; - char *resoid; - - assert( ld != NULL ); - assert( LDAP_VALID( ld ) ); - assert( res != NULL ); - -#ifdef NEW_LOGGING - LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_intermediate_resp_result\n", 0,0,0 ); -#else - Debug( LDAP_DEBUG_TRACE, "ldap_parse_intermediate_resp_result\n", 0, 0, 0 ); -#endif - - if( ld->ld_version < LDAP_VERSION3 ) { - ld->ld_errno = LDAP_NOT_SUPPORTED; - return ld->ld_errno; - } - - if( res->lm_msgtype != LDAP_RES_INTERMEDIATE_RESP ) { - ld->ld_errno = LDAP_PARAM_ERROR; - return ld->ld_errno; - } - - if( retoidp != NULL ) *retoidp = NULL; - if( retdatap != NULL ) *retdatap = NULL; - - if ( ld->ld_error ) { - LDAP_FREE( ld->ld_error ); - ld->ld_error = NULL; - } - - if ( ld->ld_matched ) { - LDAP_FREE( ld->ld_matched ); - ld->ld_matched = NULL; - } - - ber = ber_dup( res->lm_ber ); - - if ( ber == NULL ) { - ld->ld_errno = LDAP_NO_MEMORY; - return ld->ld_errno; - } - - rc = ber_scanf( ber, "{iaa" /*}*/, &errcode, - &ld->ld_matched, &ld->ld_error ); - - if( rc == LBER_ERROR ) { - ld->ld_errno = LDAP_DECODING_ERROR; - ber_free( ber, 0 ); - return ld->ld_errno; - } - - resoid = NULL; - resdata = NULL; - - tag = ber_peek_tag( ber, &len ); - - if( tag == LDAP_TAG_EXOP_RES_OID ) { - /* we have a resoid */ - if( ber_scanf( ber, "a", &resoid ) == LBER_ERROR ) { - ld->ld_errno = LDAP_DECODING_ERROR; - ber_free( ber, 0 ); - return ld->ld_errno; - } - - tag = ber_peek_tag( ber, &len ); - } - - if( tag == LDAP_TAG_EXOP_RES_VALUE ) { - /* we have a resdata */ - if( ber_scanf( ber, "O", &resdata ) == LBER_ERROR ) { - ld->ld_errno = LDAP_DECODING_ERROR; - ber_free( ber, 0 ); - if( resoid != NULL ) LDAP_FREE( resoid ); - return ld->ld_errno; - } - } - - ber_free( ber, 0 ); - - if( retoidp != NULL ) { - *retoidp = resoid; - } else { - LDAP_FREE( resoid ); - } - - if( retdatap != NULL ) { - *retdatap = resdata; - } else { - ber_bvfree( resdata ); - } - - ld->ld_errno = errcode; - - if( freeit ) { - ldap_msgfree( res ); - } - - return LDAP_SUCCESS; -} -#endif diff --git a/libraries/libldap/os-local.c b/libraries/libldap/os-local.c index 3e8a7f2d4a..66386abe12 100644 --- a/libraries/libldap/os-local.c +++ b/libraries/libldap/os-local.c @@ -182,8 +182,10 @@ sendcred: int fds[2]; if (pipe(fds) == 0) { /* Abandon, noop, has no reply */ - struct iovec iov = {(char *)abandonPDU, sizeof(abandonPDU)}; + struct iovec iov; struct msghdr msg = {0}; + iov.iov_base = (char *) abandonPDU; + iov.iov_len = sizeof abandonPDU; msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_accrights = (char *)fds; diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index 228781c11a..f326074e2d 100644 --- a/libraries/libldap/result.c +++ b/libraries/libldap/result.c @@ -185,7 +185,7 @@ chkResponseList( for ( tmp = lm; tmp != NULL; tmp = tmp->lm_chain ) { if ( tmp->lm_msgtype != LDAP_RES_SEARCH_ENTRY && tmp->lm_msgtype != LDAP_RES_SEARCH_REFERENCE - && tmp->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL ) + && tmp->lm_msgtype != LDAP_RES_INTERMEDIATE ) { break; } @@ -660,11 +660,9 @@ nextresp2: * go through the following code. This code also chases V2 referrals * and checks if all referrals have been chased. */ - if ( (tag != LDAP_RES_SEARCH_ENTRY) && (v3ref > -1) -#ifdef LDAP_RES_INTERMEDIATE_RESP - && (tag != LDAP_RES_INTERMEDIATE_RESP ) -#endif - ) { + if ( (tag != LDAP_RES_SEARCH_ENTRY) && (v3ref > -1) && + (tag != LDAP_RES_INTERMEDIATE )) + { /* For a v3 search referral/reference, only come here if already chased it */ if ( ld->ld_version >= LDAP_VERSION2 && ( lr->lr_parent != NULL || @@ -957,7 +955,7 @@ lr->lr_res_matched ? lr->lr_res_matched : "" ); for ( tmp = l; (tmp->lm_chain != NULL) && ((tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY) || (tmp->lm_chain->lm_msgtype == LDAP_RES_SEARCH_REFERENCE) || - (tmp->lm_chain->lm_msgtype == LDAP_RES_EXTENDED_PARTIAL )); + (tmp->lm_chain->lm_msgtype == LDAP_RES_INTERMEDIATE )); tmp = tmp->lm_chain ) ; /* NULL */ tmp->lm_chain = new; @@ -1109,7 +1107,7 @@ char * ldap_int_msgtype2str( ber_tag_t tag ) case LDAP_RES_COMPARE: return "compare"; case LDAP_RES_DELETE: return "delete"; case LDAP_RES_EXTENDED: return "extended-result"; - case LDAP_RES_EXTENDED_PARTIAL: return "extended-partial"; + case LDAP_RES_INTERMEDIATE: return "intermediate"; case LDAP_RES_MODIFY: return "modify"; case LDAP_RES_RENAME: return "rename"; case LDAP_RES_SEARCH_ENTRY: return "search-entry"; diff --git a/libraries/libldap/search.c b/libraries/libldap/search.c index c6516f5e02..56c45c2eed 100644 --- a/libraries/libldap/search.c +++ b/libraries/libldap/search.c @@ -140,7 +140,7 @@ ldap_search_ext_s( return( ld->ld_errno ); } - if( rc == LDAP_RES_SEARCH_REFERENCE || rc == LDAP_RES_EXTENDED_PARTIAL ) { + if( rc == LDAP_RES_SEARCH_REFERENCE || rc == LDAP_RES_INTERMEDIATE ) { return( ld->ld_errno ); } diff --git a/libraries/libldap_r/rq.c b/libraries/libldap_r/rq.c index 77d4227a42..29153ccc72 100644 --- a/libraries/libldap_r/rq.c +++ b/libraries/libldap_r/rq.c @@ -18,8 +18,6 @@ #include "ldap_queue.h" #include "ldap_rq.h" -#ifdef LDAP_SYNCREPL - void ldap_pvt_runqueue_insert( struct runqueue_s* rq, @@ -184,4 +182,3 @@ ldap_pvt_runqueue_persistent_backload( return count; } -#endif diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index a4f2ef67bd..2c4c80e3ae 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -2003,7 +2003,7 @@ bdb_send_ldap_intermediate( } rs->sr_rspdata = &rspdata; - send_ldap_intermediate_resp( op, rs ); + send_ldap_intermediate( op, rs ); rs->sr_rspdata = NULL; ber_free_buf( ber ); diff --git a/servers/slapd/back-ldap/config.c b/servers/slapd/back-ldap/config.c index c82b410c1f..ec574b626c 100644 --- a/servers/slapd/back-ldap/config.c +++ b/servers/slapd/back-ldap/config.c @@ -132,7 +132,8 @@ ldap_back_db_config( fname, lineno ); return( 1 ); } - load_extop( (struct berval *)&slap_EXOP_WHOAMI, ldap_back_exop_whoami ); + load_extop( (struct berval *)&slap_EXOP_WHOAMI, + 0, ldap_back_exop_whoami ); /* dn massaging */ } else if ( strcasecmp( argv[0], "suffixmassage" ) == 0 ) { diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 9d10555416..ab899a5369 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -410,8 +410,8 @@ long connection_init( c->c_send_search_entry = slap_send_search_entry; c->c_send_search_reference = slap_send_search_reference; c->c_send_ldap_extended = slap_send_ldap_extended; -#ifdef LDAP_RES_INTERMEDIATE_RESP - c->c_send_ldap_intermediate_resp = slap_send_ldap_intermediate_resp; +#ifdef LDAP_RES_INTERMEDIATE + c->c_send_ldap_intermediate = slap_send_ldap_intermediate; #endif c->c_authmech.bv_val = NULL; diff --git a/servers/slapd/controls.c b/servers/slapd/controls.c index 20c4545c01..c5eacd2029 100644 --- a/servers/slapd/controls.c +++ b/servers/slapd/controls.c @@ -106,12 +106,12 @@ static struct slap_control control_defs[] = { parseNoOp, LDAP_SLIST_ENTRY_INITIALIZER(next) }, #ifdef LDAP_CLIENT_UPDATE { LDAP_CONTROL_CLIENT_UPDATE, - SLAP_CTRL_SEARCH, NULL, + SLAP_CTRL_HIDE|SLAP_CTRL_SEARCH, NULL, parseClientUpdate, LDAP_SLIST_ENTRY_INITIALIZER(next) }, #endif #ifdef LDAP_SYNC { LDAP_CONTROL_SYNC, - SLAP_CTRL_SEARCH, NULL, + SLAP_CTRL_HIDE|SLAP_CTRL_SEARCH, NULL, parseLdupSync, LDAP_SLIST_ENTRY_INITIALIZER(next) }, #endif { LDAP_CONTROL_MANAGEDSAIT, @@ -248,10 +248,14 @@ controls_root_dse_info( Entry *e ) vals[1].bv_len = 0; LDAP_SLIST_FOREACH( sc, &controls_list, sc_next ) { + if( sc->sc_mask & SLAP_CTRL_HIDE ) continue; + vals[0].bv_val = sc->sc_oid; vals[0].bv_len = strlen( sc->sc_oid ); - if ( attr_merge( e, ad_supportedControl, vals, NULL ) ) + + if ( attr_merge( e, ad_supportedControl, vals, NULL ) ) { return -1; + } } return 0; diff --git a/servers/slapd/extended.c b/servers/slapd/extended.c index 7ec130854f..a9a601476e 100644 --- a/servers/slapd/extended.c +++ b/servers/slapd/extended.c @@ -41,9 +41,16 @@ #define UNSUPPORTED_EXTENDEDOP "unsupported extended operation" +#ifdef LDAP_DEVEL +#define SLAP_EXOP_HIDE 0x0000 +#else +#define SLAP_EXOP_HIDE 0x8000 +#endif + static struct extop_list { struct extop_list *next; struct berval oid; + slap_mask_t flags; SLAP_EXTOP_MAIN_FN *ext_main; } *supp_ext_list = NULL; @@ -63,15 +70,16 @@ const struct berval slap_EXOP_START_TLS = BER_BVC(LDAP_EXOP_START_TLS); static struct { const struct berval *oid; + slap_mask_t flags; SLAP_EXTOP_MAIN_FN *ext_main; } builtin_extops[] = { #ifdef LDAP_EXOP_X_CANCEL - { &slap_EXOP_CANCEL, cancel_extop }, + { &slap_EXOP_CANCEL, SLAP_EXOP_HIDE, cancel_extop }, #endif - { &slap_EXOP_WHOAMI, whoami_extop }, - { &slap_EXOP_MODIFY_PASSWD, passwd_extop }, + { &slap_EXOP_WHOAMI, 0, whoami_extop }, + { &slap_EXOP_MODIFY_PASSWD, 0, passwd_extop }, #ifdef HAVE_TLS - { &slap_EXOP_START_TLS, starttls_extop }, + { &slap_EXOP_START_TLS, 0, starttls_extop }, #endif { NULL, NULL } }; @@ -80,21 +88,27 @@ static struct { static struct extop_list *find_extop( struct extop_list *list, struct berval *oid ); -struct berval * -get_supported_extop (int index) +int exop_root_dse_info( Entry *e ) { + AttributeDescription *ad_supportedExtension + = slap_schema.si_ad_supportedExtension; + struct berval vals[2]; struct extop_list *ext; - /* linear scan is slow, but this way doesn't force a - * big change on root_dse.c, where this routine is used. - */ - for (ext = supp_ext_list; ext != NULL && --index >= 0; ext = ext->next) { - ; /* empty */ - } + vals[1].bv_val = NULL; + vals[1].bv_len = 0; + + for (ext = supp_ext_list; ext != NULL; ext = ext->next) { + if( ext->flags & SLAP_EXOP_HIDE ) continue; - if (ext == NULL) return NULL; + vals[0] = ext->oid; - return &ext->oid ; + if( attr_merge( e, ad_supportedExtension, vals, NULL ) ) { + return LDAP_OTHER; + } + } + + return LDAP_SUCCESS; } int @@ -308,6 +322,7 @@ done: int load_extop( struct berval *ext_oid, + slap_mask_t ext_flags, SLAP_EXTOP_MAIN_FN *ext_main ) { struct extop_list *ext; @@ -320,6 +335,8 @@ load_extop( if (ext == NULL) return(-1); + ext->flags = ext_flags; + ext->oid.bv_val = (char *)(ext + 1); AC_MEMCPY( ext->oid.bv_val, ext_oid->bv_val, ext_oid->bv_len ); ext->oid.bv_len = ext_oid->bv_len; @@ -339,7 +356,9 @@ extops_init (void) int i; for (i = 0; builtin_extops[i].oid != NULL; i++) { - load_extop((struct berval *)builtin_extops[i].oid, builtin_extops[i].ext_main); + load_extop((struct berval *)builtin_extops[i].oid, + builtin_extops[i].flags, + builtin_extops[i].ext_main); } return(0); } diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 518f949bd7..050782828e 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -443,6 +443,8 @@ LDAP_SLAPD_F (int) entry_id_cmp LDAP_P(( const void *v_a, const void *v_b )); /* * extended.c */ +LDAP_SLAPD_F (int) exop_root_dse_info LDAP_P ((Entry *e)); + #ifdef LDAP_EXOP_X_CANCEL LDAP_SLAPD_V( const struct berval ) slap_EXOP_CANCEL; #endif @@ -457,14 +459,13 @@ typedef int (SLAP_EXTOP_GETOID_FN) LDAP_P(( LDAP_SLAPD_F (int) load_extop LDAP_P(( struct berval *ext_oid, + slap_mask_t flags, SLAP_EXTOP_MAIN_FN *ext_main )); LDAP_SLAPD_F (int) extops_init LDAP_P(( void )); LDAP_SLAPD_F (int) extops_kill LDAP_P(( void )); -LDAP_SLAPD_F (struct berval *) get_supported_extop LDAP_P((int index)); - /* * * cancel.c * */ @@ -808,7 +809,7 @@ LDAP_SLAPD_F (void) slap_send_ldap_result LDAP_P(( Operation *op, SlapReply *rs LDAP_SLAPD_F (void) send_ldap_sasl LDAP_P(( Operation *op, SlapReply *rs )); LDAP_SLAPD_F (void) send_ldap_disconnect LDAP_P(( Operation *op, SlapReply *rs )); LDAP_SLAPD_F (void) slap_send_ldap_extended LDAP_P(( Operation *op, SlapReply *rs )); -LDAP_SLAPD_F (void) slap_send_ldap_intermediate_resp LDAP_P(( Operation *op, SlapReply *rs )); +LDAP_SLAPD_F (void) slap_send_ldap_intermediate LDAP_P(( Operation *op, SlapReply *rs )); LDAP_SLAPD_F (void) slap_send_search_result LDAP_P(( Operation *op, SlapReply *rs )); LDAP_SLAPD_F (int) slap_send_search_reference LDAP_P(( Operation *op, SlapReply *rs )); LDAP_SLAPD_F (int) slap_send_search_entry LDAP_P(( Operation *op, SlapReply *rs )); diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 0e0899fae3..6e8ee40ab1 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -267,14 +267,20 @@ send_ldap_response( } #ifdef LDAP_CONNECTIONLESS - if (op->o_conn && op->o_conn->c_is_udp && op->o_protocol == LDAP_VERSION2) { + if (op->o_conn && op->o_conn->c_is_udp && + op->o_protocol == LDAP_VERSION2 ) + { rc = ber_printf( ber, "t{ess" /*"}}"*/, rs->sr_tag, rs->sr_err, rs->sr_matched == NULL ? "" : rs->sr_matched, rs->sr_text == NULL ? "" : rs->sr_text ); } else #endif - { + if ( rs->sr_type == REP_INTERMEDIATE ) { + rc = ber_printf( ber, "{it{" /*"}}"*/, + rs->sr_msgid, rs->sr_tag ); + + } else { rc = ber_printf( ber, "{it{ess" /*"}}"*/, rs->sr_msgid, rs->sr_tag, rs->sr_err, rs->sr_matched == NULL ? "" : rs->sr_matched, @@ -296,7 +302,9 @@ send_ldap_response( LDAP_TAG_SASL_RES_CREDS, rs->sr_sasldata ); } - if( rc != -1 && rs->sr_type == REP_EXTENDED ) { + if( rc != -1 && + ( rs->sr_type == REP_EXTENDED || rs->sr_type == REP_INTERMEDIATE )) + { if ( rs->sr_rspoid != NULL ) { rc = ber_printf( ber, "ts", LDAP_TAG_EXOP_RES_OID, rs->sr_rspoid ); @@ -551,11 +559,10 @@ slap_send_ldap_extended( Operation *op, SlapReply *rs ) send_ldap_response( op, rs ); } -#ifdef LDAP_RES_INTERMEDIATE_RESP void -slap_send_ldap_intermediate_resp( Operation *op, SlapReply *rs ) +slap_send_ldap_intermediate( Operation *op, SlapReply *rs ) { - rs->sr_type = REP_EXTENDED; + rs->sr_type = REP_INTERMEDIATE; #ifdef NEW_LOGGING LDAP_LOG( OPERATION, ENTRY, "send_ldap_intermediate: err=%d oid=%s len=%ld\n", @@ -568,11 +575,10 @@ slap_send_ldap_intermediate_resp( Operation *op, SlapReply *rs ) rs->sr_rspoid ? rs->sr_rspoid : "", rs->sr_rspdata != NULL ? rs->sr_rspdata->bv_len : 0 ); #endif - rs->sr_tag = LDAP_RES_INTERMEDIATE_RESP; + rs->sr_tag = LDAP_RES_INTERMEDIATE; rs->sr_msgid = op->o_msgid; send_ldap_response( op, rs ); } -#endif int slap_send_search_entry( Operation *op, SlapReply *rs ) diff --git a/servers/slapd/root_dse.c b/servers/slapd/root_dse.c index 5357ed46fb..06f1ea12b2 100644 --- a/servers/slapd/root_dse.c +++ b/servers/slapd/root_dse.c @@ -139,29 +139,22 @@ root_dse_info( } /* supportedExtension */ - for ( i=0; (bv = get_supported_extop(i)) != NULL; i++ ) { - vals[0] = *bv; - if( attr_merge( e, ad_supportedExtension, vals, NULL ) ) - { - return LDAP_OTHER; - } + if ( exop_root_dse_info( e ) != 0 ) { + return LDAP_OTHER; } #ifdef LDAP_SLAPI /* netscape supportedExtension */ for ( i = 0; (bv = ns_get_supported_extop(i)) != NULL; i++ ) { vals[0] = *bv; - if( attr_merge( e, ad_supportedExtension, vals, NULL )) - { + if( attr_merge( e, ad_supportedExtension, vals, NULL )) { return LDAP_OTHER; } } #endif /* LDAP_SLAPI */ /* supportedFeatures */ - if( attr_merge( e, ad_supportedFeatures, - supportedFeatures, NULL ) ) - { + if( attr_merge( e, ad_supportedFeatures, supportedFeatures, NULL ) ) { return LDAP_OTHER; } diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index eccdd53baf..8bb263f880 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -2773,7 +2773,7 @@ static slap_mrule_defs_rec mrule_defs[] = { /* needs updating */ {"( 1.3.6.1.4.1.4203.666.4.1 NAME 'authPasswordMatch' " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )", - SLAP_MR_EQUALITY, NULL, + SLAP_MR_HIDE | SLAP_MR_EQUALITY, NULL, NULL, NULL, authPasswordMatch, NULL, NULL, NULL}, @@ -2782,7 +2782,7 @@ static slap_mrule_defs_rec mrule_defs[] = { #ifdef SLAPD_ACI_ENABLED {"( 1.3.6.1.4.1.4203.666.4.2 NAME 'OpenLDAPaciMatch' " "SYNTAX 1.3.6.1.4.1.4203.666.2.1 )", - SLAP_MR_EQUALITY, NULL, + SLAP_MR_HIDE | SLAP_MR_EQUALITY, NULL, NULL, NULL, OpenLDAPaciMatch, NULL, NULL, NULL}, diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index a06af9fb6a..0cc4b2ecc1 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -225,27 +225,26 @@ static struct slap_schema_oc_map { offsetof(struct slap_internal_schema, si_oc_dynamicObject) }, #endif #ifdef LDAP_SYNCREPL - { "glue", "( 1.3.6.1.4.1.4203.666.3.4 " - "NAME 'glue' " - "DESC 'Glue Entry' " - "SUP top STRUCTURAL )", - 0, SLAP_OC_OPERATIONAL, - offsetof(struct slap_internal_schema, si_oc_glue) }, - - { "syncConsumerSubentry", "( 1.3.6.1.4.1.4203.666.3.5 " - "NAME 'syncConsumerSubentry' " - "DESC 'Persistent Info for SyncRepl Consumer' " - "AUXILIARY " - "MAY syncreplCookie )", - 0, SLAP_OC_OPERATIONAL, - offsetof(struct slap_internal_schema, si_oc_syncConsumerSubentry) }, - { "syncProviderSubentry", "( 1.3.6.1.4.1.4203.666.3.6 " - "NAME 'syncProviderSubentry' " - "DESC 'Persistent Info for SyncRepl Producer' " - "AUXILIARY " - "MAY syncreplCookie )", - 0, SLAP_OC_OPERATIONAL, - offsetof(struct slap_internal_schema, si_oc_syncProviderSubentry) }, + { "glue", "( 1.3.6.1.4.1.4203.666.3.4 " + "NAME 'glue' " + "DESC 'Glue Entry' " + "SUP top STRUCTURAL )", + 0, SLAP_OC_OPERATIONAL|SLAP_OC_HIDE, + offsetof(struct slap_internal_schema, si_oc_glue) }, + { "syncConsumerSubentry", "( 1.3.6.1.4.1.4203.666.3.5 " + "NAME 'syncConsumerSubentry' " + "DESC 'Persistent Info for SyncRepl Consumer' " + "AUXILIARY " + "MAY syncreplCookie )", + 0, SLAP_OC_OPERATIONAL|SLAP_OC_HIDE, + offsetof(struct slap_internal_schema, si_oc_syncConsumerSubentry) }, + { "syncProviderSubentry", "( 1.3.6.1.4.1.4203.666.3.6 " + "NAME 'syncProviderSubentry' " + "DESC 'Persistent Info for SyncRepl Producer' " + "AUXILIARY " + "MAY syncreplCookie )", + 0, SLAP_OC_OPERATIONAL|SLAP_OC_HIDE, + offsetof(struct slap_internal_schema, si_oc_syncProviderSubentry) }, #endif { NULL, NULL, NULL, 0, 0 } @@ -370,7 +369,7 @@ static struct slap_schema_ad_map { #endif { "entryUUID", "( 1.3.6.1.4.1.4203.666.1.6 NAME 'entryUUID' " - "DESC 'LCUP/LDUP: UUID of the entry' " + "DESC 'UUID of the entry' " "EQUALITY octetStringMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", @@ -379,7 +378,7 @@ static struct slap_schema_ad_map { NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entryUUID) }, { "entryCSN", "( 1.3.6.1.4.1.4203.666.1.7 NAME 'entryCSN' " - "DESC 'LCUP/LDUP: change sequence number of the entry content' " + "DESC 'change sequence number of the entry content' " "EQUALITY octetStringMatch " "ORDERING octetStringOrderingMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " @@ -389,7 +388,7 @@ static struct slap_schema_ad_map { NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_entryCSN) }, { "namingCSN", "( 1.3.6.1.4.1.4203.666.1.13 NAME 'namingCSN' " - "DESC 'LCUP/LDUP: change sequence number of the entry naming (RDN)' " + "DESC 'change sequence number of the entry naming (RDN)' " "EQUALITY octetStringMatch " "ORDERING octetStringOrderingMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " @@ -400,7 +399,7 @@ static struct slap_schema_ad_map { offsetof(struct slap_internal_schema, si_ad_namingCSN) }, { "superiorUUID", "( 1.3.6.1.4.1.4203.666.1.11 NAME 'superiorUUID' " - "DESC 'LCUP/LDUP: UUID of the superior entry' " + "DESC 'UUID of the superior entry' " "EQUALITY octetStringMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )", @@ -416,7 +415,7 @@ static struct slap_schema_ad_map { "EQUALITY octetStringMatch " "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} " "NO-USER-MODIFICATION USAGE directoryOperation )", - NULL, 0, /* SLAP_AT_HIDE or SLAP_AT_NONE ? */ + NULL, SLAP_AT_HIDE, NULL, NULL, NULL, NULL, NULL, NULL, NULL, offsetof(struct slap_internal_schema, si_ad_queryid) }, diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 4fdafe11a0..1fa5295cf9 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -32,13 +32,12 @@ #include #include +#include "lber_pvt.h" #include "ldap_pvt_thread.h" #include "ldap_queue.h" -#ifdef LDAP_DEVEL #define SLAP_EXTENDED_SCHEMA 1 -#define LDAP_CACHING -#endif +#define LDAP_CACHING 1 LDAP_BEGIN_DECL /* @@ -321,7 +320,11 @@ typedef struct slap_syntax { #define SLAP_SYNTAX_BLOB 0x0001U /* syntax treated as blob (audio) */ #define SLAP_SYNTAX_BINARY 0x0002U /* binary transfer required (certificate) */ #define SLAP_SYNTAX_BER 0x0004U /* stored in BER encoding (certificate) */ +#ifdef LDAP_DEVEL +#define SLAP_SYNTAX_HIDE 0x0000U /* publish everything */ +#else #define SLAP_SYNTAX_HIDE 0x8000U /* hide (do not publish) */ +#endif slap_syntax_validate_func *ssyn_validate; slap_syntax_transform_func *ssyn_pretty; @@ -418,7 +421,11 @@ typedef struct slap_matching_rule { slap_mask_t smr_usage; +#ifdef LDAP_DEVEL +#define SLAP_MR_HIDE 0x0000U +#else #define SLAP_MR_HIDE 0x8000U +#endif #define SLAP_MR_TYPE_MASK 0x0F00U #define SLAP_MR_SUBTYPE_MASK 0x00F0U @@ -571,7 +578,11 @@ typedef struct slap_attribute_type { #define SLAP_AT_NONE 0x0000U #define SLAP_AT_ABSTRACT 0x0100U /* cannot be instantiated */ #define SLAP_AT_FINAL 0x0200U /* cannot be subtyped */ +#ifdef LDAP_DEVEL +#define SLAP_AT_HIDE 0x0000U /* publish everything */ +#else #define SLAP_AT_HIDE 0x8000U /* hide attribute */ +#endif slap_mask_t sat_flags; LDAP_SLIST_ENTRY(slap_attribute_type) sat_next; @@ -639,7 +650,11 @@ typedef struct slap_object_class { #define SLAP_OC__MASK 0x001F #define SLAP_OC__END 0x0020 #define SLAP_OC_OPERATIONAL 0x4000 +#ifdef LDAP_DEVEL +#define SLAP_OC_HIDE 0x0000 +#else #define SLAP_OC_HIDE 0x8000 +#endif /* * DIT content rule @@ -703,9 +718,9 @@ struct slap_internal_schema { ObjectClass *si_oc_dynamicObject; #ifdef LDAP_SYNCREPL - ObjectClass *si_oc_glue; - ObjectClass *si_oc_syncConsumerSubentry; - ObjectClass *si_oc_syncProviderSubentry; + ObjectClass *si_oc_glue; + ObjectClass *si_oc_syncConsumerSubentry; + ObjectClass *si_oc_syncProviderSubentry; #endif /* objectClass attribute descriptions */ @@ -732,8 +747,8 @@ struct slap_internal_schema { #endif /* LDAP_CACHING */ #ifdef LDAP_SYNCREPL - AttributeDescription *si_ad_dseType; - AttributeDescription *si_ad_syncreplCookie; + AttributeDescription *si_ad_dseType; + AttributeDescription *si_ad_syncreplCookie; #endif /* root DSE attribute descriptions */ @@ -1268,7 +1283,6 @@ typedef BackendDB Backend; #define backends backendDB #ifdef LDAP_SYNCREPL - struct nonpresent_entry { struct berval *dn; struct berval *ndn; @@ -1577,7 +1591,8 @@ typedef enum slap_reply_e { REP_SASL, REP_EXTENDED, REP_SEARCH, - REP_SEARCHREF + REP_SEARCHREF, + REP_INTERMEDIATE } slap_reply_t; typedef struct rep_sasl_s { @@ -1983,27 +1998,36 @@ typedef struct slap_op { #endif } Operation; -#define send_ldap_error( op, rs, err, text ) \ -do { (rs)->sr_err = err; (rs)->sr_text = text; \ -(op->o_conn->c_send_ldap_result)( op, rs ); } while (0) -#define send_ldap_discon( op, rs, err, text ) \ -do { (rs)->sr_err = err; (rs)->sr_text = text; \ -send_ldap_disconnect( op, rs ); } while (0) -typedef void (SEND_LDAP_RESULT)(struct slap_op *op, struct slap_rep *rs); -typedef int (SEND_SEARCH_ENTRY)(struct slap_op *op, struct slap_rep *rs); -typedef int (SEND_SEARCH_REFERENCE)(struct slap_op *op, struct slap_rep *rs); -typedef void (SEND_LDAP_EXTENDED)(struct slap_op *op, struct slap_rep *rs); -typedef void (SEND_LDAP_INTERMEDIATE_RESP)(struct slap_op *op, struct slap_rep *rs); +#define send_ldap_error( op, rs, err, text ) do { \ + (rs)->sr_err = err; (rs)->sr_text = text; \ + (op->o_conn->c_send_ldap_result)( op, rs ); \ + } while (0) +#define send_ldap_discon( op, rs, err, text ) do { \ + (rs)->sr_err = err; (rs)->sr_text = text; \ + send_ldap_disconnect( op, rs ); \ + } while (0) + +typedef void (SEND_LDAP_RESULT)( + struct slap_op *op, struct slap_rep *rs); +typedef int (SEND_SEARCH_ENTRY)( + struct slap_op *op, struct slap_rep *rs); +typedef int (SEND_SEARCH_REFERENCE)( + struct slap_op *op, struct slap_rep *rs); +typedef void (SEND_LDAP_EXTENDED)( + struct slap_op *op, struct slap_rep *rs); +typedef void (SEND_LDAP_INTERMEDIATE)( + struct slap_op *op, struct slap_rep *rs); + #define send_ldap_result( op, rs ) \ -(op->o_conn->c_send_ldap_result)( op, rs ) + (op->o_conn->c_send_ldap_result)( op, rs ) #define send_search_entry( op, rs ) \ -(op->o_conn->c_send_search_entry)( op, rs ) + (op->o_conn->c_send_search_entry)( op, rs ) #define send_search_reference( op, rs ) \ -(op->o_conn->c_send_search_reference)( op, rs ) + (op->o_conn->c_send_search_reference)( op, rs ) #define send_ldap_extended( op, rs ) \ -(op->o_conn->c_send_ldap_extended)( op, rs ) -#define send_ldap_intermediate_resp( op, rs ) \ -(op->o_conn->c_send_ldap_intermediate_resp)( op, rs ) + (op->o_conn->c_send_ldap_extended)( op, rs ) +#define send_ldap_intermediate( op, rs ) \ + (op->o_conn->c_send_ldap_intermediate)( op, rs ) /* * Caches the result of a backend_group check for ACL evaluation @@ -2099,10 +2123,10 @@ typedef struct slap_conn { SEND_SEARCH_ENTRY *c_send_search_entry; SEND_SEARCH_REFERENCE *c_send_search_reference; SEND_LDAP_EXTENDED *c_send_ldap_extended; -#ifdef LDAP_RES_INTERMEDIATE_RESP - SEND_LDAP_INTERMEDIATE_RESP *c_send_ldap_intermediate_resp; +#ifdef LDAP_RES_INTERMEDIATE + SEND_LDAP_INTERMEDIATE *c_send_ldap_intermediate; #endif - + } Connection; #if defined(LDAP_SYSLOG) && defined(LDAP_DEBUG) @@ -2185,8 +2209,14 @@ enum { #define SLAP_SEARCH_MAX_CTRLS 10 #endif -#define SLAP_CTRL_FRONTEND 0x80000000U -#define SLAP_CTRL_FRONTEND_SEARCH 0x01000000U /* for NOOP */ +#ifdef LDAP_DEVEL +#define SLAP_CTRL_HIDE 0x00000000U +#else +#define SLAP_CTRL_HIDE 0x80000000U +#endif + +#define SLAP_CTRL_FRONTEND 0x00800000U +#define SLAP_CTRL_FRONTEND_SEARCH 0x00010000U /* for NOOP */ #define SLAP_CTRL_OPFLAGS 0x0000FFFFU #define SLAP_CTRL_ABANDON 0x00000001U diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 178845cb6a..6bc0b045a9 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -524,7 +524,7 @@ do_syncrepl( ber_write( ctrl_ber, rctrlp->ldctl_value.bv_val, rctrlp->ldctl_value.bv_len, 0 ); ber_reset( ctrl_ber, 1 ); - ber_scanf( ctrl_ber, "{" ); + ber_scanf( ctrl_ber, "{" /*"}"*/); if ( ber_peek_tag( ctrl_ber, &len ) == LDAP_SYNC_TAG_COOKIE ) { ber_scanf( ctrl_ber, "o", &syncCookie ); @@ -556,13 +556,13 @@ do_syncrepl( } break; - case LDAP_RES_INTERMEDIATE_RESP: - ldap_parse_intermediate_resp_result( ld, msg, - &retoid, &retdata, 0 ); - if ( !strcmp( retoid, LDAP_SYNC_INFO ) ) { + case LDAP_RES_INTERMEDIATE: + rc = ldap_parse_intermediate( ld, msg, + &retoid, &retdata, NULL, 0 ); + if ( !rc && !strcmp( retoid, LDAP_SYNC_INFO ) ) { sync_info_arrived = 1; res_ber = ber_init( retdata ); - ber_scanf( res_ber, "{e", &syncstate ); + ber_scanf( res_ber, "{e" /*"}"*/, &syncstate ); if ( syncstate == LDAP_SYNC_REFRESH_DONE ) { syncrepl_del_nonpresent( ld, &op ); @@ -578,7 +578,7 @@ do_syncrepl( if ( ber_peek_tag( res_ber, &len ) == LDAP_SYNC_TAG_COOKIE ) { - ber_scanf( res_ber, "o}", &syncCookie ); + ber_scanf( res_ber, /*"{"*/ "o}", &syncCookie ); if ( syncCookie.bv_len ) { ber_bvfree( si->syncCookie ); si->syncCookie = ber_dupbv( NULL, &syncCookie ); @@ -606,8 +606,8 @@ do_syncrepl( "response\n", 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, "do_syncrepl : " - "unknown intermediate " - "response\n", 0, 0, 0 ); + "unknown intermediate response (%d)\n", + rc, 0, 0 ); #endif ldap_memfree( retoid ); ber_bvfree( retdata ); -- 2.39.5