httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paritosh Shah" <shah.parit...@gmail.com>
Subject 'prepared statement already exists' bug with postgres & mod_authn_dbd
Date Mon, 09 Apr 2007 12:22:59 GMT
I am getting a 'prepared statement "authn_dbd_2" already exists' error while
trying to use mod_authn_dbd with postgres ( works fine with mysql ).

PostgreSQL 8.2 log:
LOG:  connection received: host=127.0.0.1 port=38660
LOG:  connection authorized: user=root database=xxxx
ERROR:  prepared statement "authn_dbd_2" already exists
STATEMENT:  PREPARE authn_dbd_2 (varchar,varchar) AS SELECT pwhash FROM
principals INNER JOIN users ON principals.resource_id =
users.principal_idWHERE name = $1 and name != $2
LOG:  connection received: host= 127.0.0.1 port=38662
LOG:  connection authorized: user=root database=xxxx
ERROR:  prepared statement "authn_dbd_2" already exists
STATEMENT:  PREPARE authn_dbd_2 (varchar,varchar) AS SELECT pwhash FROM
principals INNER JOIN users ON principals.resource_id =
users.principal_idWHERE name = $1 and name != $2
LOG:  unexpected EOF on client connection
LOG:  unexpected EOF on client connection

apache error_log:
[Mon Apr 09 15:28:23 2007] [notice] Digest: generating secret for digest
authentication ...
[Mon Apr 09 15:28:23 2007] [notice] Digest: done
[Mon Apr 09 15:28:48 2007] [error] [client 127.0.0.1] Error looking up xxxx
in database

I tried to find out when mod_authn_dbd returns "Error looking up xxx in
database" error. In my case, it is being caused by authn_dbd_acquire_fn
returning NULL. A related bug has been filed for mysql:
39329<http://issues.apache.org/bugzilla/show_bug.cgi?id=39329>

relevant code snippet from mod_authn_dbd.c:
( function authn_dbd_realm )

    ap_dbd_t *dbd = authn_dbd_acquire_fn(r);
    if (dbd == NULL) {
        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,
                      "Error looking up %s in database", user);
        return AUTH_GENERAL_ERROR;
    }

Here is my setup :
apache 2.2.3 compiled with following flags :
./configure --with-included-apr --enable-auth-digest --enable-so
--enable-dav --enable-dbd --enable-authn-dbd --with-pgsql=/usr/local/pgsql

relevant sections of httpd.conf :

DBDriver pgsql
DBDParams "port=5432 host=localhost dbname=xxxx user=root password=xxxx"

DBDMin     1
DBDKeep    1
DBDMax     10
DBDExptime 0

<Location /xxxx>
  DAV repos
  ModMimeUsePathInfo on

  AuthType Digest
  AuthName "users@xxxx"
  AuthDigestProvider dbd

  Require valid-user

  AuthDBDUserRealmQuery "SELECT pwhash FROM principals INNER JOIN users ON
principals.resource_id = users.principal_id WHERE name = %s and name != %s"

</Location>

Mime
View raw message