Full_Name: Edwin Mons
Version: 2.4
OS: Windows 10
URL: http://edwinm.ik.nu/0001-Initialise-global-options-mutex.patch
Submission from: (NULL) (2001:984:e0bf:1:d9ae:17ab:b829:de4f)


The global options have a mutex, ldo_mutex, that is left NUL-initialised.  This
is no problem on must platforms where a mutex is a structure, and all NUL values
is a valid mutex, but on Windows, the mutex is a handle.  This handle is invalid
if it's 0, which causes WaitForSingleObject to return an error.

ldap_set_option tries to obtain a lock on the global options.  On anything but
Windows, this protects data corruption in multi-threaded use, but on Windows, it
didn't: there wasn't a mutex to lock, and the result of LDAP_MUTEX_LOCK is never
checked.

I fixed my local build of OpenLDAP using the attached patch, which satisfied
both Application Verifier, and stopped our product from crashing in certain
tests that call ldap_set_options from multiple worker threads (in our case, the
OpenSSL context was sometimes corrupted.)


Reply via email to