From ba0f3112c4007897ec622aa52f0d4b3cb85a9e89 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 28 Jun 2005 23:22:48 +0000 Subject: [PATCH] add "matchedDN" field when appropriate --- servers/slapd/back-meta/candidates.c | 7 ++++--- servers/slapd/back-meta/conn.c | 29 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/servers/slapd/back-meta/candidates.c b/servers/slapd/back-meta/candidates.c index df3e9f63a5..76023a8837 100644 --- a/servers/slapd/back-meta/candidates.c +++ b/servers/slapd/back-meta/candidates.c @@ -103,9 +103,10 @@ meta_back_is_candidate_unique( /* * meta_back_select_unique_candidate * - * returns the index of the candidate in case it is unique, otherwise -1 - * Note: dn MUST be normalized. - * Note: if defined, the default candidate is returned in case of no match. + * returns the index of the candidate in case it is unique, otherwise + * META_TARGET_NONE if none matches, or + * META_TARGET_MULTIPLE if more than one matches + * Note: ndn MUST be normalized. */ int meta_back_select_unique_candidate( diff --git a/servers/slapd/back-meta/conn.c b/servers/slapd/back-meta/conn.c index 8935ff13a8..1cf911331e 100644 --- a/servers/slapd/back-meta/conn.c +++ b/servers/slapd/back-meta/conn.c @@ -707,6 +707,27 @@ meta_back_getconn( continue; } } + + if ( ncandidates == 0 ) { + if ( new_conn ) { + meta_back_conn_free( mc ); + } + + rs->sr_err = LDAP_NO_SUCH_OBJECT; + rs->sr_text = "Unable to select valid candidates"; + + if ( sendok & LDAP_BACK_SENDERR ) { + if ( rs->sr_err == LDAP_NO_SUCH_OBJECT ) { + rs->sr_matched = op->o_bd->be_suffix[ 0 ].bv_val; + } + send_ldap_result( op, rs ); + rs->sr_text = NULL; + rs->sr_matched = NULL; + } + + return NULL; + } + goto done; } @@ -737,8 +758,12 @@ meta_back_getconn( if ( rs->sr_err != LDAP_SUCCESS ) { if ( sendok & LDAP_BACK_SENDERR ) { + if ( rs->sr_err == LDAP_NO_SUCH_OBJECT ) { + rs->sr_matched = op->o_bd->be_suffix[ 0 ].bv_val; + } send_ldap_result( op, rs ); rs->sr_text = NULL; + rs->sr_matched = NULL; } return NULL; } @@ -876,8 +901,12 @@ meta_back_getconn( rs->sr_text = "Unable to select valid candidates"; if ( sendok & LDAP_BACK_SENDERR ) { + if ( rs->sr_err == LDAP_NO_SUCH_OBJECT ) { + rs->sr_matched = op->o_bd->be_suffix[ 0 ].bv_val; + } send_ldap_result( op, rs ); rs->sr_text = NULL; + rs->sr_matched = NULL; } return NULL; -- 2.39.5