#include "../back-ldap/back-ldap.h"
#include "back-meta.h"
+static int
+meta_back_do_single_bind(
+ struct metainfo *li,
+ struct metaconn *lc,
+ Operation *op,
+ struct berval *dn,
+ struct berval *ndn,
+ struct berval *cred,
+ int method,
+ int candidate
+);
+
int
meta_back_bind(
Backend *be,
realmethod = method;
}
- lerr = meta_back_do_single_bind( li, lc,
+ lerr = meta_back_do_single_bind( li, lc, op,
realdn, realndn, realcred, realmethod, i );
if ( lerr != LDAP_SUCCESS ) {
err = lerr;
*
* attempts to perform a bind with creds
*/
-int
+static int
meta_back_do_single_bind(
struct metainfo *li,
struct metaconn *lc,
+ Operation *op,
struct berval *dn,
struct berval *ndn,
struct berval *cred,
return LDAP_OTHER;
}
+ if ( op->o_ctrls ) {
+ rc = ldap_set_option( lc->conns[ candidate ].ld,
+ LDAP_OPT_SERVER_CONTROLS, op->o_ctrls );
+ if ( rc != LDAP_SUCCESS ) {
+ rc = ldap_back_map_result( rc );
+ goto return_results;
+ }
+ }
+
rc = ldap_bind_s( lc->conns[ candidate ].ld, mdn.bv_val, cred->bv_val, method );
if ( rc != LDAP_SUCCESS ) {
rc = ldap_back_map_result( rc );
ndn, candidate );
}
}
+
+return_results:;
if ( mdn.bv_val != dn->bv_val ) {
free( mdn.bv_val );
continue;
}
+ /*
+ * If required, set controls
+ */
+ if ( op->o_ctrls ) {
+ if ( ldap_set_option( lsc->ld, LDAP_OPT_SERVER_CONTROLS,
+ op->o_ctrls ) != LDAP_SUCCESS ) {
+ ( void )meta_clear_one_candidate( lsc, 1 );
+ continue;
+ }
+ }
+
/*
* If the target is already bound it is skipped
*/
lsc->bound_dn.bv_val = NULL;
lsc->bound_dn.bv_len = 0;
}
+
+
rc = ldap_bind_s( lsc->ld, 0, NULL, LDAP_AUTH_SIMPLE );
if ( rc != LDAP_SUCCESS ) {