Author |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Sun 11 Mar '07 19:08 Post subject: Using mod_dbd for authentication |
|
|
Has anyone tried using mod_dbd for authentication with Apache 2.2.4 on Windows? Any interest?
I've been experimenting with a DBD ODBC driver.
If you are also inclined to experiment with it, you can download it from http://www.tomdonovan.net/download/dbd_ODBC_httpd224.zip.
To use dbd with ODBC, three Apache files are provided:1. bin\libaprutil-1.dll is replaced with a version which enables dbd drivers to be loaded as DSOs
The default Apache build disables loading dbd drivers from a .dll. This libaprutil-1.dll enables loading them.
2. bin\apr_dbd_odbc.dll is provided to connect with ODBC data sources.
This is new code, and the source code is in the .zip
3. modules\mod_dbd.so is replaced. This one includes many of the recent changes to mod_dbd since Apache 2.2.4 shipped.
Updated source code for mod_dbd is also in the .zip
This should only be used with Apache 2.2.4 built with Visual Studio 2005 SP1, like the one provided here at Apache Lounge.
Bear in mind that this is not well-tested, so please don't just drop it onto your production Apache site and expect it to work.
The setup for DBD can be a bit complex, so if you haven't used it before plan on spending some time reading the Apache documentation for mod_dbd and mod_authn_dbd.
There are some notes and an example of setting it all up with MS-Access in the .zip file to help.
I've tested mostly with a MS-SQLServer database, on both Windows 2000 and XP.
I would be happy to know if anyone has the time & inclination to give this a try.
If you are a coder, a review of the code in apr_dbd_odbc.c would be welcome too.
Thanks,
-tom- |
|
Back to top |
|
demiched
Joined: 16 Aug 2007 Posts: 4
|
Posted: Thu 16 Aug '07 20:32 Post subject: |
|
|
Is there a reason why it needs to be used in an apache built off of VStudio 2005? Other than - that is what you compiled it with? If so, could I get your source and try and compile using VStudio 2003? This does work great by the way against a sqlite3 driver too. |
|
Back to top |
|
demiched
Joined: 16 Aug 2007 Posts: 4
|
Posted: Thu 16 Aug '07 20:34 Post subject: |
|
|
Actually, I got your source, but could you include your make files? I think that is where I'm getting hung up on. How can I create the apr_dbd_odbc dll? Any help would be greatly appreciated. |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Thu 16 Aug '07 22:38 Post subject: |
|
|
The binaries I built back in March are for Apache built with VStudio 2005.
You can get source & makefiles (Windows & Unix) at: http://odbc-dbd.googlecode.com
I've built it with VC6 and with gcc on Unix. I haven't tried VStudio 2003, but I don't think there will be any surprises.
-tom-
Last edited by tdonovan on Fri 21 Sep '07 3:30; edited 1 time in total |
|
Back to top |
|
demiched
Joined: 16 Aug 2007 Posts: 4
|
Posted: Fri 17 Aug '07 3:27 Post subject: |
|
|
That helped a lot, and I followed the instructions that were included in the readme file, but I'm getting an error when trying to load the DBDriver:
DBD: No driver for odbc
Here is what I have in my httpd-vhosts.conf file:
DBDriver odbc
DBDParams "DATASOURCE=mydb,ACCESS=READ_ONLY"
DBDMin 1
DBDKeep 1
DBDMax 1
DBDExpTime 30
I rebuilt libaprutil-1.dll and apr_dbd_odbc.dll and put them in the bin directory. I'm obviously missing something. Is there some sort of preprocessor directive I should set before building either dlls? |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Fri 17 Aug '07 3:58 Post subject: |
|
|
That error indicates a libaprutil-1.dll which cannot load DBD drivers (i.e. does not have APR_DSO_BUILD defined).
FYI - any error which occurs when DBD drivers are enabled would say DBD: Can't load driver file apr_dbd_odbc.so - even though the driver is actually named .dll on Windows.
Check that:you put #define APR_DSO_BUILD 1 in apr-util\include\apu.hw
apr-util\include\apu.hw got copied to apr-util\include\apu.h by the Apache build
apr-util\dbd\apr_dbd.c was re-compiled by the Apache build
a new libaprutil-1.dll was created by the Apache build.
-tom- |
|
Back to top |
|
demiched
Joined: 16 Aug 2007 Posts: 4
|
Posted: Fri 17 Aug '07 14:47 Post subject: |
|
|
Ahhhh, my bad. I had changed the apu.hw file in the apr projoect, not the aprutil. I fixed this and everything seems to work wonderfully. Thanks! |
|
Back to top |
|
tdonovan Moderator
Joined: 17 Dec 2005 Posts: 611 Location: Milford, MA, USA
|
Posted: Mon 26 Nov '07 21:10 Post subject: |
|
|
I put a new build of the DBD ODBC driver for Apache 2.2.6 on Windows at:This .zip file includes four Windows binary files:* An updated ODBC DBD driver - bin\apr_dbd_odbc.dll
* A replacement bin\libaprutil-1.dll which has DBD enabled (it is disabled by default in Apache)
* A new module for logging to a database - modules\mod_log_dbd.so
* A new module to select Virtual Host Document Roots from a database - modules\mod_vhost_dbd.so The files in this .zip will only work with Apache 2.2.6 from Apache Lounge!.
Please do not try to use them with Apache 2.2.6 from http://httpd.apache.org, or with any other version of Apache.
The DBD_README.txt file has some examples of how to use the two new modules.
A module for database authentication is already included with Apache - mod_authn_dbd.so.
If you are interested in the detailed instructions, the source code, or if you want to build them for a Unix system or for a different Apache binary, the source and build instructions are at:I would be pleased to hear if anyone tries this ODBC driver or these two new modules with Apache 2.2.6.
If you are a programmer, please feel free to review and comment on the source code.
-tom- |
|
Back to top |
|