annotate plugins/ssl/ssl-gnutls.c @ 7016:aa619031193b

[gaim-migrate @ 7579] SSL suport is now provided by invisible plugins that are auto-loaded when SSL is needed. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 29 Sep 2003 15:29:49 +0000
parents
children e8cd8827fb25
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-gnutls.c GNUTLS 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"
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
23 #include "plugin.h"
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
24
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
25 #define SSL_GNUTLS_PLUGIN_ID "ssl-gnutls"
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
26
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
27 #ifdef HAVE_GNUTLS
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
28
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
29 #include "debug.h"
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
30 #include "sslconn.h"
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
31
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
32 #include <gnutls/gnutls.h>
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
33
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
34 typedef struct
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
35 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
36 gnutls_session session;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
37
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
38 } GaimSslGnutlsData;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
39
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
40 #define GAIM_SSL_GNUTLS_DATA(gsc) ((GaimSslGnutlsData *)gsc->private_data)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
41
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
42 static gnutls_certificate_client_credentials xcred;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
43
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
44 static gboolean
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
45 ssl_gnutls_init(void)
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 gnutls_global_init();
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
48
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
49 gnutls_certificate_allocate_credentials(&xcred);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
50 gnutls_certificate_set_x509_trust_file(xcred, "ca.pem",
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
51 GNUTLS_X509_FMT_PEM);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
52
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
53 return TRUE;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
54 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
55
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
56 static void
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
57 ssl_gnutls_uninit(void)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
58 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
59 gnutls_global_deinit();
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
60
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
61 gnutls_certificate_free_credentials(xcred);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
62 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
63
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
64 static void
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
65 ssl_gnutls_connect_cb(gpointer data, gint source, GaimInputCondition cond)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
66 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
67 GaimSslConnection *gsc = (GaimSslConnection *)data;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
68 GaimSslGnutlsData *gnutls_data;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
69 static const int cert_type_priority[2] = { GNUTLS_CRT_X509, 0 };
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
70 int ret;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
71
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
72 if (source < 0)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
73 return;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
74
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
75 gsc->fd = source;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
76
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
77 gnutls_data = g_new0(GaimSslGnutlsData, 1);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
78 gsc->private_data = gnutls_data;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
79
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
80 gnutls_init(&gnutls_data->session, GNUTLS_CLIENT);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
81 gnutls_set_default_priority(gnutls_data->session);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
82
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
83 gnutls_certificate_type_set_priority(gnutls_data->session,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
84 cert_type_priority);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
85
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
86 gnutls_credentials_set(gnutls_data->session, GNUTLS_CRD_CERTIFICATE,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
87 xcred);
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 gnutls_transport_set_ptr(gnutls_data->session, GINT_TO_POINTER(source));
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
90
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
91 gaim_debug_info("gnutls", "Handshaking\n");
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
92 ret = gnutls_handshake(gnutls_data->session);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
93
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
94 if (ret < 0)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
95 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
96 gaim_debug_error("gnutls", "Handshake failed\n");
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
97
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
98 /* XXX: notify the guy expecting the callback somehow? */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
99 gaim_ssl_close(gsc);
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 else
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
102 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
103 gsc->connect_cb(gsc->connect_cb_data, gsc, cond);
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
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
107 static void
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
108 ssl_gnutls_close(GaimSslConnection *gsc)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
109 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
110 GaimSslGnutlsData *gnutls_data = GAIM_SSL_GNUTLS_DATA(gsc);
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 gnutls_bye(gnutls_data->session, GNUTLS_SHUT_RDWR);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
113
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
114 gnutls_deinit(gnutls_data->session);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
115
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
116 g_free(gnutls_data);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
117 }
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 static size_t
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
120 ssl_gnutls_read(GaimSslConnection *gsc, void *data, size_t len)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
121 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
122 GaimSslGnutlsData *gnutls_data = GAIM_SSL_GNUTLS_DATA(gsc);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
123 int s;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
124
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
125 s = gnutls_record_recv(gnutls_data->session, data, len);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
126
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
127 if (s < 0)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
128 s = 0;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
129
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
130 return s;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
131 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
132
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
133 static size_t
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
134 ssl_gnutls_write(GaimSslConnection *gsc, const void *data, size_t len)
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 GaimSslGnutlsData *gnutls_data = GAIM_SSL_GNUTLS_DATA(gsc);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
137 size_t s;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
138
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
139 s = gnutls_record_send(gnutls_data->session, data, len);
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 if (s < 0)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
142 s = 0;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
143
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
144 return s;
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
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
147 static GaimSslOps ssl_ops =
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
148 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
149 ssl_gnutls_init,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
150 ssl_gnutls_uninit,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
151 ssl_gnutls_connect_cb,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
152 ssl_gnutls_close,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
153 ssl_gnutls_read,
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
154 ssl_gnutls_write
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
155 };
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 #endif /* HAVE_GNUTLS */
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 static gboolean
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
160 plugin_load(GaimPlugin *plugin)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
161 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
162 #ifdef HAVE_GNUTLS
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
163 gaim_ssl_set_ops(&ssl_ops);
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
164
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
165 return TRUE;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
166 #else
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
167 return FALSE;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
168 #endif
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
169 }
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 static gboolean
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
172 plugin_unload(GaimPlugin *plugin)
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
173 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
174 return TRUE;
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
175 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
176
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
177 static GaimPluginInfo info =
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
178 {
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
179 2, /**< api_version */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
180 GAIM_PLUGIN_STANDARD, /**< type */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
181 NULL, /**< ui_requirement */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
182 GAIM_PLUGIN_FLAG_INVISIBLE, /**< flags */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
183 NULL, /**< dependencies */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
184 GAIM_PRIORITY_DEFAULT, /**< priority */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
185
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
186 SSL_GNUTLS_PLUGIN_ID, /**< id */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
187 N_("GNUTLS"), /**< name */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
188 VERSION, /**< version */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
189 /** summary */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
190 N_("Provides SSL support through GNUTLS."),
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
191 /** description */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
192 N_("Provides SSL support through GNUTLS."),
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
193 "Christian Hammond <chipx86@gnupdate.org>",
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
194 GAIM_WEBSITE, /**< homepage */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
195
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
196 plugin_load, /**< load */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
197 plugin_unload, /**< unload */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
198 NULL, /**< destroy */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
199
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
200 NULL, /**< ui_info */
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
201 NULL /**< extra_info */
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 static void
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
205 init_plugin(GaimPlugin *plugin)
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 }
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
208
aa619031193b [gaim-migrate @ 7579]
Christian Hammond <chipx86@chipx86.com>
parents:
diff changeset
209 GAIM_INIT_PLUGIN(ssl_gnutls, init_plugin, info)