-/*
- * Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* $OpenLDAP$ */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1999-2003 The OpenLDAP Foundation.
+ * All rights reserved.
*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by the Howard Chu for inclusion
+ * in OpenLDAP Software and subsequently enhanced by Pierangelo
+ * Masarati.
+ */
+/* This is an altered version */
+/*
* Copyright 2001, Pierangelo Masarati, All rights reserved. <ando@sys-net.it>
*
* This work has been developed to fulfill the requirements
{
struct metainfo *li;
-#ifdef LDAP_CACHING
struct rewrite_info *rwinfo;
- cache_manager *cm;
- query_manager *qm;
rwinfo = rewrite_info_init( REWRITE_MODE_USE_DEFAULT );
if ( rwinfo == NULL ) {
return -1;
}
-
- cm = (cache_manager *)ch_malloc(sizeof(cache_manager));
- if ( cm == NULL ) {
- rewrite_info_delete( rwinfo );
- return -1;
- }
-
- qm = (query_manager*)ch_malloc(sizeof(query_manager));
- if ( qm == NULL ) {
- rewrite_info_delete( rwinfo );
- ch_free( cm );
- return -1;
- }
-
- cm->caching = 0;
- cm->qm = qm;
- cm->numattrsets = 0;
- cm->numtemplates = 0;
- cm->num_entries_limit = 5;
- cm->cache_size = 0;
- cm->thresh_hi = 500000;
- cm->thresh_lo = 700000;
- cm->num_cached_queries = 0;
- cm->total_entries = 0;
- cm->max_queries = 10000;
- cm->threads = 0;
- cm->cc_thread_started = 0;
- cm->cc_period = 1000;
-
- qm->attr_sets = NULL;
- qm->templates = NULL;
- qm->lru_top = NULL;
- qm->lru_bottom = NULL;
-
- qm->qcfunc = query_containment;
- qm->crfunc = cache_replacement;
- qm->addfunc = add_query;
- ldap_pvt_thread_mutex_init(&qm->lru_mutex);
-
- ldap_pvt_thread_mutex_init(&cm->cache_mutex);
- ldap_pvt_thread_mutex_init(&cm->remove_mutex);
- ldap_pvt_thread_mutex_init( &cm->cc_mutex );
-#endif /* LDAP_CACHING */
li = ch_calloc( 1, sizeof( struct metainfo ) );
if ( li == NULL ) {
+ rewrite_info_delete( &rwinfo );
return -1;
}
-
+
/*
* At present the default is no default target;
* this may change
*/
li->defaulttarget = META_DEFAULT_TARGET_NONE;
-#ifdef LDAP_CACHING
- li->cm = cm;
li->rwinfo = rwinfo;
- /* FIXME: what about qm ? */
-#endif /* LDAP_CACHING */
ldap_pvt_thread_mutex_init( &li->conn_mutex );
ldap_pvt_thread_mutex_init( &li->cache.mutex );
free( lt->pseudorootpw.bv_val );
}
if ( lt->rwmap.rwm_rw ) {
- rewrite_info_delete( lt->rwmap.rwm_rw );
+ rewrite_info_delete( <->rwmap.rwm_rw );
}
avl_free( lt->rwmap.rwm_oc.remap, NULL );
avl_free( lt->rwmap.rwm_oc.map, mapping_free );