From: Howard Chu Date: Wed, 19 Feb 2003 00:01:22 +0000 (+0000) Subject: Fix do/don't send result logic X-Git-Tag: NO_SLAP_OP_BLOCKS~337 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=9f0598034e3ed8cb3ecce2c3371e721026faba80;p=openldap Fix do/don't send result logic --- diff --git a/servers/slapd/back-ldap/add.c b/servers/slapd/back-ldap/add.c index 2b02a50ba3..4b03b68d58 100644 --- a/servers/slapd/back-ldap/add.c +++ b/servers/slapd/back-ldap/add.c @@ -187,7 +187,7 @@ ldap_back_add( free( mdn.bv_val ); } - return( ldap_back_op_result( li, lc, conn, op, msgid, j ) ); + return( ldap_back_op_result( li, lc, conn, op, msgid, j, 1 ) ); } #ifdef ENABLE_REWRITE diff --git a/servers/slapd/back-ldap/back-ldap.h b/servers/slapd/back-ldap/back-ldap.h index d2dc6c9f19..921d7be53e 100644 --- a/servers/slapd/back-ldap/back-ldap.h +++ b/servers/slapd/back-ldap/back-ldap.h @@ -95,8 +95,8 @@ struct ldapconn *ldap_back_getconn(struct ldapinfo *li, struct slap_conn *conn, struct slap_op *op); int ldap_back_dobind(struct ldapinfo *li, struct ldapconn *lc, Connection *conn, Operation *op); int ldap_back_map_result(int err); -int ldap_back_op_result(struct ldapinfo *li, struct ldapconn *lc, Connection *conn, Operation *op, - ber_int_t msgid, int rc); +int ldap_back_op_result(struct ldapinfo *li, struct ldapconn *lc, + Connection *conn, Operation *op, ber_int_t msgid, int rc, int sendok); int back_ldap_LTX_init_module(int argc, char *argv[]); void ldap_back_dn_massage(struct ldapinfo *li, struct berval *dn, diff --git a/servers/slapd/back-ldap/bind.c b/servers/slapd/back-ldap/bind.c index fe6b6e6c03..1e4ad1b770 100644 --- a/servers/slapd/back-ldap/bind.c +++ b/servers/slapd/back-ldap/bind.c @@ -116,7 +116,7 @@ ldap_back_bind( /* method is always LDAP_AUTH_SIMPLE if we got here */ rc = ldap_sasl_bind(lc->ld, mdn.bv_val, LDAP_SASL_SIMPLE, cred, op->o_ctrls, NULL, &msgid); - rc = ldap_back_op_result( li, lc, conn, op, msgid, rc ); + rc = ldap_back_op_result( li, lc, conn, op, msgid, rc, 1 ); if (rc == LDAP_SUCCESS) { lc->bound = 1; if ( mdn.bv_val != dn->bv_val ) { @@ -419,7 +419,7 @@ ldap_back_dobind( struct ldapinfo *li, struct ldapconn *lc, Connection *conn, Op if ( !lc->bound ) { rc = ldap_sasl_bind(lc->ld, lc->bound_dn.bv_val, LDAP_SASL_SIMPLE, &lc->cred, NULL, NULL, &msgid); - rc = ldap_back_op_result( li, lc, conn, op, msgid, rc ); + rc = ldap_back_op_result( li, lc, conn, op, msgid, rc, 0 ); if (rc == LDAP_SUCCESS) { lc->bound = 1; } @@ -493,10 +493,11 @@ ldap_back_map_result(int err) int ldap_back_op_result(struct ldapinfo *li, struct ldapconn *lc, - Connection *conn, Operation *op, ber_int_t msgid, int err) + Connection *conn, Operation *op, ber_int_t msgid, int err, int sendok) { char *msg = NULL; char *match = NULL; + char *mmatch = NULL; LDAPMessage *res; int rc; @@ -514,7 +515,6 @@ ldap_back_op_result(struct ldapinfo *li, struct ldapconn *lc, /* internal ops must not reply to client */ if ( conn && !op->o_do_not_cache ) { - char *mmatch = NULL; #ifdef ENABLE_REWRITE if (match) { @@ -535,10 +535,12 @@ ldap_back_op_result(struct ldapinfo *li, struct ldapconn *lc, mmatch = mdn.bv_val; } #endif - send_ldap_result( conn, op, err, mmatch, msg, NULL, NULL ); - if (mmatch != match) free(mmatch); } } + if (sendok || err != LDAP_SUCCESS) { + send_ldap_result( conn, op, err, mmatch, msg, NULL, NULL ); + } + if (mmatch != match) free(mmatch); if ( match ) free( match ); if ( msg ) free( msg ); return( (err==LDAP_SUCCESS) ? 0 : -1 ); diff --git a/servers/slapd/back-ldap/compare.c b/servers/slapd/back-ldap/compare.c index 348736f2f1..e16253057e 100644 --- a/servers/slapd/back-ldap/compare.c +++ b/servers/slapd/back-ldap/compare.c @@ -124,5 +124,5 @@ ldap_back_compare( free( mdn.bv_val ); } - return( ldap_back_op_result( li, lc, conn, op, msgid, rc ) ); + return( ldap_back_op_result( li, lc, conn, op, msgid, rc, 1 ) ); } diff --git a/servers/slapd/back-ldap/delete.c b/servers/slapd/back-ldap/delete.c index a2e737f7a8..fb642b7817 100644 --- a/servers/slapd/back-ldap/delete.c +++ b/servers/slapd/back-ldap/delete.c @@ -105,5 +105,5 @@ ldap_back_delete( free( mdn.bv_val ); } - return( ldap_back_op_result( li, lc, conn, op, msgid, rc ) ); + return( ldap_back_op_result( li, lc, conn, op, msgid, rc, 1 ) ); } diff --git a/servers/slapd/back-ldap/modify.c b/servers/slapd/back-ldap/modify.c index 83de06937a..dc10dfe461 100644 --- a/servers/slapd/back-ldap/modify.c +++ b/servers/slapd/back-ldap/modify.c @@ -171,6 +171,6 @@ cleanup:; ch_free(modv[i]->mod_bvalues); ch_free(mods); ch_free(modv); - return( ldap_back_op_result( li, lc, conn, op, msgid, rc )); + return( ldap_back_op_result( li, lc, conn, op, msgid, rc, 1 )); } diff --git a/servers/slapd/back-ldap/modrdn.c b/servers/slapd/back-ldap/modrdn.c index 447122920a..31739cec7a 100644 --- a/servers/slapd/back-ldap/modrdn.c +++ b/servers/slapd/back-ldap/modrdn.c @@ -159,5 +159,5 @@ ldap_back_modrdn( free( mnewSuperior.bv_val ); } - return( ldap_back_op_result( li, lc, conn, op, msgid, rc ) ); + return( ldap_back_op_result( li, lc, conn, op, msgid, rc, 1 ) ); } diff --git a/servers/slapd/back-ldap/search.c b/servers/slapd/back-ldap/search.c index 3db8993455..404f9e37e2 100644 --- a/servers/slapd/back-ldap/search.c +++ b/servers/slapd/back-ldap/search.c @@ -265,7 +265,7 @@ ldap_back_search( : NULL, slimit, &msgid); if ( rc != LDAP_SUCCESS ) { fail:; - rc = ldap_back_op_result(li, lc, conn, op, msgid, rc); + rc = ldap_back_op_result(li, lc, conn, op, msgid, rc, 0); goto finish; }