[PATCH] Fix problem with sasl_set_mutex

Eric Leblond eric at inl.fr
Sat Sep 20 08:41:41 EDT 2008


Hi,

When working on NuFW (http://www.nufw.org), I've encounter some weird crash
when calling sasl_dispose. The problem was in fact a logic problem in
sasl_set_mutex.

NuFW uses sasl and libldap_r. NuFW has to do a call to sasl_set_mutex
because it is multithreaded. One of the NuFW module uses libldap_r which
also does a call to sasl_set_mutex. By doing this, we run into a problem
because sasl_MUTEX_* function change during run time. Thus we can
allocate a mutex with NuFW function and destroy it with libldap_r
function. This lead to a crash in almost all cases.

IMHO, the only clean workaround is to modify sasl_set_mutex(): it should
not be run twice in the same program. I attach a simple patch to this
mail which implement this behaviour.

BR,
-- 
Eric Leblond
INL: http://www.inl.fr/
NuFW: http://www.nufw.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sasl_set_mutex_fix.diff
Type: text/x-diff
Size: 549 bytes
Desc: not available
Url : http://lists.andrew.cmu.edu/pipermail/cyrus-sasl/attachments/20080920/32c661a0/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.andrew.cmu.edu/pipermail/cyrus-sasl/attachments/20080920/32c661a0/attachment-0001.bin 


More information about the Cyrus-sasl mailing list