You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by co...@apache.org on 1999/04/29 00:02:16 UTC

Re: mod_auth-any/3507: Auth DBM not working in 1.3.3

[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]


Synopsis: Auth DBM not working in 1.3.3

Comment-Added-By: coar
Comment-Added-When: Wed Apr 28 15:02:14 PDT 1999
Comment-Added:
[Comment by "David D. Kilzer" <dd...@raytheon.com>]
This is in regards to PR number 3507.

  http://bugs.apache.org/index/full/3507

I believe the problem that many people are seeing with respect to 
mod_auth_dbm not working in Apache, especially under Solaris, is the
fact that NDBM under Solaris 2.x is *not* "MT-Safe" or "MT-Level Unsafe"
(according to its man page).  I believe this is what is causing many
people problems when they try to use NDBM on their native OS.

To test this theory, I modified mod_auth_dbm.c to *create* a DBM file at
the same time it tries to open another one.  (See included patch below.)
In theory if DBM is working, a normal, readable DBM file will be
created.

The result under Solaris 2.5 is two files (/tmp/apache.dir and
/tmp/apache.pag) that appear to contain complete garbage.  I even got a
core dump from dbmmanage (hence perl) when trying to read the files!

# ls -la /tmp/apache.*
-rw-r--r--   2 httpd    httpd      12295 Apr  5 20:12 /tmp/apache.dir
-rw-r--r--   2 httpd    httpd      12295 Apr  5 20:12 /tmp/apache.pag

This indicates to me that mod_auth_dbm is severely broken, at least on
Solaris, for current versions of Apache.  (Have you done any regression
testing lately?)

I'm not sure if Berkeley DB or GDBM are any better at handling this, but
it seems like quite a severe problem to me.

Dave
--
David D. Kilzer              \     Dr. Beverly Crusher, Stardate 44181.2:
Software Engineer II         /   ``If there's nothing wrong with me, maybe
Raytheon Systems Company     \   there's something wrong with the universe.''
ddkilzer@raytheon.com        /       _Star Trek: The Next Generation_


--- mod_auth_dbm.c.cln  Thu Aug  6 12:30:55 1998
+++ mod_auth_dbm.c      Mon Apr  5 20:02:34 1999
@@ -150,10 +150,22 @@
     q.dsize = strlen(q.dptr);
 #else
     q.dsize = strlen(q.dptr) + 1;
 #endif
 
+/* Try creating our own dbm file!! */
+if (!(f = dbm_open("/tmp/apache", O_RDWR|O_CREAT, 0664))) {
+       ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
+                   "could not open dbm auth file: %s", "/tmp/apache");
+}
+else
+{
+  datum key = { "mykey", 6 };
+  datum val = { "myval", 6 };
+  (void) dbm_store(f, key, val, DBM_INSERT);
+  dbm_close(f);
+}
 
     if (!(f = dbm_open(auth_dbmpwfile, O_RDONLY, 0664))) {
        ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
                    "could not open dbm auth file: %s", auth_dbmpwfile);
        return NULL;