On Tue, Feb 05, 2002 at 04:14:21PM -0500, Greg Ames wrote: > Looking in mod_auth_dbm.c, apparently AP_AUTH_DBM_USE_APR isn't defined because > the log message doesn't have the "(type %s)", so we are doing dbm_open() and > that fails. Should AP_AUTH_DBM_USE_APR be defined when mod_auth_dbm is compiled > on Unix? If so, how?
I could have sworn that I committed that. Aha! In fact, I posted a patch on 7 Jan for this. My fault - I forgot to commit it. Try this - I'll commit it now. I'm going to dig into the input filtering coredumps now. If I can post/commit a fix for that in time, can we try a new build with these changes instead of going back to .28? -- justin Index: modules/aaa/config.m4 =================================================================== RCS file: /home/cvs/httpd-2.0/modules/aaa/config.m4,v retrieving revision 1.51 diff -u -r1.51 config.m4 --- modules/aaa/config.m4 16 Oct 2001 21:32:40 -0000 1.51 +++ modules/aaa/config.m4 7 Jan 2002 18:18:55 -0000 @@ -7,23 +7,7 @@ APACHE_MODULE(access, host-based access control, , , yes) APACHE_MODULE(auth, user-based access control, , , yes) APACHE_MODULE(auth_anon, anonymous user access, , , most) -APACHE_MODULE(auth_dbm, DBM-based access databases, , , most, [ - AC_SEARCH_LIBS(dbm_open,[c db1],,enable_auth_dbm=no) - dnl Glibc 2.1's ndbm.h includes <db.h> in ndbm.h. So, we need to find - dnl where db.h lives. (glibc 2.2 includes <db1/db.h>.) - AC_TRY_COMPILE([#include "ndbm.h"], [dbm_open("/dev/null", 0, 0)], - ap_good_db_path="yes", ap_good_db_path="no") - if test "$ap_good_db_path" = "no"; then - ap_old_cppflags=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -I/usr/include/db1" - AC_TRY_COMPILE([#include "ndbm.h"], [dbm_open("/dev/null", 0, 0)], - ap_good_db_path="yes", ap_good_db_path="no") - if test "$ap_good_db_path" = "no"; then - CPPFLAGS=$ap_old_cppflags - enable_auth_dbm=no - fi - fi -]) +APACHE_MODULE(auth_dbm, DBM-based access databases, , , most) APACHE_MODULE(auth_db, DB-based access databases, , , , [ AC_CHECK_HEADERS(db.h,,enable_auth_db=no) Index: modules/aaa/mod_auth_dbm.c =================================================================== RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth_dbm.c,v retrieving revision 1.41 diff -u -r1.41 mod_auth_dbm.c --- modules/aaa/mod_auth_dbm.c 7 Jan 2002 18:10:54 -0000 1.41 +++ modules/aaa/mod_auth_dbm.c 7 Jan 2002 18:18:55 -0000 @@ -75,16 +75,7 @@ #define APR_WANT_STRFUNC #include "apr_want.h" #include "apr_strings.h" - -#if defined(AP_AUTH_DBM_USE_APR) #include "apr_dbm.h" -#define DBM apr_dbm_t -#define datum apr_datum_t - -#define dbm_close apr_dbm_close -#else -#include <ndbm.h> -#endif #include "httpd.h" #include "http_config.h" @@ -160,14 +151,12 @@ static char *get_dbm_pw(request_rec *r, char *user, char *auth_dbmpwfile, - char*dbtype) + char *dbtype) { - DBM *f; - datum d, q; + apr_dbm_t *f; + apr_datum_t d, q; char *pw = NULL; -#ifdef AP_AUTH_DBM_USE_APR apr_status_t retval; -#endif q.dptr = user; #ifndef NETSCAPE_DBM_COMPAT q.dsize = strlen(q.dptr); @@ -175,37 +164,21 @@ q.dsize = strlen(q.dptr) + 1; #endif -#ifdef AP_AUTH_DBM_USE_APR - retval = apr_dbm_open_ex(&f, dbtype, auth_dbmpwfile, APR_DBM_READONLY, - APR_OS_DEFAULT, r->pool); + retval = apr_dbm_open_ex(&f, dbtype, auth_dbmpwfile, APR_DBM_READONLY, + APR_OS_DEFAULT, r->pool); if (retval != APR_SUCCESS) { ap_log_rerror(APLOG_MARK, APLOG_ERR, retval, r, "could not open dbm (type %s) auth file: %s", dbtype, auth_dbmpwfile); return NULL; } - if (apr_dbm_fetch(f, q, &d) == APR_SUCCESS) - /* sorry for the obscurity ... falls through to the - * if (d.dptr) { block ... - */ - -#else - if (!(f = dbm_open(auth_dbmpwfile, O_RDONLY, 0664))) { - ap_log_rerror(APLOG_MARK, APLOG_ERR, errno, r, - "could not open dbm auth file: %s", auth_dbmpwfile); - return NULL; - } - d = dbm_fetch(f, q); - -#endif - - if (d.dptr) { + if (apr_dbm_fetch(f, q, &d) == APR_SUCCESS && d.dptr) { pw = apr_palloc(r->pool, d.dsize + 1); strncpy(pw, d.dptr, d.dsize); pw[d.dsize] = '\0'; /* Terminate the string */ } - dbm_close(f); + apr_dbm_close(f); return pw; }