From: Pierangelo Masarati Date: Sat, 5 Feb 2005 11:33:32 +0000 (+0000) Subject: import referral chaing options from back-ldap X-Git-Tag: OPENLDAP_REL_ENG_2_3_BP~190 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e3a19bfa3238cddc26d8c94cfea19e9334c291ee;p=openldap import referral chaing options from back-ldap --- diff --git a/servers/slapd/back-meta/back-meta.h b/servers/slapd/back-meta/back-meta.h index 3ead454bb4..8ec1005383 100644 --- a/servers/slapd/back-meta/back-meta.h +++ b/servers/slapd/back-meta/back-meta.h @@ -215,7 +215,14 @@ struct metainfo { ldap_pvt_thread_mutex_t conn_mutex; Avlnode *conntree; - int savecred; + unsigned flags; +/* defined in +#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 diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index 0dde00f584..01e6a8612e 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -248,7 +248,7 @@ retry:; 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 ); @@ -328,7 +328,7 @@ meta_back_dobind( struct metaconn *lc, Operation *op ) 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 ); diff --git a/servers/slapd/back-meta/config.c b/servers/slapd/back-meta/config.c index 28b057ed01..a5ce0d2e34 100644 --- a/servers/slapd/back-meta/config.c +++ b/servers/slapd/back-meta/config.c @@ -384,8 +384,29 @@ meta_back_db_config( 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; diff --git a/servers/slapd/back-meta/conn.c b/servers/slapd/back-meta/conn.c index 78fe9b4ccf..7a97797ce4 100644 --- a/servers/slapd/back-meta/conn.c +++ b/servers/slapd/back-meta/conn.c @@ -214,8 +214,11 @@ init_one_conn( */ 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