mod_auth_mysql Patch
One thing that has always bugged me about mod_auth_mysql for Apache is that it requires you to create a table with a single username/groupname combo for each user’s group memberships like so.
| username | groupname |
| janedoe | users |
| janedoe | administrators |
| johndoe | users |
ProFTPD has a really nice feature that will accept either one row per user/membership or a comma seperated list of users for each group like so.
| groupname | username |
| users | janedoe,johndoe |
| administrators | janedoe |
Well I finally got off my butt (figuratively of course) and patched mod_auth_mysql to mimic this behavior. Go get my patch and apply it to the source. The patch is against 3.0.0 and I have no intention of testing it on any older version. I will continue to maintain this patch until its incorporated into the main tree as this is pretty much a critical feature for me.
To build and install this on my Gentoo server I used the following commands, YMMV:
apxs2 -c -I/usr/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c
apxs2 -i mod_auth_mysql.la
The way mod_auth_mysql works is correct.
Your database design is defective. Google for “database normalization”. You will find that your design fails 1st normal form, which requires that the values in each column of a table are atomic.
mod_auth_mysql works fine with properly normalized databases.
jerry said this on October 11th, 2007 at 8:25 am
Jerry: your absolutely right, my database is not normalized which is actually desirable in this particular circumstance. A normalized database makes it harder to maintain by hand and for my needs simplicity is paramount. When I need to scale it out I’ll probably abandon the patch and go for a fully normalized database structure.
cruteme said this on October 11th, 2007 at 3:48 pm