From b70abdcbce1544c95130102c7c01c7f1c1740ecd Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sun, 23 Jan 2005 21:44:23 +0000 Subject: [PATCH] global overlays need to set o_bd = frontendDB to return the error in case no database can be selected --- servers/slapd/add.c | 4 ++++ servers/slapd/bind.c | 2 ++ servers/slapd/compare.c | 2 ++ servers/slapd/delete.c | 4 ++++ servers/slapd/modify.c | 4 ++++ servers/slapd/modrdn.c | 4 ++++ servers/slapd/search.c | 2 ++ 7 files changed, 22 insertions(+) diff --git a/servers/slapd/add.c b/servers/slapd/add.c index 204caa0380..92f6759aea 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -220,14 +220,18 @@ fe_op_add( Operation *op, SlapReply *rs ) if ( !rs->sr_ref ) rs->sr_ref = default_referral; if ( rs->sr_ref ) { rs->sr_err = LDAP_REFERRAL; + op->o_bd = frontendDB; send_ldap_result( op, rs ); + op->o_bd = NULL; if ( rs->sr_ref != default_referral ) { ber_bvarray_free( rs->sr_ref ); } } else { + op->o_bd = frontendDB; send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, "no global superior knowledge" ); + op->o_bd = NULL; } goto done; } diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index cbc6abd83e..c39caea9f6 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -464,7 +464,9 @@ fe_op_bind( Operation *op, SlapReply *rs ) /* don't return referral for bind requests */ /* noSuchObject is not allowed to be returned by bind */ rs->sr_err = LDAP_INVALID_CREDENTIALS; + op->o_bd = frontendDB; send_ldap_result( op, rs ); + op->o_bd = NULL; goto cleanup; } diff --git a/servers/slapd/compare.c b/servers/slapd/compare.c index ed575fd1e8..d6596c2487 100644 --- a/servers/slapd/compare.c +++ b/servers/slapd/compare.c @@ -208,7 +208,9 @@ fe_op_compare( Operation *op, SlapReply *rs ) rs->sr_err = LDAP_REFERRAL; if (!rs->sr_ref) rs->sr_ref = default_referral; + op->o_bd = frontendDB; send_ldap_result( op, rs ); + op->o_bd = NULL; if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref ); rs->sr_err = 0; diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index a1004f7967..6762093c4a 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -124,12 +124,16 @@ fe_op_delete( Operation *op, SlapReply *rs ) if ( rs->sr_ref != NULL ) { rs->sr_err = LDAP_REFERRAL; + op->o_bd = frontendDB; send_ldap_result( op, rs ); + op->o_bd = NULL; if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref ); } else { + op->o_bd = frontendDB; send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, "no global superior knowledge" ); + op->o_bd = NULL; } goto cleanup; } diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 88a120bd74..ea961ef57f 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -316,12 +316,16 @@ fe_op_modify( Operation *op, SlapReply *rs ) if (rs->sr_ref != NULL ) { rs->sr_err = LDAP_REFERRAL; + op->o_bd = frontendDB; send_ldap_result( op, rs ); + op->o_bd = NULL; if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref ); } else { + op->o_bd = frontendDB; send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, "no global superior knowledge" ); + op->o_bd = NULL; } goto cleanup; } diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 44f97d059e..c9e6c02dac 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -238,12 +238,16 @@ fe_op_modrdn( Operation *op, SlapReply *rs ) if ( rs->sr_ref != NULL ) { rs->sr_err = LDAP_REFERRAL; + op->o_bd = frontendDB; send_ldap_result( op, rs ); + op->o_bd = NULL; if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref ); } else { + op->o_bd = frontendDB; send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM, "no global superior knowledge" ); + op->o_bd = NULL; } goto cleanup; } diff --git a/servers/slapd/search.c b/servers/slapd/search.c index 283fb6dfcf..a162b20068 100644 --- a/servers/slapd/search.c +++ b/servers/slapd/search.c @@ -353,7 +353,9 @@ fe_op_search( Operation *op, SlapReply *rs ) if (!rs->sr_ref) rs->sr_ref = default_referral; rs->sr_err = LDAP_REFERRAL; + op->o_bd = frontendDB; send_ldap_result( op, rs ); + op->o_bd = NULL; if (rs->sr_ref != default_referral) ber_bvarray_free( rs->sr_ref );