]> git.sur5r.net Git - openldap/commitdiff
ITS#4744 fix from HEAD
authorHoward Chu <hyc@openldap.org>
Sat, 11 Nov 2006 23:41:08 +0000 (23:41 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 11 Nov 2006 23:41:08 +0000 (23:41 +0000)
servers/slapd/saslauthz.c

index 65207a356acc5763e694ed50f892094da0a18e85..ae461f4af087c204217ffca5b18ce2d1e4c2836b 100644 (file)
@@ -1607,23 +1607,11 @@ static int sasl_sc_smatch( Operation *o, SlapReply *rs )
 {
        smatch_info *sm = o->o_callback->sc_private;
 
-       if ( rs->sr_type != REP_SEARCH ) {
-               if ( rs->sr_err != LDAP_SUCCESS ) {
-                       sm->match = -1;
-               }
-               return 0;
-       }
-
-       if ( sm->match == 1 ) {
-               sm->match = -1;
-               return 0;
-       }
+       if (rs->sr_type != REP_SEARCH) return 0;
 
        if (dn_match(sm->dn, &rs->sr_entry->e_nname)) {
                sm->match = 1;
-
-       } else {
-               sm->match = -1;
+               return LDAP_UNAVAILABLE;        /* short-circuit the search */
        }
 
        return 0;
@@ -1849,7 +1837,7 @@ exact_match:
 
        op.o_bd->be_search( &op, &rs );
 
-       if (sm.match == 1) {
+       if (sm.match) {
                rc = LDAP_SUCCESS;
        } else {
                rc = LDAP_INAPPROPRIATE_AUTH;