X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fback-ldap%2Fconfig.c;h=21d381c518e884ae89f268d3b0fed6b02c2fb65d;hb=0122f258530b7cdb3f8bd7d88524006348a0c339;hp=1e2691d505ab7ea837cb92fd3e4cf9bc1339fbe3;hpb=ef0261e84c5b5b7410c2c8c6537c172dbc2f2c14;p=openldap
diff --git a/servers/slapd/back-ldap/config.c b/servers/slapd/back-ldap/config.c
index 1e2691d505..21d381c518 100644
--- a/servers/slapd/back-ldap/config.c
+++ b/servers/slapd/back-ldap/config.c
@@ -2,7 +2,7 @@
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software .
*
- * Copyright 2003-2006 The OpenLDAP Foundation.
+ * Copyright 2003-2007 The OpenLDAP Foundation.
* Portions Copyright 1999-2003 Howard Chu.
* Portions Copyright 2000-2003 Pierangelo Masarati.
* All rights reserved.
@@ -66,6 +66,7 @@ enum {
LDAP_BACK_CFG_VERSION,
LDAP_BACK_CFG_SINGLECONN,
LDAP_BACK_CFG_USETEMP,
+ LDAP_BACK_CFG_CONNPOOLMAX,
LDAP_BACK_CFG_CANCEL,
LDAP_BACK_CFG_QUARANTINE,
LDAP_BACK_CFG_REWRITE,
@@ -82,7 +83,7 @@ static ConfigTable ldapcfg[] = {
"SYNTAX OMsDirectoryString "
"SINGLE-VALUE )",
NULL, NULL },
- { "tls", "what", 2, 2, 0,
+ { "tls", "what", 2, 0, 0,
ARG_MAGIC|LDAP_BACK_CFG_TLS,
ldap_back_cf_gen, "( OLcfgDbAt:3.1 "
"NAME 'olcDbStartTLS' "
@@ -281,11 +282,19 @@ static ConfigTable ldapcfg[] = {
{ "use-temporary-conn", "TRUE/FALSE", 2, 0, 0,
ARG_MAGIC|ARG_ON_OFF|LDAP_BACK_CFG_USETEMP,
ldap_back_cf_gen, "( OLcfgDbAt:3.22 "
- "NAME 'olcDbUseTemporaries' "
+ "NAME 'olcDbUseTemporaryConn' "
"DESC 'Use temporary connections if the cached one is busy' "
"SYNTAX OMsBoolean "
"SINGLE-VALUE )",
NULL, NULL },
+ { "conn-pool-max", "", 2, 0, 0,
+ ARG_MAGIC|ARG_INT|LDAP_BACK_CFG_CONNPOOLMAX,
+ ldap_back_cf_gen, "( OLcfgDbAt:3.23 "
+ "NAME 'olcDbConnectionPoolMax' "
+ "DESC 'Max size of privileged connections pool' "
+ "SYNTAX OMsInteger "
+ "SINGLE-VALUE )",
+ NULL, NULL },
{ "suffixmassage", "[virtual]> argv[ 1 ], "*" ) == 0
- || strcmp( c->argv[ 1 ], ".*" ) == 0
|| strcmp( c->argv[ 1 ], "dn:*" ) == 0
|| strcasecmp( c->argv[ 1 ], "dn.regex:.*" ) == 0 )
{
@@ -702,6 +710,7 @@ slap_idassert_parse( ConfigArgs *c, slap_idassert_t *si )
return 1;
}
}
+ bindconf_tls_defaults( &si->si_bc );
return 0;
}
@@ -766,10 +775,25 @@ ldap_back_cf_gen( ConfigArgs *c )
}
break;
- case LDAP_BACK_CFG_TLS:
+ case LDAP_BACK_CFG_TLS: {
+ struct berval bc = BER_BVNULL, bv2;
enum_to_verb( tls_mode, ( li->li_flags & LDAP_BACK_F_TLS_MASK ), &bv );
assert( !BER_BVISNULL( &bv ) );
- value_add_one( &c->rvalue_vals, &bv );
+ bindconf_tls_unparse( &li->li_tls, &bc );
+
+ if ( !BER_BVISEMPTY( &bc )) {
+ bv2.bv_len = bv.bv_len + bc.bv_len + 1;
+ bv2.bv_val = ch_malloc( bv2.bv_len + 1 );
+ strcpy( bv2.bv_val, bv.bv_val );
+ bv2.bv_val[bv.bv_len] = ' ';
+ strcpy( &bv2.bv_val[bv.bv_len + 1], bc.bv_val );
+ ber_bvarray_add( &c->rvalue_vals, &bv2 );
+
+ } else {
+ value_add_one( &c->rvalue_vals, &bv );
+ }
+ ber_memfree( bc.bv_val );
+ }
break;
case LDAP_BACK_CFG_ACL_AUTHCDN:
@@ -1060,6 +1084,10 @@ ldap_back_cf_gen( ConfigArgs *c )
c->value_int = LDAP_BACK_USE_TEMPORARIES( li );
break;
+ case LDAP_BACK_CFG_CONNPOOLMAX:
+ c->value_int = li->li_conn_priv_max;
+ break;
+
case LDAP_BACK_CFG_CANCEL: {
slap_mask_t mask = LDAP_BACK_F_CANCEL_MASK2;
@@ -1190,6 +1218,10 @@ ldap_back_cf_gen( ConfigArgs *c )
li->li_flags &= ~LDAP_BACK_F_USE_TEMPORARIES;
break;
+ case LDAP_BACK_CFG_CONNPOOLMAX:
+ li->li_conn_priv_max = LDAP_BACK_CONN_PRIV_MIN;
+ break;
+
case LDAP_BACK_CFG_QUARANTINE:
if ( !LDAP_BACK_QUARANTINE( li ) ) {
break;
@@ -1198,6 +1230,7 @@ ldap_back_cf_gen( ConfigArgs *c )
slap_retry_info_destroy( &li->li_quarantine );
ldap_pvt_thread_mutex_destroy( &li->li_quarantine_mutex );
li->li_isquarantined = 0;
+ li->li_flags &= ~LDAP_BACK_F_QUARANTINE;
break;
default:
@@ -1361,6 +1394,13 @@ done_url:;
}
li->li_flags &= ~LDAP_BACK_F_TLS_MASK;
li->li_flags |= tls_mode[i].mask;
+ if ( c->argc > 2 ) {
+ for ( i=2; iargc; i++ ) {
+ if ( bindconf_tls_parse( c->argv[i], &li->li_tls ))
+ return 1;
+ }
+ bindconf_tls_defaults( &li->li_tls );
+ }
break;
case LDAP_BACK_CFG_ACL_AUTHCDN:
@@ -1419,6 +1459,7 @@ done_url:;
return 1;
}
}
+ bindconf_tls_defaults( &li->li_acl );
break;
case LDAP_BACK_CFG_IDASSERT_MODE:
@@ -1604,13 +1645,13 @@ done_url:;
&& mask == LDAP_BACK_F_T_F_DISCOVER
&& !LDAP_BACK_T_F( li ) )
{
- slap_bindconf sb = { 0 };
+ slap_bindconf sb = { BER_BVNULL };
int rc;
if ( li->li_uri == NULL ) {
snprintf( c->msg, sizeof( c->msg ),
- "need URI to discover \"cancel\" support "
- "in \"cancel exop-discover\"" );
+ "need URI to discover absolute filters support "
+ "in \"t-f-support discover\"" );
Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->msg, 0 );
return 1;
}
@@ -1744,6 +1785,24 @@ done_url:;
}
break;
+ case LDAP_BACK_CFG_CONNPOOLMAX:
+ if ( c->value_int < LDAP_BACK_CONN_PRIV_MIN
+ || c->value_int > LDAP_BACK_CONN_PRIV_MAX )
+ {
+ snprintf( c->msg, sizeof( c->msg ),
+ "invalid max size " "of privileged "
+ "connections pool \"%s\" "
+ "in \"conn-pool-max "
+ "(must be between %d and %d)\"",
+ c->argv[ 1 ],
+ LDAP_BACK_CONN_PRIV_MIN,
+ LDAP_BACK_CONN_PRIV_MAX );
+ Debug( LDAP_DEBUG_ANY, "%s: %s.\n", c->log, c->msg, 0 );
+ return 1;
+ }
+ li->li_conn_priv_max = c->value_int;
+ break;
+
case LDAP_BACK_CFG_CANCEL: {
slap_mask_t mask;
@@ -1758,7 +1817,7 @@ done_url:;
&& mask == LDAP_BACK_F_CANCEL_EXOP_DISCOVER
&& !LDAP_BACK_CANCEL( li ) )
{
- slap_bindconf sb = { 0 };
+ slap_bindconf sb = { BER_BVNULL };
int rc;
if ( li->li_uri == NULL ) {
@@ -1803,6 +1862,7 @@ done_url:;
/* give it a chance to retry if the pattern gets reset
* via back-config */
li->li_isquarantined = 0;
+ li->li_flags |= LDAP_BACK_F_QUARANTINE;
}
break;
@@ -1946,7 +2006,7 @@ retry:
}
if ( lc != NULL ) {
- ldap_back_release_conn( &op2, rs, lc );
+ ldap_back_release_conn( (ldapinfo_t *)op2.o_bd->be_private, lc );
}
} else {