You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@locus.apache.org on 2000/12/08 19:27:55 UTC

cvs commit: httpd-2.0/modules/aaa mod_auth_dbm.dsp mod_auth_dbm.c

wrowe       00/12/08 10:27:54

  Modified:    modules/aaa mod_auth_dbm.dsp mod_auth_dbm.c
  Log:
    The feature macro may appear a bit odd.  I'm open to any better suggest.
    Define AP_AUTH_DBM_USE_APR for apr dbm access, and apply the symbol to
    the win32 build.
  
  Revision  Changes    Path
  1.7       +2 -2      httpd-2.0/modules/aaa/mod_auth_dbm.dsp
  
  Index: mod_auth_dbm.dsp
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth_dbm.dsp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- mod_auth_dbm.dsp	2000/12/05 20:35:46	1.6
  +++ mod_auth_dbm.dsp	2000/12/08 18:27:53	1.7
  @@ -43,7 +43,7 @@
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
   # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
  -# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I "..\..\srclib\sdbm" /I "..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
  +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\include" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I "..\..\srclib\sdbm" /I "..\..\os\win32" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "AP_AUTH_DBM_USE_APR" /FD /c
   # ADD BASE MTL /nologo /D "NDEBUG" /win32
   # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
   # ADD BASE RSC /l 0x809 /d "NDEBUG"
  @@ -69,7 +69,7 @@
   # PROP Ignore_Export_Lib 0
   # PROP Target_Dir ""
   # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
  -# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I "..\..\srclib\sdbm" /I "..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /FD /c
  +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\..\include" /I "..\..\srclib\apr\include" /I "../../srclib/apr-util/include" /I "..\..\srclib\sdbm" /I "..\..\os\win32" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "AP_AUTH_DBM_USE_APR" /FD /c
   # ADD BASE MTL /nologo /D "_DEBUG" /win32
   # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
   # ADD BASE RSC /l 0x809 /d "_DEBUG"
  
  
  
  1.21      +19 -12    httpd-2.0/modules/aaa/mod_auth_dbm.c
  
  Index: mod_auth_dbm.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth_dbm.c,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- mod_auth_dbm.c	2000/10/30 20:45:38	1.20
  +++ mod_auth_dbm.c	2000/12/08 18:27:53	1.21
  @@ -77,13 +77,13 @@
   #include "http_protocol.h"
   #include "http_request.h"   /* for ap_hook_(check_user_id | auth_checker)*/
   
  -#if defined(WIN32) /* XXX: A better feature test is needed here */
  -#include "sdbm.h"
  -#define DBM SDBM
  -#define datum sdbm_datum
  -#define dbm_open sdbm_open
  -#define dbm_fetch sdbm_fetch
  -#define dbm_close sdbm_close
  +#if defined(AP_AUTH_DBM_USE_APR)
  +#include "apr_dbm.h"
  +#define DBM apr_dbm_t
  +#define datum apr_datum_t
  +#define dbm_open apr_dbm_open
  +#define dbm_fetch apr_dbm_fetch
  +#define dbm_close apr_dbm_close
   #elif defined(__GLIBC__) && defined(__GLIBC_MINOR__) \
       && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
   #include <db1/ndbm.h>
  @@ -160,7 +160,7 @@
       DBM *f;
       datum d, q;
       char *pw = NULL;
  -#ifdef WIN32 /* this is only used on Windows, so only define it on Windows */
  +#ifdef AP_AUTH_DBM_USE_APR
       apr_status_t retval;
   #endif
       q.dptr = user;
  @@ -170,19 +170,26 @@
       q.dsize = strlen(q.dptr) + 1;
   #endif
   
  -#ifdef WIN32 /* XXX: Same bad symbol here - need feature macro */
  -    if (!(retval = dbm_open(&f, auth_dbmpwfile, O_RDONLY, 0664, r->pool))) {
  +#ifdef AP_AUTH_DBM_USE_APR
  +    if (!(retval = dbm_open(&f, auth_dbmpwfile, APR_DBM_READONLY, r->pool))) {
           ap_log_rerror(APLOG_MARK, APLOG_ERR, retval, r,
   		    "could not open sdbm auth file: %s", auth_dbmpwfile);
  +	return NULL;
  +    }
  +    if (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);
  -#endif
   	return NULL;
       }
  -
       d = dbm_fetch(f, q);
  +
  +#endif
   
       if (d.dptr) {
   	pw = apr_palloc(r->pool, d.dsize + 1);