]> git.sur5r.net Git - openldap/commitdiff
Allow search rewriter plugins to also set the search base, scope, and alias
authorLuke Howard <lukeh@openldap.org>
Wed, 23 Apr 2003 08:16:05 +0000 (08:16 +0000)
committerLuke Howard <lukeh@openldap.org>
Wed, 23 Apr 2003 08:16:05 +0000 (08:16 +0000)
dereference policy

servers/slapd/search.c

index 607bf02662d27c3df349b103c9d2994c4ca6e3e7..34c52264b07ac1025e4be81c0d9216057247bd49 100644 (file)
@@ -472,6 +472,8 @@ static int doPreSearchPluginFNs( Operation *op )
 static int doSearchRewriteFNs( Operation *op )
 {
        if ( doPluginFNs( op->o_bd, SLAPI_PLUGIN_COMPUTE_SEARCH_REWRITER_FN, op->o_pb ) == 0 ) {
+               int rc;
+
                /*
                 * The plugin can set the SLAPI_SEARCH_FILTER.
                 * SLAPI_SEARCH_STRFILER is not normative.
@@ -479,6 +481,26 @@ static int doSearchRewriteFNs( Operation *op )
                slapi_pblock_get( op->o_pb, SLAPI_SEARCH_FILTER, (void *)&op->ors_filter );
                op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
                filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
+
+               /*
+                * Also permit other search parameters to be reset. One thing
+                * this doesn't (yet) deal with is plugins that change a root
+                * DSE search to a non-root DSE search...
+                */
+               slapi_pblock_get( op->o_pb, SLAPI_SEARCH_TARGET, (void **)&op->o_req_dn.bv_val );
+               op->o_req_dn.bv_len = strlen( op->o_req_dn.bv_val );
+
+               if( op->o_req_ndn.bv_val != NULL) {
+                       sl_free( op->o_req_ndn.bv_val, op->o_tmpmemctx );
+               }
+               rc = dnNormalize2( NULL, &op->o_req_dn, &op->o_req_ndn, op->o_tmpmemctx );
+               if ( rc != LDAP_SUCCESS ) {
+                       return rc;
+               }
+
+               slapi_pblock_get( op->o_pb, SLAPI_SEARCH_SCOPE, (void **)&op->ors_scope );
+               slapi_pblock_get( op->o_pb, SLAPI_SEARCH_DEREF, (void **)&op->ors_deref );
+
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ARGS, 
                        "doSearchRewriteFNs: after compute_rewrite_search filter: %s\n",