You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Brian Schau <bs...@fleggaard.dk> on 1999/03/05 16:37:52 UTC

[PATCH+TOOL] GDBM authorization.

Hello,


I'm new to the list.   I haven't check if this has been discussed before
- I couldn't find any references ...

Problem:

	mod_auth_dbm + gdbm version 1.7.3 doesn't work on a
	Suse Linux system (kernel 2.2.2).

Solution:

	gunzip /path/to/mod_auth_dbm.diff.gz
	cd apache-1.3.4/src/modules/standard
	patch -p1 < /path/to/mod_auth_dbm.diff

How to use:

	Add
		-DUSE_GDBM	to	EXTRA_CFLAGS
		-lgdbm		to	EXTRA_LIBS

	in Src/Configuration

	Recompile httpd.

	Use AuthGDBMUserFile/AuthGDBMGroupFile/AuthGDBMAuthorativ in
	place of AuthDBM... in .htaccess'es.

	Use 'gdbmmanage' to manage passwords:

		tar xzvf gdbmmanage-1_0_tar.gz
		cd gdbmmanage-1.0
		make

		man -l ./gdbmmanage.1

Famous last words:

	Patch and tool has been tested on the following setups:

	1. apache-1.3.4, Linux-2.0.33, libgdbm-1.7.3
	2. apache-1.3.4, Linux-2.2.2, libgdbm-1.7.3

	... and found to work stable.


I look forward to any comments you all might have ...


Kind regards,

Brian

Re: [PATCH+TOOL] GDBM authorization.

Posted by Brian Schau <bs...@fleggaard.dk>.
> your distribution rather than a bug in apache.  It certainly has no
> problem in redhat 4 or 5, and I'm pretty sure the debians work fine (I
> only use redhat myself).

I use Suse 5.x/6.x (European version).

> gdbm doesn't really emulate dbm or ndbm at a binary level -- it just
> implements their source interface.  It's really just a linking issue.

Would it make sense to split up mod_auth_dbm and do a mod_auth_gdbm?
(for those of us who only has gdbm?)

> I'm interested in fixing things the right way -- and changing the C code
> doesn't seem right to me given that -lndbm should solve the problem.

Ok. The above wouldn't make any sense ... ;o)

-- 
Automobile, n.:

    A four-wheeled vehicle that runs
up hills and down pedestrains.

Re: [PATCH+TOOL] GDBM authorization.

Posted by Dean Gaudet <dg...@arctic.org>.

On Tue, 9 Mar 1999, Brian Schau wrote:

> 3. When linking with libgdbm you get the 'gdbm' functionality not 'dbm'
> or 'ndbm'.

If we're generating the wrong link line that's something I'm interested
in... it should find libndbm if it exists and use it in preference to
libgdbm.  If libndbm hasn't been installed then I consider that a bug in
your distribution rather than a bug in apache.  It certainly has no
problem in redhat 4 or 5, and I'm pretty sure the debians work fine (I
only use redhat myself).

> Yes, but AFAICT it is gdbm is incompatible to dbm or ndbm?!?!?

gdbm doesn't really emulate dbm or ndbm at a binary level -- it just
implements their source interface.  It's really just a linking issue. 

> Anyway, I don't want to argue anymore.   Leave the patch out.   I will
> upload it on my homepage instead ...  ;o)

I'm interested in fixing things the right way -- and changing the C code
doesn't seem right to me given that -lndbm should solve the problem.

Dean


Re: [PATCH+TOOL] GDBM authorization.

Posted by Brian Schau <bs...@fleggaard.dk>.
> Dunno, I just downloaded the most recent, gdbm-1.7.3, and I see this:
> 
> % grep '\<dbm_open\>' *.c
> dbmopen.c:dbm_open (file, flags, mode)
> testndbm.c:  dbm_file = dbm_open (file_name, O_RDWR|O_CREAT, 00664);
> testndbm.c:      printf ("dbm_open failed.\n");

So do I.  But try running the test suite ...   The following tries to
illustrate the following:

1) Create a database in 'dbm' format.
2) Store a key 'aaa' (content 'bbb') in this new database.
3) Read the key using 'ndbm'.
4) Read the key using 'gdbm'.

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Script started on Tue Mar  9 22:43:24 1999
cryo:/usr/src/packages/SOURCES/gdbm-1.7.3 # ./testdbm db

Welcome to the dbm test program.  Type ? for help.

com -> ?
c - count elements
d - delete
f - fetch
q - quit
s - store
1 - firstkey
2 - nextkey on last return value

com -> s
key -> aaa
data -> bbb			# the database is now initialized, key aaa=bbb

com -> q
cryo:/usr/src/packages/SOURCES/gdbm-1.7.3 # ./testndbm db

Welcome to the gndbm test program.  Type ? for help.

com -> ?
c - count elements
d - delete
f - fetch
q - quit
s - store
1 - firstkey
2 - nextkey on last return value

com -> f
key -> aaa
data is ->bbb			# this is expected.

com -> q
cryo:/usr/src/packages/SOURCES/gdbm-1.7.3 # ./testgdbm db

Welcome to the gdbm test program.  Type ? for help.

com -> ?
c - count (number of entries)
d - delete
f - fetch
n - nextkey
q - quit
s - store
1 - firstkey
2 - nextkey on last key (from n, 1 or 2)

