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 <ro...@imdb.com> on 1997/03/05 18:35:54 UTC

Re: DBM User Auth. (Apache/Linux) Help! (fwd)

I think we should support this via a #define 

---------- Forwarded message ----------
Date: 05 Mar 1997 10:59:36 -0500
From: "Todd R. Eigenschink" <ei...@pluto.mixi.net>
Newsgroups: comp.infosystems.www.servers.unix
Subject: Re: DBM User Auth. (Apache/Linux) Help!

<snip>

But the mods to make mod_auth_dbm.c use GDBM are trivial--a whopping 4
lines.  A diff is attached.  I've been using this as long as I've been
using DBM-style password files, which has been since 1.1.1 was hot
stuff. :-)

<snip>

--- mod_auth_dbm.c.orig	Sun Jan 19 23:28:11 1997
+++ mod_auth_dbm.c	Mon Feb 24 08:31:55 1997
@@ -69,7 +69,7 @@
 #include "http_core.h"
 #include "http_log.h"
 #include "http_protocol.h"
-#include <ndbm.h>
+#include <gdbm.h>
 
 typedef struct  {
 
@@ -121,19 +121,19 @@
 module dbm_auth_module;
 
 char *get_dbm_pw(request_rec *r, char *user, char *auth_dbmpwfile) {
-    DBM *f; 
+    GDBM_FILE f; 
     datum d, q; 
     char *pw = NULL;
 
     q.dptr = user; 
     q.dsize = strlen(q.dptr); 
     
-    if(!(f=dbm_open(auth_dbmpwfile,O_RDONLY,0664))) {
+    if(!(f=gdbm_open(auth_dbmpwfile,0,GDBM_READER,0664,0))) {
         log_reason ("could not open dbm auth file", auth_dbmpwfile, r);
 	return NULL;
     }
 
-    d = dbm_fetch(f, q);
+    d = gdbm_fetch(f, q);
 
     if (d.dptr) {
         pw = palloc (r->pool, d.dsize + 1);
@@ -141,7 +141,7 @@
 	pw[d.dsize] = '\0';         /* Terminate the string */
     }
 
-    dbm_close(f);
+    gdbm_close(f);
     return pw; 
 }
 


-- 
Todd R. Eigenschink		Midwest Internet Exchange, Inc.
eigenstr@mixi.net		http://www.mixi.net/
System Administrator		(219) 459-2521