From: Kurt Zeilenga Date: Sat, 31 May 2003 05:01:49 +0000 (+0000) Subject: Merge partial and intermediate responses X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~961 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=12304f64e50138c343653c94fafc0be99b5c87eb;p=openldap Merge partial and intermediate responses --- 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/include/ldap.h b/include/ldap.h index 83bd5d96f0..c59c91720d 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -330,8 +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 */ -#define LDAP_RES_INTERMEDIATE_RESP ((ber_tag_t) 0x7aU) +#define LDAP_RES_INTERMEDIATE ((ber_tag_t) 0x79U) /* V3+: application + constructed */ #define LDAP_RES_ANY (-1) #define LDAP_RES_UNSOLICITED (0) @@ -692,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, @@ -700,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..dcb43d9abb 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,7 +396,7 @@ free_and_return: return LDAP_SUCCESS; } -#ifdef LDAP_RES_INTERMEDIATE_RESP +#if 0 /* Parse an intermediate response result */ int ldap_parse_intermediate_resp_result ( diff --git a/libraries/libldap/result.c b/libraries/libldap/result.c index 228781c11a..f3ae525329 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; } @@ -957,7 +957,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 +1109,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/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/proto-slap.h b/servers/slapd/proto-slap.h index 518f949bd7..6451090783 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -808,7 +808,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..0888e3e74b 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -551,9 +551,9 @@ slap_send_ldap_extended( Operation *op, SlapReply *rs ) send_ldap_response( op, rs ); } -#ifdef LDAP_RES_INTERMEDIATE_RESP +#ifdef LDAP_RES_INTERMEDIATE void -slap_send_ldap_intermediate_resp( Operation *op, SlapReply *rs ) +slap_send_ldap_intermediate( Operation *op, SlapReply *rs ) { rs->sr_type = REP_EXTENDED; #ifdef NEW_LOGGING @@ -568,7 +568,7 @@ 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 ); } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 87ee2dcf4c..e6704a240c 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -32,6 +32,7 @@ #include #include +#include "lber_pvt.h" #include "ldap_pvt_thread.h" #include "ldap_queue.h" @@ -1997,7 +1998,7 @@ 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)( +typedef void (SEND_LDAP_INTERMEDIATE)( struct slap_op *op, struct slap_rep *rs); #define send_ldap_result( op, rs ) \ @@ -2008,8 +2009,8 @@ typedef void (SEND_LDAP_INTERMEDIATE_RESP)( (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 ) +#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 @@ -2105,8 +2106,8 @@ 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; diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 178845cb6a..4c5222d465 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -556,9 +556,8 @@ do_syncrepl( } break; - case LDAP_RES_INTERMEDIATE_RESP: - ldap_parse_intermediate_resp_result( ld, msg, - &retoid, &retdata, 0 ); + case LDAP_RES_INTERMEDIATE: + ldap_parse_intermediate( ld, msg, &retoid, &retdata, NULL, 0 ); if ( !strcmp( retoid, LDAP_SYNC_INFO ) ) { sync_info_arrived = 1; res_ber = ber_init( retdata );