]> git.sur5r.net Git - openldap/commitdiff
Merge partial and intermediate responses
authorKurt Zeilenga <kurt@openldap.org>
Sat, 31 May 2003 05:01:49 +0000 (05:01 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 31 May 2003 05:01:49 +0000 (05:01 +0000)
14 files changed:
clients/tools/ldapsearch.c
include/ldap.h
include/ldap_rq.h
libraries/libldap/error.c
libraries/libldap/extended.c
libraries/libldap/result.c
libraries/libldap/search.c
libraries/libldap_r/rq.c
servers/slapd/back-bdb/search.c
servers/slapd/connection.c
servers/slapd/proto-slap.h
servers/slapd/result.c
servers/slapd/slap.h
servers/slapd/syncrepl.c

index f73700491f3730ed5c82ad4e2d4bd52014029b4b..399933196cde8baa2003eaf3cb6c5c67bf2bd176 100644 (file)
@@ -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 );
        }
 
index 83bd5d96f05b1047945432a4667e84556ac7ba04..c59c91720dbf6065183ca7d806d64eed1f8201b0 100644 (file)
@@ -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:
  */
index 084684eb31c5bdeb46a1bf9dfd8b559fb1956bfd..de6f32a936b49dbbd81edba71c910a94de911e24 100644 (file)
  * 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
index 477cf88984cb05534bcd5b32d6da6526e3cfe39a..464b9e5172ce3877669cec5c75db24f977d53b93 100644 (file)
@@ -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;
index 9102e9ccc3d8f2134bf0847ea631043ccff85cc2..dcb43d9abb7a3a722b6848ff610bfd8dbf54ab34 100644 (file)
@@ -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 (
index 228781c11a1dcf8fa10618086ec8bc90982cb24b..f3ae5253292f7cda84fac65b9bd54cf6b3f96a3c 100644 (file)
@@ -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";
index c6516f5e02ae9c29ecf71eae6a671542629bd7c5..56c45c2eed17cd222a1c3726a93c5ea5e1024941 100644 (file)
@@ -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 );
        }
 
index 77d4227a422977b484d173c93571e3dd95f6b02c..29153ccc7270ef1d7b260ef4d65ae627cfeb7fd4 100644 (file)
@@ -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
index a4f2ef67bd2a3e8720203c4fedf7ed027d6377e4..2c4c80e3ae0eedc6ff73680f08327d3d29cd8b59 100644 (file)
@@ -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 );
 
index 9d105554168eff5ce503ca677d6020830307526b..ab899a5369403d6db387b609e240b04438f2663f 100644 (file)
@@ -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;
index 518f949bd77043bfe367c50c5d8341342622cd38..6451090783d6d425d7c2a1a33355a4376645b670 100644 (file)
@@ -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 ));
index 0e0899fae39d83291c7c28ed45f03e996fcb8afb..0888e3e74bf81da526beab2c2a20a99eda2f0dcd 100644 (file)
@@ -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 );
 }
index 87ee2dcf4ce82cb8c566aa50339cb1552fbf82ce..e6704a240c9fa4310b7daff4eeeb4db2f5ae8b92 100644 (file)
@@ -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;
index 178845cb6aef20a5fd9e32045c7f7d7bd8453a91..4c5222d465491362d3d72ddea2052d8232dbefec 100644 (file)
@@ -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 );