Commit 12304f64 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Merge partial and intermediate responses

parent 21927e2c
......@@ -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 );
}
......
......@@ -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:
*/
......
......@@ -10,7 +10,12 @@
* top-level directory of the distribution.
*/
#ifdef LDAP_SYNCREPL
#ifndef LDAP_RQ_H
#define LDAP_RQ_H 1
#include <ldap_cdefs.h>
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
......@@ -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;
......
......@@ -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 (
......
......@@ -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";
......
......@@ -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 );
}
......
......@@ -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
......@@ -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 );
......
......@@ -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;
......
......@@ -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 ));
......
......@@ -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 );
}
......
......@@ -32,6 +32,7 @@
#include <ldap.h>
#include <ldap_schema.h>
#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;
......
......@@ -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 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment