~ttx/openldap/lucid-gssapi-495418

« back to all changes in this revision

Viewing changes to servers/slapd/overlays/pcache.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek, Updated debconf translations
  • Date: 2009-07-28 10:17:15 UTC
  • mfrom: (1.1.4 upstream) (0.2.2 sid)
  • mto: (0.2.4 sid)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20090728101715-epwmqmsk0d3h22k3
* New upstream version.
  - Fixes FTBFS on ia64 with -fPIE. Closes: #524770.
  - Fixes some TLS issues with GnuTLS.  Closes: #505191.
* Update priority of libldap-2.4-2 to match the archive override.
* Add the missing ldapexop and ldapurl tools to ldap-utils, as well as the
  ldapurl(1) manpage.  Thanks to Peter Marschall for the patch.
  Closes: #496749.
* Bump build-dependency on debhelper to 6 instead of 5, since that's
  what we're using.  Closes: #498116.
* Set the default SLAPD_SERVICES to ldap:/// ldapi:///, instead of using
  the built-in default of ldap:/// only.
* Build-depend on libltdl-dev | libltdl3-dev (>= 1.4.3), for the package
  name change.  Closes: #522965.

[ Updated debconf translations ]
* Spanish, thanks to Francisco Javier Cuadrado <fcocuadrado@gmail.com>.
  Closes: #521804.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/pcache.c,v 1.88.2.17 2008/07/08 21:09:37 quanah Exp $ */
 
1
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/pcache.c,v 1.88.2.34 2009/06/16 19:13:09 quanah Exp $ */
2
2
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
3
3
 *
4
 
 * Copyright 2003-2008 The OpenLDAP Foundation.
 
4
 * Copyright 2003-2009 The OpenLDAP Foundation.
5
5
 * Portions Copyright 2003 IBM Corporation.
6
6
 * Portions Copyright 2003 Symas Corporation.
7
7
 * All rights reserved.
182
182
        unsigned long   num_cached_queries;             /* total number of cached queries */
183
183
        unsigned long   max_queries;                    /* upper bound on # of cached queries */
184
184
        int             save_queries;                   /* save cached queries across restarts */
 
185
        int     check_cacheability;             /* check whether a query is cacheable */
185
186
        int     numattrsets;                    /* number of attribute sets */
186
187
        int     cur_entries;                    /* current number of entries cached */
187
188
        int     max_entries;                    /* max number of entries cached */
