add "matchedDN" field when appropriate

This commit is contained in:
Pierangelo Masarati 2005-06-28 23:22:48 +00:00
parent 904d86a28a
commit ba0f3112c4
2 changed files with 33 additions and 3 deletions

View File

@ -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(

View File

@ -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;