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_digest, RFC2617 Digest authentication, , , most, [
ap_old_cppflags=$CPPFLAGS
#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"
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);
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;
}