]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/bconfig.c
ITS#4088 force cursors to use same locker
[openldap] / servers / slapd / bconfig.c
index d7d4daa77376c854b5ef54b03348444459dba234..ea679bad6e82aae6400cb92eb9a533a4b139a368 100644 (file)
@@ -2022,6 +2022,38 @@ str2loglevel( const char *s, int *l )
        return 0;
 }
 
+const char *
+loglevel2str( int l )
+{
+       struct berval   bv = BER_BVNULL;
+
+       loglevel2bv( l, &bv );
+
+       return bv.bv_val;
+}
+
+int
+loglevel2bv( int l, struct berval *bv )
+{
+       if ( loglevel_ops == NULL ) {
+               loglevel_init();
+       }
+
+       BER_BVZERO( bv );
+
+       return enum_to_verb( loglevel_ops, l, bv ) == -1;
+}
+
+int
+loglevel2bvarray( int l, BerVarray *bva )
+{
+       if ( loglevel_ops == NULL ) {
+               loglevel_init();
+       }
+
+       return mask_to_verbs( loglevel_ops, l, bva );
+}
+
 static int config_syslog;
 
 static int
@@ -2037,7 +2069,8 @@ config_loglevel(ConfigArgs *c) {
                /* Get default or commandline slapd setting */
                if ( ldap_syslog && !config_syslog )
                        config_syslog = ldap_syslog;
-               return mask_to_verbs( loglevel_ops, config_syslog, &c->rvalue_vals );
+               return loglevel2bvarray( config_syslog, &c->rvalue_vals );
+
        } else if ( c->op == LDAP_MOD_DELETE ) {
                if ( !c->line ) {
                        config_syslog = 0;
@@ -2623,7 +2656,7 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) {
        setup_cookie sc;
        slap_callback cb = { NULL, config_ldif_resp, NULL, NULL };
        Connection conn = {0};
-       char opbuf[OPERATION_BUFFER_SIZE];
+       OperationBuffer opbuf;
        Operation *op;
        SlapReply rs = {REP_RESULT};
        Filter filter = { LDAP_FILTER_PRESENT };
@@ -2675,7 +2708,7 @@ config_setup_ldif( BackendDB *be, const char *dir, int readit ) {
        if ( readit ) {
                void *thrctx = ldap_pvt_thread_pool_context();
 
-               op = (Operation *)opbuf;
+               op = (Operation *) &opbuf;
                connection_fake_init( &conn, op, thrctx );
 
                filter.f_desc = slap_schema.si_ad_objectClass;
@@ -4063,7 +4096,7 @@ config_back_db_open( BackendDB *be )
        BackendInfo *bi;
        ConfigArgs c;
        Connection conn = {0};
-       char opbuf[OPERATION_BUFFER_SIZE];
+       OperationBuffer opbuf;
        Operation *op;
        slap_callback cb = { NULL, slap_null_cb, NULL, NULL };
        SlapReply rs = {REP_RESULT};
@@ -4075,7 +4108,7 @@ config_back_db_open( BackendDB *be )
 
        if ( cfb->cb_use_ldif ) {
                thrctx = ldap_pvt_thread_pool_context();
-               op = (Operation *)opbuf;
+               op = (Operation *) &opbuf;
                connection_fake_init( &conn, op, thrctx );
 
                op->o_dn = be->be_rootdn;