Closed minfrin closed 3 years ago
Could you submit a patch? I don't have time to work on this. Thanks.
I should recommend not using g_mime_shutdown()
This can't be fixed.
Both NSS and OpenSSL suffered from this issue and subsequently fixed their libraries.
In the case of NSS they supported separate concurrent sessions, in the case of OpenSSL their shutdown became a noop.
I am up to my eyeballs in fixing open source software right now, it would be significantly more efficient for a gmime expert to fix this than have me rip apart the code from scratch.
in the case of OpenSSL their shutdown became a noop.
That's how it would have to be done in gmime. Which begs the question: why bother? Why not just simply not call g_mime_shutdown() which is exactly what I suggested.
Let g_mime_shutdown() be useful to people not wanting to do these kinds of hacks.
When wiring gmime into an Apache httpd module, the module is configured twice, once as a test to return error messages, and a second time for the real setup after forking.
If the standard setup pattern is used, this results in the following calls:
The above sequence triggers a segfault at the g_mime_stream_cat_new() step.
Adding a hack to ignore initialisation in the first pass works round this problem, but it does mean that if two different modules try use gmime, the second module will fail and cause httpd to crash.
The fix is to make g_mime_shutdown() leave the system in a state where a subsequent g_mime_init() will work.