From 976d6b4b665efeee19b0c7edc8c174272c28ab27 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 29 Nov 2005 00:09:39 +0000 Subject: [PATCH] fix return code in case the asserted DN does not exist (ITS#4224) --- servers/slapd/overlays/dyngroup.c | 9 ++++++++- servers/slapd/overlays/dynlist.c | 16 ++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/servers/slapd/overlays/dyngroup.c b/servers/slapd/overlays/dyngroup.c index 620224c14c..dd056fc39b 100644 --- a/servers/slapd/overlays/dyngroup.c +++ b/servers/slapd/overlays/dyngroup.c @@ -67,8 +67,15 @@ dyngroup_response( Operation *op, SlapReply *rs ) rs->sr_err = backend_group( op, NULL, &op->o_req_ndn, &op->oq_compare.rs_ava->aa_value, NULL, ap->ap_uri ); op->o_do_not_cache = cache; - if ( rs->sr_err == LDAP_SUCCESS ) + switch ( rs->sr_err ) { + case LDAP_SUCCESS: rs->sr_err = LDAP_COMPARE_TRUE; + break; + + case LDAP_NO_SUCH_OBJECT: + rs->sr_err = LDAP_COMPARE_FALSE; + break; + } break; } } diff --git a/servers/slapd/overlays/dynlist.c b/servers/slapd/overlays/dynlist.c index 3ad2a6bee8..75e449ed22 100644 --- a/servers/slapd/overlays/dynlist.c +++ b/servers/slapd/overlays/dynlist.c @@ -511,11 +511,23 @@ dynlist_compare( Operation *op, SlapReply *rs ) int cache = op->o_do_not_cache; op->o_do_not_cache = 1; - rs->sr_err = backend_group( op, NULL, &op->o_req_ndn, + rs->sr_err = backend_group( op, NULL, &op->o_req_ndn, &op->oq_compare.rs_ava->aa_value, dli->dli_oc, dli->dli_ad ); op->o_do_not_cache = cache; - if ( rs->sr_err == LDAP_SUCCESS ) { + switch ( rs->sr_err ) { + case LDAP_SUCCESS: rs->sr_err = LDAP_COMPARE_TRUE; + break; + + case LDAP_NO_SUCH_OBJECT: + /* NOTE: backend_group() returns noSuchObject + * if op_ndn does not exist; however, since + * dynamic list expansion means that the + * member attribute is virtually present, the + * non-existence of the asserted value implies + * the assertion is FALSE rather than + * UNDEFINED */ + rs->sr_err = LDAP_COMPARE_FALSE; } return SLAP_CB_CONTINUE;