[Help-gnutls] multiple "gnutlses" in single binary
Arkadiusz Miskiewicz
arekm at maven.pl
Sun Jun 15 15:13:00 CEST 2008
Hello,
Take a look at this example.
There is one program (let be it php interpreter) that is able to load external
modules (so modules).
Now we have two external modules - curl and postgresql [1]. Assume both curl
and postgresql use external libraries (libcurl and libpq) that internally
also use gnutls.
Both these libraries initialize and deinitialize gnutls on it's own.
Separately they work fine.
Now it php loads them both at the same time then gnutls initialization happens
twice (once called by curl module and second time by postgres module) and the
same happens for deinitialization. In openssl for example double deinit
causes segfault and is now allowed (a real problem with php + modules btw).
How things look in gnutls? I assume init/deinit also can't be called multiple
times safely, right?
What can be done in such example to correctly handle gnutls requirements for
init/deinit? There is only one important thing - the only place where you can
do anything is php itself, curl and postgresql module but not in libcurl and
libpq libraries.
My guess is probably that nothing can be done without altering libcurl and
libpq but even with modifications - does gnutls have api that would handle
such situation in generic way? Some callbacks maybe...
1. In reality only curl is prepared to be used with gnutls but for sake of
this example assume that postgresql module also uses gnutls.
--
Arkadiusz Miśkiewicz PLD/Linux Team
arekm / maven.pl http://ftp.pld-linux.org/
More information about the Gnutls-help
mailing list