apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Ingram <d...@dmi.me.uk>
Subject Re: apr_dbd_prepare() corrupts arguments on failure
Date Mon, 13 Oct 2008 12:48:04 GMT
Tom Donovan wrote:
> Dave Ingram wrote:
>> <SQLRepeat "SELECT hostname, domain FROM hosts WHERE status = 1">
>> <VirtualHost *:80>
>>   ServerName ${hostname}.${domain}
>>   <SQLRepeat "SELECT * FROM host_aliases WHERE hostname=? AND
>> domain=?" "${hostname}" "${domain}">
>>     ServerAlias ${alias}
>>   </SQLRepeat>
>>   # ...
>> </SQLRepeat>
>> without worrying about what the hostname/domain strings actually
>> contain.
> With APR 1.3 you must pass string parameters as %s, rather than ?
Ah, thanks - I didn't know that. I might do an automagic conversion from
? to %s. Still, it shouldn't break like this on a query that doesn't
contain any parameters...

> mod_vhost_dbd is a little bit like your module.  You might want to
> look over the source code for it at http://code.google.com/p/dbd-modules/
Thanks for the link. It's a little similar, but there are some very
important differences. All of my directives are executed as they are
parsed at configuration time (like mod_macro) as it is intended to be
extremely flexible (again, like mod_macro). Unfortunately, this means
that I can't use mod_dbd (much as I'd like to), as it isn't initialised
until the server starts. This has to be done as the directives are
parsed, because template sections can contain any directives:

<SQLRepeat ...>
<VirtualHost ...>
<SQLSimpleIf ${has_custom_config}>
  Include "vhost.custom/${hostname}.${domain}.conf"

So it all has to be done at parse time. I wish I knew more about how APR
worked so I can get to the bottom of this issue! :-)


View raw message