]> git.sur5r.net Git - openldap/commitdiff
add "matchedDN" field when appropriate
authorPierangelo Masarati <ando@openldap.org>
Tue, 28 Jun 2005 23:22:48 +0000 (23:22 +0000)
committerPierangelo Masarati <ando@openldap.org>
Tue, 28 Jun 2005 23:22:48 +0000 (23:22 +0000)
servers/slapd/back-meta/candidates.c
servers/slapd/back-meta/conn.c

index df3e9f63a5f9c4fa9500f90fbea797536bdd9091..76023a8837f039a01dad55dc764f86ab277fb0f7 100644 (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(
index 8935ff13a8d3f5fb6ded3ee92c3b0cd8c612a1b6..1cf911331e7c5cfcf5d063f1662dc617656ca182 100644 (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;