Bug #1093
segmentation fault when using ldap-authentication on 64bit machines
| Status: | Fixed | Start: | ||
| Priority: | Normal | Due date: | ||
| Assigned to: | - | % Done: | 0% |
|
| Category: | mod_auth | |||
| Target version: | - | |||
| Pending: | No |
Resolution: | fixed |
|
Description
What you see:
lighttpd segfaults when trying to authenticate someone against ldap.
This is on a x86_64 architecture and using a gcc with PIE & SSP. Although all 64bit architectures may be affected.
For whatever reason, gcc generates this warning here:
mod_auth.c: In function `auth_ldap_init':
mod_auth.c:581: warning: implicit declaration of function `ldap_init'
mod_auth.c:581: warning: assignment makes pointer from integer without a cast
...
http_auth.c: In function `http_auth_basic_password_compare':
http_auth.c:746: warning: implicit declaration of function `ldap_search_s'
http_auth.c:778: warning: implicit declaration of function `ldap_init'
http_auth.c:778: warning: assignment makes pointer from integer without a cast
...
(and some more from the same kind but they don't matter here)
Gcc now assumes that ldap_init returns an int, but it returns a pointer to an LDAP structure instead.
The next function using this pointer segfaults and explains the corrupted stack I saw in the backtrace.
It seems that all versions are affected. Attached is a patch which applies to 1.4.13 and explicitly declares the function in http_auth.h.
The ldap-stuff in mod_auth should definetely be rewritten since it uses many deprecated functions and lacks some functionality (use multiple ldap-servers for example).
-- dev-zero
History
03/26/2007 01:00 PM - darix
the patch is the wrong solution
either compile wiht -DLDAP_DEPRECATED or use a patch that really adapts to the new openldap api.