annotate plugins/ssl/ssl-nss.c @ 11033:50224ac8184d

[gaim-migrate @ 12919] Ok, this is debug window filtering. Sadrul was going to do this with a text entry, but I like this better, feel free to disagree with me. It's not the prettiest in a couple places, most notable gtkmain.c where a bunch of categories that don't currently have a home get registered. I added some plugin_(un)load functions to some plugins to place the (un)register functions. Though I didn't do that for the prpls. Comments and cleanups welcome. (Oh, I've been seeing some crashes on quit, but I haven't been able to get it to happen reliably so I'm not sure if it's my code or some transient HEAD oscar/other crash.) committer: Tailor Script <tailor@pidgin.im>
author Etan Reisner <pidgin@unreliablesource.net>
date Tue, 28 Jun 2005 06:13:07 +0000
parents bec9130b24d2
children bb0d7b719af2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
1 /**
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
2 * @file ssl-nss.c Mozilla NSS SSL plugin.
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
3 *
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
4 * gaim
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
5 *
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
6 * Copyright (C) 2003 Christian Hammond <chipx86@gnupdate.org>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
7 *
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
11 * (at your option) any later version.
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
12 *
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
16 * GNU General Public License for more details.
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
17 *
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
21 */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
22 #include "internal.h"
7051
e885d4963a68 [gaim-migrate @ 7614]
Christian Hammond <chipx86@chipx86.com>
parents: 7050
diff changeset
23 #include "debug.h"
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24 #include "plugin.h"
7051
e885d4963a68 [gaim-migrate @ 7614]
Christian Hammond <chipx86@chipx86.com>
parents: 7050
diff changeset
25 #include "sslconn.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9582
diff changeset
26 #include "version.h"
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27
7029
b80c7a4dfae7 [gaim-migrate @ 7592]
Christian Hammond <chipx86@chipx86.com>
parents: 7028
diff changeset
28 #define SSL_NSS_PLUGIN_ID "ssl-nss"
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 #ifdef HAVE_NSS
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
9582
fec83fb0b6a9 [gaim-migrate @ 10425]
Christian Hammond <chipx86@chipx86.com>
parents: 8749
diff changeset
32 #undef HAVE_LONG_LONG /* Make Mozilla less angry. If angry, Mozilla SMASH! */
fec83fb0b6a9 [gaim-migrate @ 10425]
Christian Hammond <chipx86@chipx86.com>
parents: 8749
diff changeset
33
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 #include <nspr.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 #include <private/pprio.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 #include <nss.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37 #include <pk11func.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 #include <prio.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39 #include <secerr.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 #include <secmod.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41 #include <ssl.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 #include <sslerr.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43 #include <sslproto.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 typedef struct
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
46 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
47 PRFileDesc *fd;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48 PRFileDesc *in;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 } GaimSslNssData;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52 #define GAIM_SSL_NSS_DATA(gsc) ((GaimSslNssData *)gsc->private_data)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 static const PRIOMethods *_nss_methods = NULL;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55 static PRDescIdentity _identity;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56
7993
495d3dbb4e84 [gaim-migrate @ 8670]
Christian Hammond <chipx86@chipx86.com>
parents: 7862
diff changeset
57 static void
7862
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
58 ssl_nss_init_nss(void)
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
59 {
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10263
diff changeset
60 char *lib;
7862
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
61 PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
62 NSS_NoDB_Init(NULL);
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
63
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
64 /* TODO: Fix this so autoconf does the work trying to find this lib. */
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
65 #ifndef _WIN32
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10263
diff changeset
66 lib = g_strdup(BR_LIBDIR("/libnssckbi.so"));
7862
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
67 #else
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10263
diff changeset
68 lib = g_strdup("nssckbi.dll");
7862
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
69 #endif
10519
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10263
diff changeset
70 SECMOD_AddNewModule("Builtins", lib, 0, 0);
bec9130b24d2 [gaim-migrate @ 11833]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10263
diff changeset
71 g_free(lib);
7862
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
72 NSS_SetDomesticPolicy();
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
73
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
74 _identity = PR_GetUniqueIdentity("Gaim");
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
75 _nss_methods = PR_GetDefaultIOMethods();
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
76 }
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
77
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 static SECStatus
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79 ssl_auth_cert(void *arg, PRFileDesc *socket, PRBool checksig,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 PRBool is_server)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82 return SECSuccess;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 #if 0
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85 CERTCertificate *cert;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 void *pinArg;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 SECStatus status;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
88
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
89 cert = SSL_PeerCertificate(socket);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90 pinArg = SSL_RevealPinArg(socket);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 status = CERT_VerifyCertNow((CERTCertDBHandle *)arg, cert, checksig,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93 certUsageSSLClient, pinArg);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 if (status != SECSuccess) {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 gaim_debug_error("nss", "CERT_VerifyCertNow failed\n");
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97 CERT_DestroyCertificate(cert);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 return status;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
100
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
101 CERT_DestroyCertificate(cert);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 return SECSuccess;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 #endif
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
104 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
105
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
106 static SECStatus
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 ssl_bad_cert(void *arg, PRFileDesc *socket)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 SECStatus status = SECFailure;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 PRErrorCode err;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
111
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
112 if (arg == NULL)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113 return status;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115 *(PRErrorCode *)arg = err = PORT_GetError();
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 switch (err)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
118 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
119 case SEC_ERROR_INVALID_AVA:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 case SEC_ERROR_INVALID_TIME:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 case SEC_ERROR_BAD_SIGNATURE:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 case SEC_ERROR_EXPIRED_CERTIFICATE:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 case SEC_ERROR_UNKNOWN_ISSUER:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124 case SEC_ERROR_UNTRUSTED_CERT:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 case SEC_ERROR_CERT_VALID:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126 case SEC_ERROR_EXPIRED_ISSUER_CERTIFICATE:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 case SEC_ERROR_CRL_EXPIRED:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 case SEC_ERROR_CRL_BAD_SIGNATURE:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129 case SEC_ERROR_EXTENSION_VALUE_INVALID:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 case SEC_ERROR_CA_CERT_INVALID:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 case SEC_ERROR_CERT_USAGES_INVALID:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132 case SEC_ERROR_UNKNOWN_CRITICAL_EXTENSION:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 status = SECSuccess;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 break;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
135
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
136 default:
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 status = SECFailure;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138 break;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
140
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
141 gaim_debug_error("nss", "Bad certificate: %d\n");
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143 return status;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
145
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
146 static gboolean
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 ssl_nss_init(void)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 {
7862
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
149 return TRUE;
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 static void
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 ssl_nss_uninit(void)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 PR_Cleanup();
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
156
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
157 _nss_methods = NULL;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
158 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
159
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160 static void
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 ssl_nss_connect_cb(gpointer data, gint source, GaimInputCondition cond)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 GaimSslConnection *gsc = (GaimSslConnection *)data;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164 GaimSslNssData *nss_data = g_new0(GaimSslNssData, 1);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 PRSocketOptionData socket_opt;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 gsc->private_data = nss_data;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 gsc->fd = source;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
170
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
171 nss_data->fd = PR_ImportTCPSocket(gsc->fd);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 if (nss_data->fd == NULL)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 gaim_debug_error("nss", "nss_data->fd == NULL!\n");
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176
8362
1976914caa51 [gaim-migrate @ 9087]
Nathan Walp <nwalp@pidgin.im>
parents: 8360
diff changeset
177 if (gsc->error_cb != NULL)
1976914caa51 [gaim-migrate @ 9087]
Nathan Walp <nwalp@pidgin.im>
parents: 8360
diff changeset
178 gsc->error_cb(gsc, GAIM_SSL_CONNECT_FAILED, gsc->connect_cb_data);
1976914caa51 [gaim-migrate @ 9087]
Nathan Walp <nwalp@pidgin.im>
parents: 8360
diff changeset
179
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 gaim_ssl_close((GaimSslConnection *)gsc);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 return;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185 socket_opt.option = PR_SockOpt_Nonblocking;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 socket_opt.value.non_blocking = PR_FALSE;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 PR_SetSocketOption(nss_data->fd, &socket_opt);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 nss_data->in = SSL_ImportFD(NULL, nss_data->fd);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 if (nss_data->in == NULL)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 gaim_debug_error("nss", "nss_data->in == NUL!\n");
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195
8362
1976914caa51 [gaim-migrate @ 9087]
Nathan Walp <nwalp@pidgin.im>
parents: 8360
diff changeset
196 if (gsc->error_cb != NULL)
1976914caa51 [gaim-migrate @ 9087]
Nathan Walp <nwalp@pidgin.im>
parents: 8360
diff changeset
197 gsc->error_cb(gsc, GAIM_SSL_CONNECT_FAILED, gsc->connect_cb_data);
1976914caa51 [gaim-migrate @ 9087]
Nathan Walp <nwalp@pidgin.im>
parents: 8360
diff changeset
198
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199 gaim_ssl_close((GaimSslConnection *)gsc);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 return;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
202 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
203
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
204 SSL_OptionSet(nss_data->in, SSL_SECURITY, PR_TRUE);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 SSL_OptionSet(nss_data->in, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
206
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
207 SSL_AuthCertificateHook(nss_data->in,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208 (SSLAuthCertificate)ssl_auth_cert,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 (void *)CERT_GetDefaultCertDB());
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
210 SSL_BadCertHook(nss_data->in, (SSLBadCertHandler)ssl_bad_cert, NULL);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
211
7157
fae7cfe975fd [gaim-migrate @ 7724]
Nathan Walp <nwalp@pidgin.im>
parents: 7053
diff changeset
212 if(gsc->host)
fae7cfe975fd [gaim-migrate @ 7724]
Nathan Walp <nwalp@pidgin.im>
parents: 7053
diff changeset
213 SSL_SetURL(nss_data->in, gsc->host);
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
214
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
215 SSL_ResetHandshake(nss_data->in, PR_FALSE);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
216
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
217 if (SSL_ForceHandshake(nss_data->in))
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
218 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
219 gaim_debug_error("nss", "Handshake failed\n");
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
220
7274
448e39ace278 [gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents: 7157
diff changeset
221 if (gsc->error_cb != NULL)
8360
8d012c803411 [gaim-migrate @ 9084]
Nathan Walp <nwalp@pidgin.im>
parents: 7993
diff changeset
222 gsc->error_cb(gsc, GAIM_SSL_HANDSHAKE_FAILED, gsc->connect_cb_data);
7274
448e39ace278 [gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents: 7157
diff changeset
223
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
224 gaim_ssl_close(gsc);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
225
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
226 return;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
227 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
228
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
229 gsc->connect_cb(gsc->connect_cb_data, gsc, cond);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
230 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
231
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
232 static void
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
233 ssl_nss_close(GaimSslConnection *gsc)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
234 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
235 GaimSslNssData *nss_data = GAIM_SSL_NSS_DATA(gsc);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
236
7467
f9ed27be344e [gaim-migrate @ 8080]
Nathan Walp <nwalp@pidgin.im>
parents: 7274
diff changeset
237 if(!nss_data)
f9ed27be344e [gaim-migrate @ 8080]
Nathan Walp <nwalp@pidgin.im>
parents: 7274
diff changeset
238 return;
f9ed27be344e [gaim-migrate @ 8080]
Nathan Walp <nwalp@pidgin.im>
parents: 7274
diff changeset
239
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
240 if (nss_data->in) PR_Close(nss_data->in);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
241 /* if (nss_data->fd) PR_Close(nss_data->fd); */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
242
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
243 g_free(nss_data);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
244 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
245
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
246 static size_t
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
247 ssl_nss_read(GaimSslConnection *gsc, void *data, size_t len)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
248 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
249 GaimSslNssData *nss_data = GAIM_SSL_NSS_DATA(gsc);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
250
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
251 return PR_Read(nss_data->in, data, len);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
252 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
253
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
254 static size_t
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
255 ssl_nss_write(GaimSslConnection *gsc, const void *data, size_t len)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
256 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
257 GaimSslNssData *nss_data = GAIM_SSL_NSS_DATA(gsc);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
258
7467
f9ed27be344e [gaim-migrate @ 8080]
Nathan Walp <nwalp@pidgin.im>
parents: 7274
diff changeset
259 if(!nss_data)
f9ed27be344e [gaim-migrate @ 8080]
Nathan Walp <nwalp@pidgin.im>
parents: 7274
diff changeset
260 return 0;
f9ed27be344e [gaim-migrate @ 8080]
Nathan Walp <nwalp@pidgin.im>
parents: 7274
diff changeset
261
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
262 return PR_Write(nss_data->in, data, len);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
263 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
264
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
265 static GaimSslOps ssl_ops =
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
266 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
267 ssl_nss_init,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
268 ssl_nss_uninit,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
269 ssl_nss_connect_cb,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
270 ssl_nss_close,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
271 ssl_nss_read,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
272 ssl_nss_write
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
273 };
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
274
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
275 #endif /* HAVE_NSS */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
276
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
277
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
278 static gboolean
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
279 plugin_load(GaimPlugin *plugin)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
280 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
281 #ifdef HAVE_NSS
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10519
diff changeset
282 gaim_debug_register_category("nss");
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10519
diff changeset
283
7862
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
284 if (!gaim_ssl_get_ops()) {
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
285 gaim_ssl_set_ops(&ssl_ops);
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
286 }
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
287
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10519
diff changeset
288 /* Init NSS now, so others can use it even if sslconn never does */
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10519
diff changeset
289 ssl_nss_init_nss();
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10519
diff changeset
290
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
291 return TRUE;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
292 #else
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
293 return FALSE;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
294 #endif
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
295 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
296
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
297 static gboolean
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
298 plugin_unload(GaimPlugin *plugin)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
299 {
7053
9d8e56c66854 [gaim-migrate @ 7616]
Nathan Walp <nwalp@pidgin.im>
parents: 7051
diff changeset
300 #ifdef HAVE_NSS
7862
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
301 if (gaim_ssl_get_ops() == &ssl_ops) {
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
302 gaim_ssl_set_ops(NULL);
01e6e9c46a01 [gaim-migrate @ 8516]
Luke Schierer <lschiere@pidgin.im>
parents: 7467
diff changeset
303 }
7050
e8cd8827fb25 [gaim-migrate @ 7613]
Christian Hammond <chipx86@chipx86.com>
parents: 7029
diff changeset
304 #endif
e8cd8827fb25 [gaim-migrate @ 7613]
Christian Hammond <chipx86@chipx86.com>
parents: 7029
diff changeset
305
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10519
diff changeset
306 gaim_debug_unregister_category("nss");
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10519
diff changeset
307
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
308 return TRUE;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
309 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
310
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
311 static GaimPluginInfo info =
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
312 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9582
diff changeset
313 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9582
diff changeset
314 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9582
diff changeset
315 GAIM_MINOR_VERSION,
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
316 GAIM_PLUGIN_STANDARD, /**< type */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
317 NULL, /**< ui_requirement */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
318 GAIM_PLUGIN_FLAG_INVISIBLE, /**< flags */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
319 NULL, /**< dependencies */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
320 GAIM_PRIORITY_DEFAULT, /**< priority */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
321
7029
b80c7a4dfae7 [gaim-migrate @ 7592]
Christian Hammond <chipx86@chipx86.com>
parents: 7028
diff changeset
322 SSL_NSS_PLUGIN_ID, /**< id */
7016
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
323 N_("NSS"), /**< name */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
324 VERSION, /**< version */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
325 /** summary */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
326 N_("Provides SSL support through Mozilla NSS."),
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
327 /** description */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
328 N_("Provides SSL support through Mozilla NSS."),
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
329 "Christian Hammond <chipx86@gnupdate.org>",
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
330 GAIM_WEBSITE, /**< homepage */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
331
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
332 plugin_load, /**< load */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
333 plugin_unload, /**< unload */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
334 NULL, /**< destroy */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
335
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
336 NULL, /**< ui_info */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
337 NULL /**< extra_info */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
338 };
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
339
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
340 static void
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
341 init_plugin(GaimPlugin *plugin)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
342 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
343 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
344
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
345 GAIM_INIT_PLUGIN(ssl_nss, init_plugin, info)