/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2003-2004 The OpenLDAP Foundation.
+ * Copyright 2003-2005 The OpenLDAP Foundation.
* Portions Copyright 2003 IBM Corporation.
* Portions Copyright 2003 Symas Corporation.
* All rights reserved.
{
struct query_info *qi, *qnext;
char filter_str[64];
- AttributeAssertion ava;
+#ifdef LDAP_COMP_MATCH
+ AttributeAssertion ava = { NULL, BER_BVNULL, NULL };
+#else
+ AttributeAssertion ava = { NULL, BER_BVNULL };
+#endif
Filter filter = {LDAP_FILTER_EQUALITY};
SlapReply sreply = {REP_RESULT};
slap_callback cb = { NULL, remove_func, NULL, NULL };
* wake it back up
*/
if ( cm->cc_paused ) {
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
if ( cm->cc_paused ) {
cm->cc_paused = 0;
- ldap_pvt_runqueue_resched( &syncrepl_rq, cm->cc_arg, 0 );
+ ldap_pvt_runqueue_resched( &slapd_rq, cm->cc_arg, 0 );
}
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
}
}
slap_overinst *on = rtask->arg;
cache_manager *cm = on->on_bi.bi_private;
query_manager *qm = cm->qm;
- Operation op = {0};
Connection conn = {0};
+ char opbuf[OPERATION_BUFFER_SIZE];
+ Operation *op;
SlapReply rs = {REP_RESULT};
CachedQuery* query, *query_prev;
int i, return_val, pause = 1;
QueryTemplate* templ;
- connection_fake_init( &conn, &op, ctx );
+ op = (Operation *)opbuf;
+ connection_fake_init( &conn, op, ctx );
- op.o_bd = &cm->db;
- op.o_dn = cm->db.be_rootdn;
- op.o_ndn = cm->db.be_rootndn;
+ op->o_bd = &cm->db;
+ op->o_dn = cm->db.be_rootdn;
+ op->o_ndn = cm->db.be_rootndn;
cm->cc_arg = arg;
templ = qm->templates + i;
query = templ->query_last;
if ( query ) pause = 0;
- op.o_time = slap_get_time();
+ op->o_time = slap_get_time();
ldap_pvt_thread_mutex_lock(&cm->remove_mutex);
- while (query && (query->expiry_time < op.o_time)) {
+ while (query && (query->expiry_time < op->o_time)) {
ldap_pvt_thread_mutex_lock(&qm->lru_mutex);
remove_query(qm, query);
ldap_pvt_thread_mutex_unlock(&qm->lru_mutex);
Debug( LDAP_DEBUG_ANY, "Unlock CR index = %d\n",
i, 0, 0 );
ldap_pvt_thread_rdwr_wunlock(&templ->t_rwlock);
- return_val = remove_query_data(&op, &rs, &query->q_uuid);
+ return_val = remove_query_data(op, &rs, &query->q_uuid);
Debug( LDAP_DEBUG_ANY, "STALE QUERY REMOVED, SIZE=%d\n",
return_val, 0, 0 );
ldap_pvt_thread_mutex_lock(&cm->cache_mutex);
}
ldap_pvt_thread_mutex_unlock(&cm->remove_mutex);
}
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
- if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
- ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask );
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+ if ( ldap_pvt_runqueue_isrunning( &slapd_rq, rtask )) {
+ ldap_pvt_runqueue_stoptask( &slapd_rq, rtask );
}
/* If there were no queries, defer processing for a while */
cm->cc_paused = pause;
- ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, pause );
+ ldap_pvt_runqueue_resched( &slapd_rq, rtask, pause );
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
return NULL;
}
AttributeName* attr_name;
AttributeName* attrarray;
const char* text=NULL;
- char *save_argv0 = NULL;
+ char *argv0 = NULL;
int index, i;
int num;
int rc = 0;
if ( strncasecmp( argv[0], "proxycache-", STRLENOF( "proxycache-" ) ) == 0 ) {
- save_argv0 = argv[0];
- argv[0] += STRLENOF( "proxycache-" );
+ argv0 = argv[0] + STRLENOF( "proxycache-" );
+ } else {
+ argv0 = argv[0];
}
- if ( strcasecmp( argv[0], "proxycache" ) == 0 ) {
+ if ( strcasecmp( argv0, "proxycache" ) == 0 ) {
if ( argc < 6 ) {
fprintf( stderr, "%s: line %d: missing arguments in \"proxycache"
" <backend> <max_entries> <numattrsets> <entry limit> "
qm->attr_sets[i].attrs = NULL;
}
- } else if ( strcasecmp( argv[0], "proxyattrset" ) == 0 ) {
+ } else if ( strcasecmp( argv0, "proxyattrset" ) == 0 ) {
if ( argc < 3 ) {
fprintf( stderr, "%s: line %d: missing arguments in \"proxyattrset "
"<index> <attributes>\"\n", fname, lineno );
attr_name->an_name.bv_len = 0;
}
}
- } else if ( strcasecmp( argv[0], "proxytemplate" ) == 0 ) {
+ } else if ( strcasecmp( argv0, "proxytemplate" ) == 0 ) {
if ( argc != 4 ) {
fprintf( stderr, "%s: line %d: missing argument(s) in "
"\"proxytemplate <filter> <proj attr set> <TTL>\" line\n",
temp->querystr.bv_val = NULL;
cm->numtemplates++;
- } else if ( strcasecmp( argv[0], "response-callback" ) == 0 ) {
+ } else if ( strcasecmp( argv0, "response-callback" ) == 0 ) {
/* set to "tail" to put the response callback
* at the end of the callback list; this is required
* in case other overlays are present, so that the
rc = cm->db.bd_info->bi_db_config( &cm->db, fname, lineno, argc, argv );
}
- if ( save_argv0 ) {
- argv[0] = save_argv0;
- }
-
return rc;
}
}
}
+ /* need to inherit something from the original database... */
+ cm->db.be_def_limit = be->be_def_limit;
+ cm->db.be_limits = be->be_limits;
+ cm->db.be_acl = be->be_acl;
+ cm->db.be_dfltaccess = be->be_dfltaccess;
+
rc = backend_startup_one( &cm->db );
/* There is no runqueue in TOOL mode */
if ( slapMode & SLAP_SERVER_MODE ) {
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
- ldap_pvt_runqueue_insert( &syncrepl_rq, cm->cc_period,
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+ ldap_pvt_runqueue_insert( &slapd_rq, cm->cc_period,
consistency_check, on );
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
/* Cached database must have the rootdn */
if ( BER_BVISNULL( &cm->db.be_rootndn )
query_manager *qm = cm->qm;
int i, j, rc = 0;
+ /* cleanup stuff inherited from the original database... */
+ cm->db.be_limits = NULL;
+ cm->db.be_acl = NULL;
+
if ( cm->db.bd_info->bi_db_close ) {
rc = cm->db.bd_info->bi_db_close( &cm->db );
}
ldap_scherr2str(code), err );
return code;
}
- code = at_add( at, &err );
+ code = at_add( at, 0, NULL, &err );
if ( !code ) {
slap_str2ad( at->at_names[0], &ad_queryid, &err );
}