264
265
{
265
266
        struct berval   bv_scope,
266
267
                        bv_filter;
267
 
        char            attrset_buf[ 32 ],
268
 
                        expiry_buf[ 32 ],
 
268
        char            attrset_buf[ LDAP_PVT_INTTYPE_CHARS( unsigned long ) ],
 
269
                        expiry_buf[ LDAP_PVT_INTTYPE_CHARS( unsigned long ) ],
269
270
                        *ptr;
270
271
        ber_len_t       attrset_len,
271
272
                        expiry_len;
272
273
 
273
274
        ldap_pvt_scope2bv( q->scope, &bv_scope );
274
275
        filter2bv_x( op, q->filter, &bv_filter );
275
 
        attrset_len = snprintf( attrset_buf, sizeof( attrset_buf ),
 
276
        attrset_len = sprintf( attrset_buf,
276
277
                "%lu", (unsigned long)q->qtemp->attr_set_index );
277
 
        expiry_len = snprintf( expiry_buf, sizeof( expiry_buf ),
 
278
        expiry_len = sprintf( expiry_buf,
278
279
                "%lu", (unsigned long)q->expiry_time );
279
280
 
280
281
        urlbv->bv_len = STRLENOF( "ldap:///" )
587
588
        return len;
588
589
}
589
590
 
590
 
/* compare the first value in each filter */
591
 
static int pcache_filter_cmp( const void *v1, const void *v2 )
 
591
/* compare the current value in each filter */
 
592
static int pcache_filter_cmp( Filter *f1, Filter *f2 )
592
593
{
593
 
        const CachedQuery *q1 = v1, *q2 =v2;
594
594
        int rc, weight1, weight2;
595
595
 
596
 
        switch( q1->first->f_choice ) {
 
596
        switch( f1->f_choice ) {
597
597
        case LDAP_FILTER_PRESENT:
598
598
                weight1 = 0;
599
599
                break;
605
605
        default:
606
606
                weight1 = 2;
607
607
        }
608
 
        switch( q2->first->f_choice ) {
 
608
        switch( f2->f_choice ) {
609
609
        case LDAP_FILTER_PRESENT:
610
610
                weight2 = 0;
611
611
                break;
620
620
        rc = weight1 - weight2;
621
621
        if ( !rc ) {
622
622
                switch( weight1 ) {
623
 
                case 0: return 0;
 
623
                case 0:
 
624
                        break;
624
625
                case 1:
625
 
                        rc = lex_bvcmp( &q1->first->f_av_value, &q2->first->f_av_value );
 
626
                        rc = lex_bvcmp( &f1->f_av_value, &f2->f_av_value );
626
627
                        break;
627
628
                case 2:
628
 
                        if ( q1->first->f_choice == LDAP_FILTER_SUBSTRINGS ) {
 
629
                        if ( f1->f_choice == LDAP_FILTER_SUBSTRINGS ) {
629
630
                                rc = 0;
630
 
                                if ( !BER_BVISNULL( &q1->first->f_sub_initial )) {
631
 
                                        if ( !BER_BVISNULL( &q2->first->f_sub_initial )) {
632
 
                                                rc = lex_bvcmp( &q1->first->f_sub_initial,
633
 
                                                        &q2->first->f_sub_initial );
634
 
                                        } else {
635
 
                                                rc = 1;
636
 
                                        }
637
 
                                } else if ( !BER_BVISNULL( &q2->first->f_sub_initial )) {
638
 
                                        rc = -1;
639
 
                                }
640
 
                                if ( rc ) break;
641
 
                                if ( q1->first->f_sub_any ) {
642
 
                                        if ( q2->first->f_sub_any ) {
643
 
                                                rc = lex_bvcmp( q1->first->f_sub_any,
644
 
                                                        q2->first->f_sub_any );
645
 
                                        } else {
646
 
                                                rc = 1;
647
 
                                        }
648
 
                                } else if ( q2->first->f_sub_any ) {
649
 
                                        rc = -1;
650
 
                                }
651
 
                                if ( rc ) break;
652
 
                                if ( !BER_BVISNULL( &q1->first->f_sub_final )) {
653
 
                                        if ( !BER_BVISNULL( &q2->first->f_sub_final )) {
654
 
                                                rc = lex_bvcmp( &q1->first->f_sub_final,
655
 
                                                        &q2->first->f_sub_final );
656
 
                                        } else {
657
 
                                                rc = 1;
658
 
                                        }
659
 
                                } else if ( !BER_BVISNULL( &q2->first->f_sub_final )) {
 
631
                                if ( !BER_BVISNULL( &f1->f_sub_initial )) {
 
632
                                        if ( !BER_BVISNULL( &f2->f_sub_initial )) {
 
633
                                                rc = lex_bvcmp( &f1->f_sub_initial,
 
634
                                                        &f2->f_sub_initial );
 
635
                                        } else {
 
636
                                                rc = 1;
 
637
                                        }
 
638
                                } else if ( !BER_BVISNULL( &f2->f_sub_initial )) {
 
639
                                        rc = -1;
 
640
                                }
 
641
                                if ( rc ) break;
 
642
                                if ( f1->f_sub_any ) {
 
643
                                        if ( f2->f_sub_any ) {
 
644
                                                rc = lex_bvcmp( f1->f_sub_any,
 
645
                                                        f2->f_sub_any );
 
646
                                        } else {
 
647
                                                rc = 1;
 
648
                                        }
 
649
                                } else if ( f2->f_sub_any ) {
 
650
                                        rc = -1;
 
651
                                }
 
652
                                if ( rc ) break;
 
653
                                if ( !BER_BVISNULL( &f1->f_sub_final )) {
 
654
                                        if ( !BER_BVISNULL( &f2->f_sub_final )) {
 
655
                                                rc = lex_bvcmp( &f1->f_sub_final,
 
656
                                                        &f2->f_sub_final );
 
657
                                        } else {
 
658
                                                rc = 1;
 
659
                                        }
 
660
                                } else if ( !BER_BVISNULL( &f2->f_sub_final )) {
660
661
                                        rc = -1;
661
662
                                }
662
663
                        } else {
663
 
                                rc = lex_bvcmp( &q1->first->f_mr_value,
664
 
                                        &q2->first->f_mr_value );
 
664
                                rc = lex_bvcmp( &f1->f_mr_value,
 
665
                                        &f2->f_mr_value );
665
666
                        }
666
667
                        break;
667
668
                }
 
669
                if ( !rc ) {
 
670
                        f1 = f1->f_next;
 
671
                        f2 = f2->f_next;
 
672
                        if ( f1 || f2 ) {
 
673
                                if ( !f1 )
 
674
                                        rc = -1;
 
675
                                else if ( !f2 )
 
676
                                        rc = 1;
 
677
                                else {
 
678
                                        while ( f1->f_choice == LDAP_FILTER_AND || f1->f_choice == LDAP_FILTER_OR )
 
679
                                                f1 = f1->f_and;
 
680
                                        while ( f2->f_choice == LDAP_FILTER_AND || f2->f_choice == LDAP_FILTER_OR )
 
681
                                                f2 = f2->f_and;
 
682
                                        rc = pcache_filter_cmp( f1, f2 );
 
683
                                }
 
684
                        }
 
685
                }
668
686
        }
669
 
 
670
687
        return rc;
671
688
}
672
689
 
 
690
/* compare filters in each query */
 
691
static int pcache_query_cmp( const void *v1, const void *v2 )
 
692
{
 
693
        const CachedQuery *q1 = v1, *q2 =v2;
 
694
        return pcache_filter_cmp( q1->first, q2->first );
 
695
}
 
696
 
673
697
/* add query on top of LRU list */
674
698
static void
675
699
add_query_on_top (query_manager* qm, CachedQuery* qc)
921
945
                ptr = tavl_end( root, 1 );
922
946
                dir = TAVL_DIR_LEFT;
923
947
        } else {
924
 
                ptr = tavl_find3( root, &cq, pcache_filter_cmp, &ret );
 
948
                ptr = tavl_find3( root, &cq, pcache_query_cmp, &ret );
925
949
                dir = (first->f_choice == LDAP_FILTER_GE) ? TAVL_DIR_LEFT :
926
950
                        TAVL_DIR_RIGHT;
927
951
        }
1151
1175
{
1152
1176
        free(qc->q_uuid.bv_val);
1153
1177
        filter_free(qc->filter);
 
1178
        ldap_pvt_thread_rdwr_destroy( &qc->rwlock );
 
1179
        memset(qc, 0, sizeof(*qc));
1154
1180
        free(qc);
1155
1181
}
1156
1182
 
1226
1252
        new_cached_query->prev = NULL;
1227
1253
        new_cached_query->qbase = qbase;
1228
1254
        rc = tavl_insert( &qbase->scopes[query->scope], new_cached_query,
1229
 
                pcache_filter_cmp, avl_dup_error );
 
1255
                pcache_query_cmp, avl_dup_error );
1230
1256
        if ( rc == 0 ) {
1231
1257
                qbase->queries++;
1232
1258
                if (templ->query == NULL)
1240
1266
                new_cached_query = find_filter( op, qbase->scopes[query->scope],
1241
1267
                                                        query->filter, first );
1242
1268
                filter_free( query->filter );
 
1269
                query->filter = NULL;
1243
1270
        }
1244
1271
        Debug( pcache_debug, "TEMPLATE %p QUERIES++ %d\n",
1245
1272
                        (void *) templ, templ->no_of_queries, 0 );
1272
1299
                qc->next->prev = qc->prev;
1273
1300
                qc->prev->next = qc->next;
1274
1301
        }
1275
 
        tavl_delete( &qc->qbase->scopes[qc->scope], qc, pcache_filter_cmp );
 
1302
        tavl_delete( &qc->qbase->scopes[qc->scope], qc, pcache_query_cmp );
1276
1303
        qc->qbase->queries--;
1277
1304
        if ( qc->qbase->queries == 0 ) {
1278
1305
                avl_delete( &template->qbase, qc->qbase, pcache_dn_cmp );
1593
1620
        Query query;
1594
1621
        QueryTemplate *qtemp;
1595
1622
        AttributeName*  save_attrs;     /* original attributes, saved for response */
 
1623
        int swap_saved_attrs;
1596
1624
        int max;
1597
1625
        int over;
1598
1626
        int count;
1695
1723
        Filter          f = { 0 };
1696
1724
        char            filtbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE + STRLENOF( "(entryUUID=)" ) ];
1697
1725
        AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
1698
 
        AttributeName   attrs[ 2 ] = { 0 };
 
1726
        AttributeName   attrs[ 2 ] = {{{ 0 }}};
1699
1727
        int             s, rc;
1700
1728
 
1701
1729
        if ( op == NULL ) {
1810
1838
        Filter                  f = { 0 };
1811
1839
        char                    filter_str[ LDAP_LUTIL_UUIDSTR_BUFSIZE + STRLENOF( "(queryId=)" ) ];
1812
1840
        AttributeAssertion      ava = ATTRIBUTEASSERTION_INIT;
1813
 
        AttributeName           attrs[ 2 ] = { 0 };
 
1841
        AttributeName           attrs[ 2 ] = {{{ 0 }}};
1814
1842
        int                     rc;
1815
1843
 
1816
1844
        BerVarray               vals = NULL;
1951
1979
                Entry *e;
1952
1980
 
1953
1981
                /* don't return more entries than requested by the client */
1954
 
                if ( si->slimit && rs->sr_nentries >= si->slimit ) {
 
1982
                if ( si->slimit > 0 && rs->sr_nentries >= si->slimit ) {
1955
1983
                        si->slimit_exceeded = 1;
1956
1984
                }
1957
1985
 
1960
1988
                 * limit, empty the chain and ignore the rest.
1961
1989
                 */
1962
1990
                if ( !si->over ) {
 
1991
                        /* check if the entry contains undefined
 
1992
                         * attributes/objectClasses (ITS#5680) */
 
1993
                        if ( cm->check_cacheability && test_filter( op, rs->sr_entry, si->query.filter ) != LDAP_COMPARE_TRUE ) {
 
1994
                                Debug( pcache_debug, "%s: query not cacheable because of schema issues in DN \"%s\"\n",
 
1995
                                        op->o_log_prefix, rs->sr_entry->e_name.bv_val, 0 );
 
1996
                                goto over;
 
1997
                        }
 
1998
 
 
1999
                        /* check for malformed entries: attrs with no values */
 
2000
                        {
 
2001
                                Attribute *a = rs->sr_entry->e_attrs;
 
2002
                                for (; a; a=a->a_next) {
 
2003
                                        if ( !a->a_numvals ) {
 
2004
                                                Debug( pcache_debug, "%s: query not cacheable because of attrs without values in DN \"%s\" (%s)\n",
 
2005
                                                op->o_log_prefix, rs->sr_entry->e_name.bv_val,
 
2006
                                                a->a_desc->ad_cname.bv_val );
 
2007
                                                goto over;
 
2008
                                        }
 
2009
                                }
 
2010
                        }
 
2011
 
1963
2012
                        if ( si->count < si->max ) {
1964
2013
                                si->count++;
1965
2014
                                e = entry_dup( rs->sr_entry );
1968
2017
                                si->tail = e;
1969
2018
 
1970
2019
                        } else {
 
2020
over:;
1971
2021
                                si->over = 1;
1972
2022
                                si->count = 0;
1973
2023
                                for (;si->head; si->head=e) {
1984
2034
        if ( rs->sr_type == REP_RESULT || 
1985
2035
                op->o_abandon || rs->sr_err == SLAPD_ABANDON )
1986
2036
        {
1987
 
                if ( si->save_attrs != NULL ) {
 
2037
                if ( si->swap_saved_attrs ) {
1988
2038
                        rs->sr_attrs = si->save_attrs;
1989
2039
                        op->ors_attrs = si->save_attrs;
1990
2040
                }
2067
2117
{
2068
2118
        struct search_info *si = op->o_callback->sc_private;
2069
2119
 
2070
 
        if ( si->save_attrs != NULL ) {
 
2120
        if ( si->swap_saved_attrs ) {
2071
2121
                rs->sr_attrs = si->save_attrs;
2072
2122
                op->ors_attrs = si->save_attrs;
2073
2123
        }
2134
2184
                (*new_attrs)[i].an_desc = attrs->attrs[i].an_desc;
2135
2185
        }
2136
2186
        BER_BVZERO( &(*new_attrs)[i].an_name );
2137
 
        alluser = an_find(*new_attrs, &AllUser);
2138
 
        allop = an_find(*new_attrs, &AllOper);
 
2187
        alluser = an_find( *new_attrs, slap_bv_all_user_attrs );
 
2188
        allop = an_find( *new_attrs, slap_bv_all_operational_attrs );
2139
2189
 
2140
2190
        j = i;
2141
2191
        for ( i=0; i<fattr_cnt; i++ ) {
2164
2214
        }
2165
2215
        BER_BVZERO( &(*new_attrs)[j].an_name );
2166
2216
 
2167
 
        return count;
 
2217
        return j;
2168
2218
}
2169
2219
 
2170
2220
/* NOTE: this is a quick workaround to let pcache minimally interact
2305
2355
                return rs->sr_err;
2306
2356
        }
2307
2357
 
 
2358
        /* pickup runtime ACL changes */
 
2359
        cm->db.be_acl = op->o_bd->be_acl;
 
2360
 
2308
2361
        tempstr.bv_val = op->o_tmpalloc( op->ors_filterstr.bv_len+1, op->o_tmpmemctx );
2309
2362
        tempstr.bv_len = 0;
2310
2363
        if ( filter2template( op, op->ors_filter, &tempstr, &filter_attrs,
2346
2399
        op->o_tmpfree( tempstr.bv_val, op->o_tmpmemctx );
2347
2400
 
2348
2401
        if (answerable) {
2349
 
                /* Need to clear the callbacks of the original operation,
2350
 
                 * in case there are other overlays */
2351
2402
                BackendDB       *save_bd = op->o_bd;
2352
2403
                slap_callback   *save_cb = op->o_callback;
2353
2404
 
2360
2411
                        send_ldap_result( op, rs );
2361
2412
                } else {
2362
2413
                        op->o_bd = &cm->db;
2363
 
                        op->o_callback = NULL;
 
2414
                        if ( cm->response_cb == PCACHE_RESPONSE_CB_TAIL ) {
 
2415
                                /* The cached entry was already processed by any
 
2416
                                 * other overlays, so don't let it get processed again.
 
2417
                                 */
 
2418
                                op->o_callback = NULL;
 
2419
                        }
2364
2420
                        i = cm->db.bd_info->bi_op_search( op, rs );
2365
2421
                }
2366
2422
                ldap_pvt_thread_rdwr_runlock(&answerable->rwlock);
2410
2466
                si->slimit = 0;
2411
2467
                si->slimit_exceeded = 0;
2412
2468
                si->caching_reason = PC_IGNORE;
2413
 
                if ( op->ors_slimit && op->ors_slimit < cm->num_entries_limit ) {
 
2469
                if ( op->ors_slimit > 0 && op->ors_slimit < cm->num_entries_limit ) {
2414
2470
                        si->slimit = op->ors_slimit;
2415
2471
                        op->ors_slimit = cm->num_entries_limit;
2416
2472
                }
2417
2473
                si->head = NULL;
2418
2474
                si->tail = NULL;
 
2475
                si->swap_saved_attrs = 1;
2419
2476
                si->save_attrs = op->ors_attrs;
2420
2477
 
2421
2478
                op->ors_attrs = qtemp->t_attrs.attrs;
2634
2691
                "( OLcfgOvAt:2.6 NAME 'olcProxySaveQueries' "
2635
2692
                        "DESC 'Save cached queries for hot restart' "
2636
2693
                        "SYNTAX OMsBoolean )", NULL, NULL },
2637
 
 
2638
 
        { NULL, NULL, 0, 0, 0, ARG_IGNORED }
2639
 
};
2640
 
 
2641
 
/* Need to no-op this keyword for dynamic config */
2642
 
static ConfigTable pcdummy[] = {
2643
 
        { "", "", 0, 0, 0, ARG_IGNORED,
2644
 
                NULL, "( OLcfgGlAt:13 NAME 'olcDatabase' "
2645
 
                        "DESC 'The backend type for a database instance' "
2646
 
                        "SUP olcBackend SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
 
2694
        { "proxyCheckCacheability", "TRUE|FALSE",
 
2695
                2, 2, 0, ARG_ON_OFF|ARG_OFFSET, (void *)offsetof(cache_manager, check_cacheability),
 
2696
                "( OLcfgOvAt:2.7 NAME 'olcProxyCheckCacheability' "
 
2697
                        "DESC 'Check whether the results of a query are cacheable, e.g. for schema issues' "
 
2698
                        "SYNTAX OMsBoolean )", NULL, NULL },
 
2699
 
2647
2700
        { NULL, NULL, 0, 0, 0, ARG_IGNORED }
2648
2701
};
2649
2702
 
2653
2706
                "DESC 'ProxyCache configuration' "
2654
2707
                "SUP olcOverlayConfig "
2655
2708
                "MUST ( olcProxyCache $ olcProxyAttrset $ olcProxyTemplate ) "
2656
 
                "MAY ( olcProxyResponseCB $ olcProxyCacheQueries $ olcProxySaveQueries ) )",
 
2709
                "MAY ( olcProxyResponseCB $ olcProxyCacheQueries $ olcProxySaveQueries $ olcProxyCheckCacheability ) )",
2657
2710
                Cft_Overlay, pccfg, NULL, pc_cfadd },
2658
2711
        { "( OLcfgOvOc:2.2 "
2659
2712
                "NAME 'olcPcacheDatabase' "
2660
2713
                "DESC 'Cache database configuration' "
2661
 
                "AUXILIARY )", Cft_Misc, pcdummy, pc_ldadd },
 
2714
                "AUXILIARY )", Cft_Misc, olcDatabaseDummy, pc_ldadd },
2662
2715
        { NULL, 0, NULL }
2663
2716
};
2664
2717
 
2703
2756
 
2704
2757
        /* FIXME: should not hardcode "olcDatabase" here */
2705
2758
        bv.bv_len = snprintf( ca->cr_msg, sizeof( ca->cr_msg ),
2706
 
                "olcDatabase=%s", cm->db.bd_info->bi_type );
2707
 
        if ( bv.bv_len < 0 || bv.bv_len >= sizeof( ca->cr_msg ) ) {
 
2759
                "olcDatabase=" SLAP_X_ORDERED_FMT "%s",
 
2760
                0, cm->db.bd_info->bi_type );
 
2761
        if ( bv.bv_len >= sizeof( ca->cr_msg ) ) {
2708
2762
                return -1;
2709
2763
        }
2710
2764
        bv.bv_val = ca->cr_msg;
3137
3191
        cm->db = *be;
3138
3192
        SLAP_DBFLAGS(&cm->db) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
3139
3193
        cm->db.be_private = NULL;
3140
 
        cm->db.be_pcl_mutexp = &cm->db.be_pcl_mutex;
 
3194
        cm->db.bd_self = &cm->db;
3141
3195
        cm->qm = qm;
3142
3196
        cm->numattrsets = 0;
3143
3197
        cm->num_entries_limit = 5;
3146
3200
        cm->cur_entries = 0;
3147
3201
        cm->max_queries = 10000;
3148
3202
        cm->save_queries = 0;
 
3203
        cm->check_cacheability = 0;
3149
3204
        cm->response_cb = PCACHE_RESPONSE_CB_TAIL;
3150
3205
        cm->defer_db_open = 1;
3151
3206
        cm->cc_period = 1000;
3249
3304
                        BerVarray       vals = NULL;
3250
3305
                        Filter          f = { 0 }, f2 = { 0 };
3251
3306
                        AttributeAssertion      ava = ATTRIBUTEASSERTION_INIT;
3252
 
                        AttributeName   attrs[ 2 ] = { 0 };
 
3307
                        AttributeName   attrs[ 2 ] = {{{ 0 }}};
3253
3308
 
3254
3309
                        connection_fake_init( &conn, &opbuf, thrctx );
3255
3310
                        op = &opbuf.ob_op;
3415
3470
                slap_callback   cb = { 0 };
3416
3471
 
3417
3472
                SlapReply       rs = { REP_RESULT };
3418
 
                Modifications   mod = { 0 };
 
3473
                Modifications   mod = {{ 0 }};
3419
3474
 
3420
3475
                thrctx = ldap_pvt_thread_pool_context();
3421
3476
 
3788
3843
 
3789
3844
        struct berval   uuid = BER_BVNULL,
3790
3845
                        *uuidp = NULL;
3791
 
        char            buf[ SLAP_TEXT_BUFLEN ] = { '\0' };
3792
 
        int             len = 0;
 
3846
        char            buf[ SLAP_TEXT_BUFLEN ];
 
3847
        unsigned        len;
3793
3848
        ber_tag_t       tag = LBER_DEFAULT;
3794
3849
 
3795
3850
        if ( LogTest( LDAP_DEBUG_STATS ) ) {
3807
3862
                assert( !BER_BVISNULL( &op->o_req_ndn ) );
3808
3863
                len = snprintf( buf, sizeof( buf ), " dn=\"%s\"", op->o_req_ndn.bv_val );
3809
3864
 
3810
 
                if ( !BER_BVISNULL( &uuid ) ) {
 
3865
                if ( !BER_BVISNULL( &uuid ) && len < sizeof( buf ) ) {
3811
3866
                        snprintf( &buf[ len ], sizeof( buf ) - len, " queryId=\"%s\"", uuid.bv_val );
3812
3867
                }
3813
3868
 
3977
4032
        code = config_register_schema( pccfg, pcocs );
3978
4033
        if ( code ) return code;
3979
4034
 
3980
 
        {
3981
 
                const char *text;
3982
 
                code = slap_str2ad( "olcDatabase", &pcdummy[0].ad, &text );
3983
 
                if ( code ) return code;
3984
 
        }
3985
4035
        return overlay_register( &pcache );
3986
4036
}
3987
4037