You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ha...@hyperreal.com> on 1995/08/31 21:55:39 UTC
Enhancement: 0.8.11 change to mod_auth_dbm.c to support DB (fwd)
I think Rob T said he was collecting the feature patches for a
later date. Here's another. If Rob isn't collecting them, we should
(or maybe do this anyway) drop them into a directory on hyperreal.
Forwarded message:
> From sanders@austin.bsdi.com Thu Aug 31 11:29:20 1995
> Message-Id: <19...@austin.bsdi.com>
> To: apache-bugs@apache.org
> Subject: Enhancement: 0.8.11 change to mod_auth_dbm.c to support DB
> From: Tony Sanders <sa...@bsdi.com>
> Organization: Berkeley Software Design, Inc.
> Date: Thu, 31 Aug 1995 13:29:03 -0500
> Sender: sanders@austin.bsdi.com
>
> I've made this conditional on -DAUTHDB for lack of a better choice.
> You are, of course, free to integrate it in a different way if you
> like (I'm not a big fan of #ifdef'ed code myself). I thought about
> making it a seperate module but the changes are trivial.
>
> This is currently untested because I'm not using that interface
> at the moment but I did make sure it compiled on BSD/OS.
>
> *** mod_auth_dbm.c.dist Thu Aug 31 13:12:14 1995
> --- mod_auth_dbm.c Thu Aug 31 13:21:24 1995
> ***************
> *** 65,70 ****
> --- 65,71 ----
> * Rob McCool & Brian Behlendorf.
> *
> * Adapted to Shambhala by rst.
> + * Adapted to conditionally support the DB package, sanders@bsdi.com, 8/30/95
> */
>
> #include "httpd.h"
> ***************
> *** 72,78 ****
> --- 73,83 ----
> #include "http_core.h"
> #include "http_log.h"
> #include "http_protocol.h"
> + #ifdef AUTHDB
> + #include <db.h>
> + #else
> #include <ndbm.h>
> + #endif
>
> typedef struct {
>
> ***************
> *** 98,103 ****
> --- 103,136 ----
>
> module dbm_auth_module;
>
> + #ifdef AUTHDB
> + char *get_dbm_pw(request_rec *r, char *user, char *auth_dbmpwfile) {
> + DB *f;
> + DBT d, q;
> + char *pw = NULL;
> +
> + q.data = user;
> + q.size = strlen(q.data);
> +
> + if(!(f=dbopen(auth_dbmpwfile,O_RDONLY,0664,DB_HASH,NULL))) {
> + log_reason ("could not open dbm auth file", auth_dbmpwfile, r);
> + return NULL;
> + }
> +
> + (f->get)(f, &q, &d, 0);
> +
> + if (d.data) {
> + pw = palloc (r->pool, d.size + 1);
> + strncpy(pw,d.data,d.size);
> + pw[d.size] = '\0'; /* Terminate the string */
> + }
> +
> + (f->close)(f);
> + return pw;
> + }
> +
> + #else /* AUTHDB */
> +
> char *get_dbm_pw(request_rec *r, char *user, char *auth_dbmpwfile) {
> DBM *f;
> datum d, q;
> ***************
> *** 122,127 ****
> --- 155,161 ----
> dbm_close(f);
> return pw;
> }
> + #endif /* AUTHDB */
>
> char *get_dbm_grp(request_rec *r, char *user, char *auth_dbmgrpfile) {
> char *grp_data = get_dbm_pw (r, user, auth_dbmgrpfile);
>