[mod_python] bug in PythonAuthenHandler?

Cameron La Rue cameron at infostreet.com
Tue Oct 24 14:49:23 EST 2000


Hi all,
        I'm having trouble with an authentication script using
PythonAuthenHandler. First of all, we're running RedHat Linux 6.2,
Apache 1.3.9, mod_python 2.5, and python 1.5.2.

In my httpd.conf, I have the following:
#-------------------------------------------
AddHandler python-program .py
PythonHandler base2
<Location /test_enduser>
   AuthType auth
   AuthName PythonHosting
   AddHandler python-program .py
   PythonAuthenHandler base2::authenticate
   require valid-user
</Location>
#-------------------------------------------


I've got a script, base2.py, that looks like this:
#-------------------------------------------
def authenticate(req):
    e, si, so = apache.setup_cgi(req)
    apache.restore_nocgi(e, si, so)
    apache.log_error('here we are')
    return apache.OK

def handler(req):
    apache.log_error('handler works')
    e, si, so = apache.setup_cgi(req)
    apache.restore_nocgi(e, si, so)
    return apache.OK
#-------------------------------------------

Finally, I have an html page (test.html) that looks like this:
#-------------------------------------------
<html>
<body>
<a href='/test_enduser/enduser.html'>go man</a>
</body>
</html>
#-------------------------------------------

I am running apache in single process mode, like so:
/infostreet/apache/bin/httpd -X -f
~/projects/_current_/apache/httpd.conf

If I click the "go man" link in test.html, the base2::authenticate
method is called, and I am allowed to access /test_enduser/enduser.html.
Then, I click the back button on my browser. I click the "go man" link a
second time, base2:authenticate is called again, and apache segfaults.
It does print 'here we are' in the error log, so it gets that far.

I also noticed something else. If, after starting apache, I first access
a python script using PythonHandler, I can then access the
PythonAuthenHandler as many times as I want without apache segfaulting.
Is this a bug in the PythonAuthenHandler? Thanks in advance...

Cameron



More information about the Mod_python mailing list