[mod_python] mod_dav_svn clobbering mod_python?

Graham Dumpleton grahamd at dscpl.com.au
Mon Sep 4 18:12:54 EDT 2006


Chad Whitacre wrote ..
> Nicolas,
> 
> Thanks for the reply.
> 
> > Do you want to have both DAV and mod_python support on the same directory
> ?
> 
> Yes, I was hoping to write some custom auth in python. I suppose I 
> should look at the sources/doc for mod_dav_svn to see what it's doing.

In which phase are you trying to implement the authorisation? What does
your Apache configuration look like? What does your custom auth handler
look like?

The mod_authz_svn module registers two handler hooks. These are:

  static void register_hooks(apr_pool_t *p)
  {
    ap_hook_access_checker(access_checker, NULL, NULL, APR_HOOK_LAST);
    ap_hook_auth_checker(auth_checker, NULL, NULL, APR_HOOK_FIRST);
  }

These correspond to the PythonAccessHandler and PythonAuthzHandler
phases.

The problem you will have if you try and define your authorisation as
a PythonAuthzHandler is that the one in Subversion runs as APR_HOOK_FIRST
where as mod_python one runs as APR_HOOK_MIDDLE. As a result the
Subversion one takes precedence, so if it returns anything besides DECLINED
yours will never run. Thus, you probably can't use that phase.

Subversion doesn't use equivalent of PythonAuthHandler phase and so
stuff can be done there, but you still have to be able to trigger your handler
with an appropriate Apache configuration. It also isn't strictly possible to
right correct authentication handlers in mod_python prior to 3.3, but I
think it can be made to work well enough to satisfy Subversion.

Now depending on what you want to do,  you may want to have your handler
run in PythonFixupHandler phase. I posted on the mailing list recently an
example of this whereby commits against tagged versions of code were
prohibited.

Anyway, more information is required from you to be able to comment
further.

Graham


More information about the Mod_python mailing list