ldap_pvt_thread_mutex_t conn_mutex;
Avlnode *conntree;
- int savecred;
+ unsigned flags;
+/* defined in <back-ldap/back-ldap.h>
+#define LDAP_BACK_F_NONE 0x00U
+#define LDAP_BACK_F_SAVECRED 0x01U
+#define LDAP_BACK_F_USE_TLS 0x02U
+#define LDAP_BACK_F_TLS_CRITICAL ( 0x04U | LDAP_BACK_F_USE_TLS )
+#define LDAP_BACK_F_CHASE_REFERRALS 0x8U
+*/
};
#define META_OP_ALLOW_MULTIPLE 0x00
lsc->msc_bound = META_BOUND;
lc->mc_bound_target = candidate;
- if ( li->savecred ) {
+ if ( li->flags & LDAP_BACK_F_SAVECRED ) {
if ( !BER_BVISNULL( &lsc->msc_cred ) ) {
/* destroy sensitive data */
memset( lsc->msc_cred.bv_val, 0, lsc->msc_cred.bv_len );
BER_BVZERO( &lsc->msc_cred );
}
- /* FIXME: should be check if at least some of the op->o_ctrls
+ /* FIXME: should we check if at least some of the op->o_ctrls
* can/should be passed? */
rc = ldap_sasl_bind( lsc->msc_ld, "", LDAP_SASL_SIMPLE, &cred,
NULL, NULL, &msgid );
fname, lineno );
return( 1 );
}
- li->savecred = 1;
-
+
+ li->flags |= LDAP_BACK_F_SAVECRED;
+
+ } else if ( strcasecmp( argv[0], "chase-referrals" ) == 0 ) {
+ if ( argc != 1 ) {
+ fprintf( stderr,
+ "%s: line %d: \"chase-referrals\" takes no arguments\n",
+ fname, lineno );
+ return( 1 );
+ }
+
+ li->flags |= LDAP_BACK_F_CHASE_REFERRALS;
+
+ } else if ( strcasecmp( argv[0], "dont-chase-referrals" ) == 0 ) {
+ if ( argc != 1 ) {
+ fprintf( stderr,
+ "%s: line %d: \"dont-chase-referrals\" takes no arguments\n",
+ fname, lineno );
+ return( 1 );
+ }
+
+ li->flags &= ~LDAP_BACK_F_CHASE_REFERRALS;
+
/* name to use as pseudo-root dn */
} else if ( strcasecmp( argv[ 0 ], "pseudorootdn" ) == 0 ) {
int i = li->ntargets-1;
*/
vers = op->o_conn->c_protocol;
ldap_set_option( lsc->msc_ld, LDAP_OPT_PROTOCOL_VERSION, &vers );
- /* FIXME: configurable? */
- ldap_set_option( lsc->msc_ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON );
+
+ /* automatically chase referrals ("chase-referrals"/"dont-chase-referrals" statement) */
+ if ( li->flags & LDAP_BACK_F_CHASE_REFERRALS ) {
+ ldap_set_option( lsc->msc_ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON );
+ }
/*
* Set the network timeout if set