From: Kurt Zeilenga Date: Sat, 31 May 2003 05:32:57 +0000 (+0000) Subject: Fix intermediate responses X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~959 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=11f990a64102e45fde42a7c3e1bad5fec4ec82a9;p=openldap Fix intermediate responses --- diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 0888e3e74b..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 void 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", @@ -572,7 +579,6 @@ slap_send_ldap_intermediate( Operation *op, SlapReply *rs ) 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/slap.h b/servers/slapd/slap.h index e6704a240c..0e4ecde52e 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1575,7 +1575,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 { diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 4c5222d465..6f4eb6d04a 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -557,8 +557,9 @@ do_syncrepl( break; case LDAP_RES_INTERMEDIATE: - ldap_parse_intermediate( ld, msg, &retoid, &retdata, NULL, 0 ); - if ( !strcmp( retoid, LDAP_SYNC_INFO ) ) { + 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 ); @@ -605,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 );