Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 80469 - Problem in PythonAuthenHandler
Summary: Problem in PythonAuthenHandler
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: mod_python
Version: 8.0
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Gary Benson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2002-12-26 23:56 UTC by Jim Thario
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2003-01-07 15:54:38 UTC

Attachments (Terms of Use)

Description Jim Thario 2002-12-26 23:56:41 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003

Description of problem:
When using PythonAuthenHandler from mod_python to do programmatic
authentication, Apache expects an AuthUserFile to read users/passwords from,
which it shouldn't.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.Create a /var/www/html/python directory
2.Add included snippet to httpd.conf
3.Put included in /var/www/html/python directory.
4.Restart apache.
5.Point browser at localhost:/python/ and enter "spam" as user and
"eggs" as password.

Actual Results:  After getting prompted for the user and password, I get a
"Server error!" page and an entry in the /var/log/httpd/error_log:

"configuration error:  couldn't check user.  No user file?: /python"

Expected Results:  After entering user and password, should be
called to pass or fail the authentication.

Additional info:

The following information is taken from the mod_python user manual, section 3.4.
Use this configuration in httpd.conf:

<Directory /var/www/html/python>
        AddHandler python-program .py
        PythonHandler myscript
        PythonAuthenHandler myscript
        PythonDebug On
        AuthType Basic
        AuthName "Restricted Area"
        require valid-user

Use the following as

from mod_python import apache

def authenhandler(req):

    user = req.user
    pw = req.get_basic_auth_pw()

    if user == "spam" and pw == "eggs":
        return apache.OK
        return apache.HTTP_UNAUTHORIZED

def handler(req):
    return apache.OK

Comment 1 Gary Benson 2003-01-07 15:54:38 UTC
This fails on 8.0 but works correctly on Rawhide.

Note You need to log in before you can comment on or make changes to this bug.