/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2013 The OpenLDAP Foundation.
+ * Copyright 1999-2015 The OpenLDAP Foundation.
* Portions Copyright 2001-2003 Pierangelo Masarati.
* Portions Copyright 1999-2003 Howard Chu.
* All rights reserved.
Debug( LDAP_DEBUG_ANY, "%s meta_search_dobind_init[%d] mc=%p: "
"empty dn with non-empty cred: error\n",
op->o_log_prefix, candidate, (void *)mc );
+ rc = LDAP_OTHER;
goto other;
}
if ( *mcp == NULL ) {
retcode = META_SEARCH_ERR;
- rs->sr_err = LDAP_UNAVAILABLE;
+ rc = LDAP_UNAVAILABLE;
candidates[ candidate ].sr_msgid = META_MSGID_IGNORE;
break;
}
LDAP_BACK_CONN_TAINTED_SET( mc );
meta_back_release_conn_lock( mi, mc, 0 );
*mcp = NULL;
- rs->sr_err = rc;
retcode = META_SEARCH_ERR;
}
}
+ /* check filter expression */
+ if ( mt->mt_filter ) {
+ metafilter_t *mf;
+ for ( mf = mt->mt_filter; mf; mf = mf->mf_next ) {
+ if ( regexec( &mf->mf_regex, op->ors_filterstr.bv_val, 0, NULL, 0 ) == 0 )
+ break;
+ }
+ /* nothing matched, this target is no longer a candidate */
+ if ( !mf ) {
+ retcode = META_SEARCH_NOT_CANDIDATE;
+ goto doreturn;
+ }
+ }
+
/* initiate dobind */
retcode = meta_search_dobind_init( op, rs, mcp, candidate, candidates );
Debug( LDAP_DEBUG_TRACE, "%s.\n", buf, 0, 0 );
} else {
- Debug( LDAP_DEBUG_ANY, "%s (%s).\n",
- buf, ldap_err2string( candidates[ i ].sr_err ), 0 );
+ Debug( LDAP_DEBUG_ANY, "%s (%s) text=\"%s\".\n",
+ buf, ldap_err2string( candidates[ i ].sr_err ),
+ candidates[ i ].sr_text ? candidates[i].sr_text : "" );
}
}
}
}
#endif /* SLAPD_META_CLIENT_PR */
-
- ldap_controls_free( ctrls );
}
/* fallthru */
|| META_BACK_ONERR_STOP( mi ) )
{
const char *save_text = rs->sr_text;
+got_err:
savepriv = op->o_private;
op->o_private = (void *)i;
rs->sr_text = candidates[ i ].sr_text;
op->o_private = savepriv;
ldap_msgfree( res );
res = NULL;
+ ldap_controls_free( ctrls );
goto finish;
}
break;
default:
candidates[ i ].sr_err = rs->sr_err;
- if ( META_BACK_ONERR_STOP( mi ) ) {
- const char *save_text = rs->sr_text;
- savepriv = op->o_private;
- op->o_private = (void *)i;
- rs->sr_text = candidates[ i ].sr_text;
- send_ldap_result( op, rs );
- rs->sr_text = save_text;
- op->o_private = savepriv;
- ldap_msgfree( res );
- res = NULL;
- goto finish;
- }
+ if ( META_BACK_ONERR_STOP( mi ) )
+ goto got_err;
break;
}
+ ldap_controls_free( ctrls );
last = i;
rc = 0;