Issue with mod_dbd

Issue with mod_dbd

am 26.03.2010 20:21:22 von Travis Veazey

Forgive me if this is the wrong forum to ask this question, but I am
having a problem using mod_dbd under Apache 2.2.12.

We had been using mod_dbd successfully to manage our authentication
using a MySQL server, however we are in the process of promoting a
former slave replication database to master. Using the former master
("host1"), we were able to successfully use mod_dbd. Changing the host
to point to our new master ("host2"), however, results in mod_dbd
being unable to find any user accounts; the only change we have made
is the host name.

We have verified the following already:
1) host1 and host2 have identical data in the relevant table.
2) From the web host we can successfully connect to both host1 and
host2 using the MySQL command-line client and the username/password
mod_dbd is configured to use.
3) We have confirmed the ability for this user to prepare and execute
statements on both host1 and host2.

When we turn on query logging on our databases, we can see that on
host1 the query
SELECT password FROM users WHERE username = %s
is being correctly executed as
SELECT password FROM users WHERE username = 'john.doe'
However, the same prepared statement on host 2 is executed as
SELECT password FROM users WHERE username = ''

What could cause mod_dbd's prepared statement to properly include the
user name on one database server, but fail to do so on another? Both
servers are running an identical MySQL version (4.1.22 - don't ask, we
can't upgrade), and we've manually verified that the same data is on
both and that the user has proper permissions to get to it (via direct
query as well as prepared statement). The only difference is that
host1 (where it works correctly) is Gentoo, while host2 is Ubuntu:
uname -a
Linux host1 2.6.24-gentoo-r7 #1 SMP Thu Jul 3 18:36:20 UTC 2008 x86_64
Dual-Core AMD Opteron(tm) Processor 2218 AuthenticAMD GNU/Linux
Linux host2 2.6.31-20-server #57-Ubuntu SMP Mon Feb 8 09:59:59 UTC
2010 x86_64 GNU/Linux

My mod_dbd configuration directives look like this:
DBDriver mysql
DBDParams "host=host1 dbname=db user=user pass=pass"
DBDMin 1
DBDKeep 2
DBDMax 10
DBDExptime 60
DBDPersist On

And for the v-host specific:
AuthType Basic
AuthName "Foo Bar"
AuthBasicProvider dbd
Require valid-user
AuthDBDUserPWQuery "select password from users where username = %s"

Any insight would be appreciated - it seems to be a failure to bind
the parameter to the prepared statement, yet doing either directly via
the command-line client or via PHP I can execute prepared statements
correctly on both hosts. Any ideas what the issue could be?

Thanks,
Travis

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Issue with mod_dbd

am 26.03.2010 20:31:00 von Nick Kew

On 26 Mar 2010, at 19:21, Travis Veazey wrote:

> Forgive me if this is the wrong forum to ask this question, but I am
> having a problem using mod_dbd under Apache 2.2.12.

What's in your Apache error log? And your MySQL logs?

--
Nick Kew

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org

Re: Issue with mod_dbd

am 26.03.2010 20:46:36 von Travis Veazey

On Fri, Mar 26, 2010 at 11:31, Nick Kew wrote:
>
> On 26 Mar 2010, at 19:21, Travis Veazey wrote:
>
>> Forgive me if this is the wrong forum to ask this question, but I am
>> having a problem using mod_dbd under Apache 2.2.12.
>
> What's in your Apache error log?  And your MySQL logs?
>
> --
> Nick Kew

In the Apache error log, we see errors such as the following when
trying to authenticate against host2:
[Fri Mar 26 10:12:24 2010] [error] [client 24.237.223.102] user
travis.veazey not found: /trac/wiki
[Fri Mar 26 10:12:25 2010] [error] [client 24.237.223.102] user
travis.veazey not found: /trac/wiki
[Fri Mar 26 10:12:26 2010] [error] [client 24.237.223.102] user
travis.veazey not found: /trac/wiki

In MySQL, when query logging is engaged (we keep it off generally
because it is a high-traffic production system):
82 Connect authuser@192.168.10.7 on accounts
82 Query SET NAMES latin1
82 Quit
83 Connect authuser@192.168.10.7 on accounts
83 Prepare [1] select password from users
where username =3D ?
83 Prepare [2] select password from users
where username =3D ?
83 Prepare [3] select password from users
where username =3D ?
83 Prepare [4] select password from users
where username =3D ?
83 Execute [3] select password from users
where username =3D ''

The Apache error does not show up when pointing to host1, where the
MySQL query log shows the correct username being substituted in place
of the placeholder when the statement is executed. MySQL error logging
does not pick up anything in either case.

-Travis

------------------------------------------------------------ ---------
The official User-To-User support forum of the Apache HTTP Server Project.
See for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org