]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bconfig.c
ITS#7256 A few issues discovered during testing slapmodify.
[openldap] / servers / slapd / bconfig.c
index c6f45bc46c9b66770ff49251ae870ca4b651d39d..ded66131b45b1d218114d15684c41e9da0495458 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2013 The OpenLDAP Foundation.
+ * Copyright 2005-2014 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -198,6 +198,8 @@ enum {
        CFG_LTHREADS,
        CFG_IX_HASH64,
        CFG_DISABLED,
+       CFG_THREADQS,
+       CFG_TLS_ECNAME,
 
        CFG_LAST
 };
@@ -683,6 +685,14 @@ static ConfigTable config_back_cf_table[] = {
 #endif
                "( OLcfgGlAt:66 NAME 'olcThreads' "
                        "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
+       { "threadqueues", "count", 2, 2, 0,
+#ifdef NO_THREADS
+               ARG_IGNORED, NULL,
+#else
+               ARG_INT|ARG_MAGIC|CFG_THREADQS, &config_generic,
+#endif
+               "( OLcfgGlAt:95 NAME 'olcThreadQueues' "
+                       "SYNTAX OMsInteger SINGLE-VALUE )", NULL, NULL },
        { "timelimit", "limit", 2, 0, 0, ARG_MAY_DB|ARG_MAGIC,
                &config_timelimit, "( OLcfgGlAt:67 NAME 'olcTimeLimit' "
                        "SYNTAX OMsDirectoryString )", NULL, NULL },
@@ -766,6 +776,14 @@ static ConfigTable config_back_cf_table[] = {
 #endif
                "( OLcfgGlAt:77 NAME 'olcTLSDHParamFile' "
                        "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
+       { "TLSECName", NULL, 2, 2, 0,
+#ifdef HAVE_TLS
+               CFG_TLS_ECNAME|ARG_STRING|ARG_MAGIC, &config_tls_option,
+#else
+               ARG_IGNORED, NULL,
+#endif
+               "( OLcfgGlAt:96 NAME 'olcTLSECName' "
+                       "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
        { "TLSProtocolMin",     NULL, 2, 2, 0,
 #ifdef HAVE_TLS
                CFG_TLS_PROTOCOL_MIN|ARG_STRING|ARG_MAGIC, &config_tls_config,
@@ -835,7 +853,8 @@ static ConfigOCs cf_ocs[] = {
                 "olcDisallows $ olcGentleHUP $ olcIdleTimeout $ "
                 "olcIndexSubstrIfMaxLen $ olcIndexSubstrIfMinLen $ "
                 "olcIndexSubstrAnyLen $ olcIndexSubstrAnyStep $ olcIndexHash64 $ "
-                "olcIndexIntLen $ olcLocalSSF $ olcLogFile $ olcLogLevel $ "
+                "olcIndexIntLen $ "
+                "olcListenerThreads $ olcLocalSSF $ olcLogFile $ olcLogLevel $ "
                 "olcPasswordCryptSaltFormat $ olcPasswordHash $ olcPidFile $ "
                 "olcPluginLogFile $ olcReadOnly $ olcReferral $ "
                 "olcReplogFile $ olcRequires $ olcRestrict $ olcReverseLookup $ "
@@ -845,11 +864,12 @@ static ConfigOCs cf_ocs[] = {
                 "olcSecurity $ olcServerID $ olcSizeLimit $ "
                 "olcSockbufMaxIncoming $ olcSockbufMaxIncomingAuth $ "
                 "olcTCPBuffer $ "
-                "olcThreads $ olcTimeLimit $ olcTLSCACertificateFile $ "
+                "olcThreads $ olcThreadQueues $ "
+                "olcTimeLimit $ olcTLSCACertificateFile $ "
                 "olcTLSCACertificatePath $ olcTLSCertificateFile $ "
                 "olcTLSCertificateKeyFile $ olcTLSCipherSuite $ olcTLSCRLCheck $ "
-                "olcTLSRandFile $ olcTLSVerifyClient $ olcTLSDHParamFile $ "
-                "olcTLSCRLFile $ olcToolThreads $ olcWriteTimeout $ "
+                "olcTLSRandFile $ olcTLSVerifyClient $ olcTLSDHParamFile $ olcTLSECName $ "
+                "olcTLSCRLFile $ olcTLSProtocolMin $ olcToolThreads $ olcWriteTimeout $ "
                 "olcObjectIdentifier $ olcAttributeTypes $ olcObjectClasses $ "
                 "olcDitContentRules $ olcLdapSyntaxes ) )", Cft_Global },
        { "( OLcfgGlOc:2 "
@@ -947,6 +967,9 @@ config_generic(ConfigArgs *c) {
                case CFG_THREADS:
                        c->value_int = connection_pool_max;
                        break;
+               case CFG_THREADQS:
+                       c->value_int = connection_pool_queues;
+                       break;
                case CFG_TTHREADS:
                        c->value_int = slap_tool_thread_max;
                        break;
@@ -1314,6 +1337,7 @@ config_generic(ConfigArgs *c) {
                /* single-valued attrs, no-ops */
                case CFG_CONCUR:
                case CFG_THREADS:
+               case CFG_THREADQS:
                case CFG_TTHREADS:
                case CFG_LTHREADS:
                case CFG_RO:
@@ -1693,6 +1717,20 @@ config_generic(ConfigArgs *c) {
                        connection_pool_max = c->value_int;     /* save for reference */
                        break;
 
+               case CFG_THREADQS:
+                       if ( c->value_int < 1 ) {
+                               snprintf( c->cr_msg, sizeof( c->cr_msg ),
+                                       "threadqueuess=%d smaller than minimum value 1",
+                                       c->value_int );
+                               Debug(LDAP_DEBUG_ANY, "%s: %s.\n",
+                                       c->log, c->cr_msg, 0 );
+                               return 1;
+                       }
+                       if ( slapMode & SLAP_SERVER_MODE )
+                               ldap_pvt_thread_pool_queues(&connection_pool, c->value_int);
+                       connection_pool_queues = c->value_int;  /* save for reference */
+                       break;
+
                case CFG_TTHREADS:
                        if ( slapMode & SLAP_TOOL_MODE )
                                ldap_pvt_thread_pool_maxthreads(&connection_pool, c->value_int);
@@ -3623,7 +3661,8 @@ loglevel2bvarray( int l, BerVarray *bva )
        }
 
        if ( l == 0 ) {
-               return value_add_one( bva, ber_bvstr( "0" ) );
+               struct berval bv = BER_BVC("0");
+               return value_add_one( bva, &bv );
        }
 
        return mask_to_verbs( loglevel_ops, l, bva );
@@ -4000,6 +4039,7 @@ config_tls_cleanup(ConfigArgs *c) {
                int opt = 1;
 
                ldap_pvt_tls_ctx_free( slap_tls_ctx );
+               slap_tls_ctx = NULL;
 
                /* Force new ctx to be created */
                rc = ldap_pvt_tls_set_option( slap_tls_ld, LDAP_OPT_X_TLS_NEWCTX, &opt );
@@ -4008,6 +4048,11 @@ config_tls_cleanup(ConfigArgs *c) {
                        ldap_pvt_tls_get_option( slap_tls_ld, LDAP_OPT_X_TLS_CTX, &slap_tls_ctx );
                        /* This is a no-op if it's already loaded */
                        load_extop( &slap_EXOP_START_TLS, 0, starttls_extop );
+               } else {
+                       if ( rc == LDAP_NOT_SUPPORTED )
+                               rc = LDAP_UNWILLING_TO_PERFORM;
+                       else
+                               rc = LDAP_OTHER;
                }
        }
        return rc;
@@ -4025,6 +4070,7 @@ config_tls_option(ConfigArgs *c) {
        case CFG_TLS_CA_PATH:   flag = LDAP_OPT_X_TLS_CACERTDIR;        break;
        case CFG_TLS_CA_FILE:   flag = LDAP_OPT_X_TLS_CACERTFILE;       break;
        case CFG_TLS_DH_FILE:   flag = LDAP_OPT_X_TLS_DHFILE;   break;
+       case CFG_TLS_ECNAME:    flag = LDAP_OPT_X_TLS_ECNAME;   break;
 #ifdef HAVE_GNUTLS
        case CFG_TLS_CRL_FILE:  flag = LDAP_OPT_X_TLS_CRLFILE;  break;
 #endif
@@ -6758,7 +6804,7 @@ config_build_schema_inc( ConfigArgs *c, CfEntryInfo *ceparent,
 
        for (; cf; cf=cf->c_sibs, c->depth++) {
                if ( !cf->c_at_head && !cf->c_cr_head && !cf->c_oc_head &&
-                       !cf->c_om_head && !cf->c_syn_head ) continue;
+                       !cf->c_om_head && !cf->c_syn_head && !cf->c_kids ) continue;
                c->value_dn.bv_val = c->log;
                LUTIL_SLASHPATH( cf->c_file.bv_val );
                bv.bv_val = strrchr(cf->c_file.bv_val, LDAP_DIRSEP[0]);
@@ -7339,6 +7385,18 @@ config_tool_entry_next( BackendDB *be )
                return NOID;
 }
 
+static ID
+config_tool_dn2id_get( Backend *be, struct berval *dn )
+{
+       CfBackInfo *cfb = be->be_private;
+       BackendInfo *bi = cfb->cb_db.bd_info;
+
+       if ( bi && bi->bi_tool_dn2id_get )
+               return bi->bi_tool_dn2id_get( &cfb->cb_db, dn );
+
+       return NOID;
+}
+
 static Entry *
 config_tool_entry_get( BackendDB *be, ID id )
 {
@@ -7521,6 +7579,22 @@ config_tool_entry_put( BackendDB *be, Entry *e, struct berval *text )
                return NOID;
 }
 
+static ID
+config_tool_entry_modify( BackendDB *be, Entry *e, struct berval *text )
+{
+       CfBackInfo *cfb = be->be_private;
+       BackendInfo *bi = cfb->cb_db.bd_info;
+       CfEntryInfo *ce, *last;
+       ConfigArgs ca = {0};
+
+       ce = config_find_base( cfb->cb_root, &e->e_nname, &last );
+
+       if ( ce && bi && bi->bi_tool_entry_modify )
+               return bi->bi_tool_entry_modify( &cfb->cb_db, e, text );
+
+       return NOID;
+}
+
 static struct {
        char *name;
        AttributeDescription **desc;
@@ -7616,8 +7690,10 @@ config_back_initialize( BackendInfo *bi )
        bi->bi_tool_entry_first = config_tool_entry_first;
        bi->bi_tool_entry_first_x = config_tool_entry_first_x;
        bi->bi_tool_entry_next = config_tool_entry_next;
+       bi->bi_tool_dn2id_get = config_tool_dn2id_get;
        bi->bi_tool_entry_get = config_tool_entry_get;
        bi->bi_tool_entry_put = config_tool_entry_put;
+       bi->bi_tool_entry_modify = config_tool_entry_modify;
 
        ca.argv = argv;
        argv[ 0 ] = "slapd";