httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <n...@webthing.com>
Subject Re: mod_authn_dbd fix?
Date Tue, 29 Aug 2006 13:36:13 GMT
On Tuesday 29 August 2006 07:27, Chris Darroch wrote:
> Hi --
>
>    I noticed some recent activity in mod_dbd.c to deal with virtual
> host configurations, but didn't pay a lot of attention, I confess.
> Today I happened to upgrade a system from 2.2.2 to 2.2.3 and discovered
> my AuthDBDUserRealmQuery directives now weren't getting inherited from
> the main server config down to the virtual hosts the way they used to.

http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/database/mod_dbd.c?r1=424798&r2=432562

fixes a problem in 2.2.3

Your patch is not against the same problem, but appears related.

> So, I whipped up this patch -- does it make sense to anyone else?


>      svr_cfg *svr;
>      server_rec *sp;
> +    dbd_prepared *main_server_prepared;
>      for (sp = s; sp; sp = sp->next) {
>          svr = ap_get_module_config(sp->module_config, &dbd_module);
>          svr->prepared = apr_hash_get(dbd_prepared_defns,
> sp->server_hostname, APR_HASH_KEY_STRING);
> +        if (sp == s) {
> +            main_server_prepared = svr->prepared;
> +        }
> +        else if (main_server_prepared != NULL) {
> +            if (svr->prepared == NULL) {
> +                svr->prepared = main_server_prepared;
> +            }

That'll do inheritance that should (afaics) be dealt with by merge_config?

> +            else {
> +                dbd_prepared *last_prepared = svr->prepared;
> +
> +                while (last_prepared->next != NULL) {
> +                    last_prepared = last_prepared->next;
> +                }
> +                last_prepared->next = main_server_prepared;
> +            }

I don't think we ever had that kind of merge.  And it also looks like
possible overspill/pollution, where directives from the main config
are not necessarily wanted in a vhost.

The complexity here seems to stem from two things.  One is
specifically the treatment of prepared statements.  In retrospect,
this is a poor approach: we should instead have exported an
optional "dbd_construct" hook which modules could use to
prepare statements more cleanly.  My fault, of course, and I'm going 
to think about whether that can be changed without breaking things.

The other lies in the different configuration hierarchies:
mod_dbd lives in the server hierarchy, but prepared statements
commonly apply per-directory.  This is falling into a similar trap to
mod_proxy in 2.0.  I *think* that if we can move to a hook, that'll
go away, if the prepared statements for other modules can be
taken away from the mod_dbd config.

-- 
Nick Kew

Mime
View raw message