Subject: | Problem with verify callback in multithreading context on Windows |
When using a callback subroutine specified when calling method
'CTX_set_verify', the XS part of the module stores the association
between the SSL context and the callback function in a HV Perl structure
static variable called 'ssleay_ctx_verify_callbacks'. This variable is
instantiated when the first callback is set. On Windows the "fork" being
emulated using threads, it seems that the context of this Perl structure
is not properly handled when used in another thread than the one in
which it has been created.
So when the callback is set in a main thread and called in a "forked"
child, the callback subroutine simply does not receive parameters passed
and the caller (the XS module) does not receive the returned value
(being interpreted as a not valid certificate). On the other hand, if
the callback is set in the "forked" child instead of the parent thread,
the first one will work but trying to set the callback in another child
will make an "Acces violation" an crash Perl.
I'm using Perl ActiveState on a Windows 2003.