* perform the remote query without control and cache all results,
* performing the pagedResults search only within the client
* and the proxy. This requires pcache to understand pagedResults. */
-static int
-proxy_cache_remove_paged_results(
- Operation *op,
- SlapReply *rs )
-{
- if ( op->o_pagedresults == SLAP_CONTROL_CRITICAL ) {
- Debug( LDAP_DEBUG_ANY, "%s: "
- "critical pagedResults control disabled with proxy cache.\n",
- op->o_log_prefix, 0, 0 );
-
- } else if ( op->o_pagedresults == SLAP_CONTROL_NONCRITICAL ) {
- Debug( LDAP_DEBUG_ANY, "%s: "
- "non-critical pagedResults control disabled with proxy cache; stripped.\n",
- op->o_log_prefix, 0, 0 );
- }
-
- assert( op->o_pagedresults_state != NULL );
- op->o_tmpfree( op->o_pagedresults_state, op->o_tmpmemctx );
- op->o_pagedresults_state = NULL;
-
- return 0;
-}
-
static int
proxy_cache_chk_controls(
Operation *op,
SlapReply *rs )
{
- int rc = SLAP_CB_CONTINUE;
+ const char *non = "";
+ const char *stripped = "";
- if ( op->o_pagedresults ) {
- int tmprc;
+ switch( op->o_pagedresults ) {
+ case SLAP_CONTROL_NONCRITICAL:
+ non = "non-";
+ stripped = "; stripped";
+ /* fallthru */
- tmprc = slap_remove_control( op, rs, slap_cids.sc_pagedResults,
- proxy_cache_remove_paged_results );
- if ( tmprc != SLAP_CB_CONTINUE ) {
- rc = tmprc;
- }
- }
+ case SLAP_CONTROL_CRITICAL:
+ Debug( LDAP_DEBUG_ANY, "%s: "
+ "%scritical pagedResults control "
+ "disabled with proxy cache%s.\n",
+ op->o_log_prefix, non, stripped );
+
+ slap_remove_control( op, rs, slap_cids.sc_pagedResults, NULL );
+ break;
- rs->sr_err = rc;
+ default:
+ rs->sr_err = SLAP_CB_CONTINUE;
+ break;
+ }
- return rc;
+ return rs->sr_err;
}
static int
cache_manager *cm = on->on_bi.bi_private;
query_manager *qm = cm->qm;
Connection conn = {0};
- char opbuf[OPERATION_BUFFER_SIZE];
+ OperationBuffer opbuf;
Operation *op;
SlapReply rs = {REP_RESULT};
int i, return_val, pause = 1;
QueryTemplate* templ;
- op = (Operation *)opbuf;
+ op = (Operation *) &opbuf;
connection_fake_init( &conn, op, ctx );
op->o_bd = &cm->db;
Debug( LDAP_DEBUG_ANY, "%s: %s\n", c->log, c->msg, 0 );
return( 1 );
}
- cm->db.bd_info = backend_info( c->argv[1] );
- if ( !cm->db.bd_info ) {
+ if ( !backend_db_init( c->argv[1], &cm->db )) {
sprintf( c->msg, "unknown backend type" );
Debug( LDAP_DEBUG_ANY, "%s: %s\n", c->log, c->msg, 0 );
return( 1 );
}
- if ( cm->db.bd_info->bi_db_init( &cm->db ) ) {
- sprintf( c->msg, "backend %s init failed", c->argv[1] );
- Debug( LDAP_DEBUG_ANY, "%s: %s\n", c->log, c->msg, 0 );
- return( 1 );
- }
-
- /* This type is in use, needs to be opened */
- cm->db.bd_info->bi_nDB++;
-
cm->max_entries = atoi( c->argv[2] );
cm->num_entries_limit = atoi( c->argv[4] );