httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Stoddard" <b...@wstoddard.com>
Subject Re: [PATCH] mod_include incorrect function table offset
Date Fri, 20 Apr 2001 14:59:39 GMT
Spent a bit of time looking at this and I think the fix is in the wrong place but I'm not enough
of
a mod_include expert to say for sure.

First, mod_include generally works so I presume this is a case where a tag spans buckets.
In that
case, ctx->directive_length is wrong. Wouldn;t the best solution be to fix the content
of
ctx->directive_length (perhaps in get_combined_directive)

Paul, opinions?

Bill


> >From a co-worker of mine...
>
> Rob Simonson
> simo@us.ibm.com
>
> -------------------------------------------------
>
>
> Rob,
>
> I have described here the error I have encountered, and the fix I have done
> in order to get mod_include to work correctly.  The problem I encountered
> was in the send_parsed_content subroutine in mod_include.  The code as is
> currently obtained from the Apache Software Foundation does not determine
> the correct offset into the function table that is set up at post_config
> time by mod_include.  The include handler functions are placed into a hash
> table, using the function name(i.e. 'echo',  'config', ' include', ...) and
> the length of the function, plus the null terminator.  The input to the
> hash routine must be the same when the functions are retrieved in order for
> function to be handled.  The code calls get_combined_directive to get the
> directive into the ctx control block.  This routine will set the directive,
> which is the entire field, from the start sequence to the end sequence,
> into the ctx control block, and set this directive length in the ctx.
> These fields are passed into the hash routine to find the include function
> name.  Since the function name and length are not the same as the directive
> and directive length in the ctx, the hash table entry for the include
> function is not found.
>
> I have changed the following code in order to get the directive and
> directive length passed to the hash routine to find the proper include
> function.
>
>
> Karen L. Richner
>
> --------------------------------------------------
>
> ***************
> *** 2352,2357 ****
> --- 2352,2359 ----
>       apr_bucket *dptr = APR_BRIGADE_FIRST(*bb);
>       apr_bucket *tmp_dptr;
>       apr_bucket_brigade *tag_and_after;
> +     char *c;
> +     int dirlen;
>       int ret;
>
>       if (r->args) {              /* add QUERY stuff to env cause it ain't
> yet */
> ***************
> *** 2508,2523 ****
>                *  it NULL terminated (and include the NULL in the length)
> for proper
>                *  hash matching.
>                */
> !             for (tmp_i = 0; tmp_i < ctx->directive_length; tmp_i++) {
>                   ctx->combined_tag[tmp_i] =
> apr_tolower(ctx->combined_tag[tmp_i]);
>               }
> !             ctx->combined_tag[ctx->directive_length] = '\0';
> !             ctx->curr_tag_pos =
> &ctx->combined_tag[ctx->directive_length+1];
>
>               handle_func =
>                   (int (*)(include_ctx_t *, apr_bucket_brigade **,
> request_rec *,
>                       ap_filter_t *, apr_bucket *, apr_bucket **))
> !                 apr_hash_get(include_hash, ctx->combined_tag,
> ctx->directive_length+1);
>               if (handle_func != NULL) {
>                   ret = (*handle_func)(ctx, bb, r, f, dptr, &content_head);
>               }
> --- 2510,2533 ----
>                *  it NULL terminated (and include the NULL in the length)
> for proper
>                *  hash matching.
>                */
> !
> !        c = ctx->combined_tag;
> !        while ((*c != '\0') && (*c != ' ')) {
> !         c++;
> !        }
> !        dirlen = c - ctx->combined_tag;
> !
> !             for (tmp_i = 0; tmp_i < dirlen; tmp_i++) {
>                   ctx->combined_tag[tmp_i] =
> apr_tolower(ctx->combined_tag[tmp_i]);
>               }
> !             ctx->combined_tag[dirlen] = '\0';
> !        ctx->curr_tag_pos = &ctx->combined_tag[dirlen+1];
>
> +
>               handle_func =
>                   (int (*)(include_ctx_t *, apr_bucket_brigade **,
> request_rec *,
>                       ap_filter_t *, apr_bucket *, apr_bucket **))
> !                 apr_hash_get(include_hash, ctx->combined_tag, dirlen+1);
>               if (handle_func != NULL) {
>                   ret = (*handle_func)(ctx, bb, r, f, dptr, &content_head);
>               }
>
>
>


Mime
View raw message