Bug #1093
closedsegmentation fault when using ldap-authentication on 64bit machines
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
Files
Updated by darix over 17 years ago
the patch is the wrong solution
either compile wiht -DLDAP_DEPRECATED or use a patch that really adapts to the new openldap api.
Updated by Anonymous over 17 years ago
Jup, Cardoe told me the same :)
-- dev-zero
Updated by Anonymous over 17 years ago
Updated by stbuehler about 16 years ago
- Status changed from New to Fixed
- Resolution set to fixed
I don't think that patch really uses the new api? segfault got fixed.
Also available in: Atom