Ticket #2901 (new defect)
Apache crashes when used with modpython and LDAP authentication
| Reported by: | eblot | Owned by: | eblot |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11-retriage |
| Component: | web frontend/mod_python | Version: | devel |
| Severity: | major | Keywords: | ldap |
| Cc: | francois.pesce@… |
Description
Since the introduction of the WSGI support in [2957], Apache server crashes when the following environment is used:
- modpython (3.1.x, 3.2.x series)
- python (2.3.x, 2.4.x)
- LDAP authentication support (mod_auth_ldap, unrelated to the LdapPlugin)
The crash of the Apache thread occurs when the user authenticates, i.e. when she submits her password at the .../login URL.
The root cause is the LDAP authentication module:
It defines an extra environment variable AUTHENTICATE_UID, which may takes an invalid (null ?) value.
This value is retrieved in modpython/apache.py:build_cgi_env(req) and added to the CGI environment variable.
This dictionnary is then duplicated in trac/web/modpython_frontend.py:ModPythonGateway::__init__ using environ.duplicate() call.
When the duplicate() method attempts to duplicate the value of the AUTHENTICATE_UID key, it produces an invalid call which ends up in calling the libc strlen() function with an invalid parameter, and eventually crashes the current Apache thread.
I attach a patch against [3025] which discards this invalid key, but I guess the real fix up should be done in the modpython Apache module.


