Thanks a lot, Luca!

On Thu, May 12, 2016 at 1:04 AM, Luca Toscano <toscano.luca@gmail.com> wrote:


2016-05-12 7:09 GMT+02:00 Tianyin Xu <tixu@cs.ucsd.edu>:
Sorry Luca, I misspelled your name in my last email. :-(

No problem at all :)
 

On Wed, May 11, 2016 at 9:55 PM, Tianyin Xu <tixu@cs.ucsd.edu> wrote:
Thanks, Loca!

Yes, I did set AuthDBMUserFile (the whole point for this module is to use a DBM file to do the authn control, isn't it?)

Thanks for the new info!
 

I generate the file called dbm-auth-file using dbmmanger 
$ file dbm-auth-file
dbm-auth-file: Berkeley DB (Hash, version 9, native byte-order)

and then I loaded the module and configured it in a <Directory> as follows,
    AuthType Basic
    AuthName Documents
    AuthBasicProvider dbm
    AuthDBMType DB
    AuthDBMUserFile "/home/tixu/httpd-2.4.20-bin/dbm-auth-file" 

and then I got the "DSO load failed" message:
[Thu May 05 18:12:29.915467 2016] [authn_dbm:error] [pid 9107:tid 140031532377856] (20019)DSO load failed: [client 127.0.0.1:54442] AH01754: could not open dbm (type DB) auth file: /home/tixu/httpd-2.4.20-bin/dbm-auth-file

I changed the AuthBasicProvider to be "default" and used "htdbm" to create the DBM files (in which can it generates a .dir and .pag file). And the module goes correctly. 

Thus, I'm sure there it the problem of the "AuthDBMType". But I'm not sure if this is a bug in the implementation of mod_authn_dbm or a problem of some native libs in my system or some incompatibility caused by the dbmmanger? 


mod_authn_dbm calls APR to open the DBM file, definitely supporting Berkeley DB but with the note "not all may be available at run time":


From what I can see, the error comes all the way from the function dbm_open_type or  in APR (apr_dbm.c).

It might be a problem of the httpd/apr version that you are using and/or related configure flags needed. Could you please give us more details? After this issue is resolved I'll update the documentation with more details!



Yes, your understanding is absolutely correct.

I traced the failure point using GDB. The execution goes through apr_dbm_open_ex() and failed inside dbm_open_type(). 

Precisely, it failed when trying to load the DSO:
176     rv = apu_dso_load(NULL, &symbol, modname, symname, pool);    /* srclib/apr-util/dbm/apr_dbm.c */

Tracing inside, the APR operation to load the dso is here,
 
Breakpoint 5, apr_dso_load (res_handle=0x7fffe57e89d8, path=0x7fffe57e8a00 "/home/tixu/httpd-2.4.20-bin/lib/apr-util-1/apr_dbm_db-1.so", pool=0x867108) at dso/unix/dso.c:126
126        int flags = RTLD_NOW | RTLD_GLOBAL;

We can see that it tries to load the DSO file, "/home/tixu/httpd-2.4.20-bin/lib/apr-util-1/apr_dbm_db-1.so" (using dl_open as I'm on Linux).

But I don't have this .so file at the referred path. Certainly, it fails.

I'm using all the latest versions of httpd, apr, and apr-util:
httpd-2.4.20
apr-1.5.2
apr-util-1.5.4

and I build the binaries using,
$ ./configure --with-included-apr --enable-load-all-modules

It seems I failed to build "apr-util-1/apr_dbm_db-1.so"? Actually I don't have the "apr-util-1" directory at all.

Let me know if there's anything I can provide.

Thanks!
 

Luca

 
 



--
Tianyin XU,
http://cseweb.ucsd.edu/~tixu/