]> git.sur5r.net Git - openldap/commitdiff
import referral chaing options from back-ldap
authorPierangelo Masarati <ando@openldap.org>
Sat, 5 Feb 2005 11:33:32 +0000 (11:33 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sat, 5 Feb 2005 11:33:32 +0000 (11:33 +0000)
servers/slapd/back-meta/back-meta.h
servers/slapd/back-meta/bind.c
servers/slapd/back-meta/config.c
servers/slapd/back-meta/conn.c

index 3ead454bb45ad38946787d6598467ee48531a9cf..8ec10053836605cf36fc06cc59058f1b2b45fefd 100644 (file)
@@ -215,7 +215,14 @@ struct metainfo {
        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
index 0dde00f58452c78d516378613f92e03667eb7bc9..01e6a8612eeb4a43865fb8c6c0020654d6245c8a 100644 (file)
@@ -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 );
index 28b057ed01e14bebfef21581c42609dac8d4dede..a5ce0d2e34df14d6c7928ac17fa5ba237da1cf95 100644 (file)
@@ -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;
index 78fe9b4ccfd69bd89551aa2964cf6579544ed555..7a97797ce4f33ad5f9a1fe00231931f24e110646 100644 (file)
@@ -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