Mercurial > pidgin
diff plugins/ssl/ssl-nss.c @ 7862:01e6e9c46a01
[gaim-migrate @ 8516]
" Patch 1: sslconn.patch
Fixes a buglet where ssl_init() would not actually
init the
loaded SSL plugin until the second time it was called." --Bill Tompkins (obobo)
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Sun, 14 Dec 2003 16:35:35 +0000 |
parents | f9ed27be344e |
children | 495d3dbb4e84 |
line wrap: on
line diff
--- a/plugins/ssl/ssl-nss.c Sun Dec 14 16:23:53 2003 +0000 +++ b/plugins/ssl/ssl-nss.c Sun Dec 14 16:35:35 2003 +0000 @@ -51,6 +51,26 @@ static const PRIOMethods *_nss_methods = NULL; static PRDescIdentity _identity; +static void +ssl_nss_init_nss(void) +{ + PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1); + NSS_NoDB_Init(NULL); + + /* TODO: Fix this so autoconf does the work trying to find this lib. */ + SECMOD_AddNewModule("Builtins", +#ifndef _WIN32 + LIBDIR "/libnssckbi.so", +#else + "nssckbi.dll", +#endif + 0, 0); + NSS_SetDomesticPolicy(); + + _identity = PR_GetUniqueIdentity("Gaim"); + _nss_methods = PR_GetDefaultIOMethods(); +} + static SECStatus ssl_auth_cert(void *arg, PRFileDesc *socket, PRBool checksig, PRBool is_server) @@ -122,23 +142,7 @@ static gboolean ssl_nss_init(void) { - PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1); - NSS_NoDB_Init(NULL); - - /* TODO: Fix this so autoconf does the work trying to find this lib. */ - SECMOD_AddNewModule("Builtins", -#ifndef _WIN32 - LIBDIR "/libnssckbi.so", -#else - "nssckbi.dll", -#endif - 0, 0); - NSS_SetDomesticPolicy(); - - _identity = PR_GetUniqueIdentity("Gaim"); - _nss_methods = PR_GetDefaultIOMethods(); - - return TRUE; + return TRUE; } static void @@ -265,8 +269,12 @@ plugin_load(GaimPlugin *plugin) { #ifdef HAVE_NSS - gaim_ssl_set_ops(&ssl_ops); + if (!gaim_ssl_get_ops()) { + gaim_ssl_set_ops(&ssl_ops); + } + /* Init NSS now, so others can use it even if sslconn never does */ + ssl_nss_init_nss(); return TRUE; #else return FALSE; @@ -277,7 +285,9 @@ plugin_unload(GaimPlugin *plugin) { #ifdef HAVE_NSS - gaim_ssl_set_ops(NULL); + if (gaim_ssl_get_ops() == &ssl_ops) { + gaim_ssl_set_ops(NULL); + } #endif return TRUE;