r - reorganize
A - print avail list
B - get and print current bucket n
C - print current bucket
D - print hash directory
F - print file header
H - hash value of key
K - print the bucket cache
V - print version of gdbm
com -> f
key -> aaa
No such item found.		# ....!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

com -> q
cryo:/usr/src/packages/SOURCES/gdbm-1.7.3 # ll db*
-rw-r--r--   2 root     root        12296 mar  9 22:43 db.dir
-rw-r--r--   2 root     root        12296 mar  9 22:43 db.pag
cryo:/usr/src/packages/SOURCES/gdbm-1.7.3 # exit
exit

Script done on Tue Mar  9 22:44:23 1999
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

1. The gdbm library expects a file called 'db' (without the .dir and
.pag extensions).
2. ... which renders 'dbmmanage' from the standard apache-dist pretty
useless as it only creates 'dbm' and/or 'ndbm' compatible files.
3. When linking with libgdbm you get the 'gdbm' functionality not 'dbm'
or 'ndbm'.

> 
> It still supports dbm.

Yes, but AFAICT it is gdbm is incompatible to dbm or ndbm?!?!?

Anyway, I don't want to argue anymore.   Leave the patch out.   I will
upload it on my homepage instead ...  ;o)


Thanks for your time.


Kind regards,


Brian


-- 
Automobile, n.:

    A four-wheeled vehicle that runs
up hills and down pedestrains.

Re: [PATCH+TOOL] GDBM authorization.

Posted by Dean Gaudet <dg...@arctic.org>.

On Sat, 6 Mar 1999, Brian Schau wrote:

> Hi (me! again!),
>  
> > Notes:
> > 
> > - it's not a permission problem
> > - it's not a missing file/user
> > 
> A follow up.   I just checked the source of libgdbm.  Therein I found
> the source for a program named 'conv2gdbm'.   First line of this source
> reads:
> 
> /* conv2gdbm.c - This is a program to convert dbm files to gdbm files.
> */
> 
> Which makes me believe that something has changed in the gdbm-package
> wrt. dbm ..

Dunno, I just downloaded the most recent, gdbm-1.7.3, and I see this:

% grep '\<dbm_open\>' *.c
dbmopen.c:dbm_open (file, flags, mode)
testndbm.c:  dbm_file = dbm_open (file_name, O_RDWR|O_CREAT, 00664);
testndbm.c:      printf ("dbm_open failed.\n");

It still supports dbm. 

Dean


Re: [PATCH+TOOL] GDBM authorization.

Posted by Brian Schau <bs...@fleggaard.dk>.
Hi (me! again!),
 
> Notes:
> 
> - it's not a permission problem
> - it's not a missing file/user
> 
A follow up.   I just checked the source of libgdbm.  Therein I found
the source for a program named 'conv2gdbm'.   First line of this source
reads:

/* conv2gdbm.c - This is a program to convert dbm files to gdbm files.
*/

Which makes me believe that something has changed in the gdbm-package
wrt. dbm ..

???


Kind regards,


Brian

-- 
Automobile, n.:

    A four-wheeled vehicle that runs
up hills and down pedestrains.

Re: [PATCH+TOOL] GDBM authorization.

Posted by Dean Gaudet <dg...@arctic.org>.

On Fri, 5 Mar 1999, Brian Schau wrote:

> You're right, I _shouldn't_.   But if I don't change the code, I can't
> open the auth-database:
...
> Long time ago I asked on linux-admin for help, but nobody were able to
> help me ... apparently, they all used libdbm (which, for some reason,
> isn't installed on all my servers .. ;o)

Then your linux distribution is broken.

We're not going to accept that patch.  gdbm, *as distributed by GNU* has
dbm compatibility in it.

Dean


Re: [PATCH+TOOL] GDBM authorization.

Posted by Brian Schau <bs...@fleggaard.dk>.
Hi Dean,

> library you're supposed to link to get this behaviour... you shouldn't
> need to change any code.

You're right, I _shouldn't_.   But if I don't change the code, I can't
open the auth-database:

httpd: [Fri Mar  5 11:52:27 1999] [error] [client 192.168.33.36] (2)No
such file
 or directory: could not open dbm auth file:
/home/bsc/mlm/guldklub/webpwds
httpd: [Fri Mar  5 11:52:27 1999] [error] [client 192.168.33.36] DBM
user bsc no
t found: /home/bsc/mlm/guldklub

Long time ago I asked on linux-admin for help, but nobody were able to
help me ... apparently, they all used libdbm (which, for some reason,
isn't installed on all my servers .. ;o)

Notes:

- it's not a permission problem
- it's not a missing file/user


So ... that's the reason behind the patch.   ;o)


Kind regards,


Brian


-- 
Automobile, n.:

    A four-wheeled vehicle that runs
up hills and down pedestrains.

Re: [PATCH+TOOL] GDBM authorization.

Posted by Dean Gaudet <dg...@arctic.org>.

On Fri, 5 Mar 1999, Brian Schau wrote:

> 	mod_auth_dbm + gdbm version 1.7.3 doesn't work on a
> 	Suse Linux system (kernel 2.2.2).

gdbm is supposed to prove the dbm_foo function calls.  Look in your
/usr/lib diretory for *dbm* and find out if there's some other special
library you're supposed to link to get this behaviour... you shouldn't
need to change any code.

Dean