Hi,
I am facing problem about how to share context between input filter and
output filter which are registered through different hooks.
Here is description of the problem:
====================
static void
mod_realsecure_register_hooks (apr_pool_t * p)
{
ap_hook_child_init (realsecure_child_init, NULL, NULL, APR_HOOK_MIDDLE);
ap_hook_create_request(realsecure_hook_insertfilter , NULL, NULL,
APR_HOOK_MIDDLE);
ap_hook_insert_filter(realsecure_hook_insertoutputfilter , NULL, NULL,
APR_HOOK_MIDDLE);
};
static int realsecure_hook_insertfilter(request_rec *r)
{
PamReqRspCtx *ctxPam1;
ctxPam1 = (PamReqRspCtx *)apr_palloc(r->pool,sizeof(PamReqRspCtx));
ap_add_input_filter("REALSECURE_READ_INPUT_1", (void *) ctxPam1, r,
r->connection);
ap_add_output_filter("REALSECURE_READ_OUTPUT_1",(void *) ctxPam1, r,
r->connection);
return OK;
}
static void realsecure_hook_insertoutputfilter(request_rec *r)
{
PamReqRspCtx *ctxPam2;
ctxPam2 = (PamReqRspCtx *)apr_palloc(r->pool,sizeof(PamReqRspCtx));
ap_add_input_filter("REALSECURE_READ_INPUT_2", (void *) ctxPam2, r,
r->connection);
ap_add_output_filter("REALSECURE_READ_OUTPUT_2",(void *) ctxPam2, r,
r->connection);
return OK;
}
Now my problem is the context(ctxPam1) which I have created in
realsecure_hook_insertfilter(request_rec *r) function and stored some data
how to access that context and data (ctxPam1) in
realsecure_hook_insertoutputfilter(request_rec *r) function
Please let me know about the solution.
-Ashish