Mercurial > pidgin.yaz
annotate libpurple/sslconn.c @ 30754:bb1d593f185c
Make the changes from Andrew Victor's 3113fa54190de8c27a27e7001e9d902dca70037c
in im.pidgin.pidgin. The last line of that commit shouldn't be included here,
so I'm making these changes by hand. When we merge that branch to here or
vice versa it MIGHT conflict. But it should be pretty easy to figure out how
to fix it.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sun, 01 Aug 2010 07:04:48 +0000 |
parents | bff61dad9a6b |
children | d337a23e5536 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
2 * @file sslconn.c SSL API |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * @ingroup core |
20074
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
4 */ |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
5 |
6bf32c9e15a7
remove gpl boilerplate from doxygen docs
Sean Egan <seanegan@gmail.com>
parents:
19680
diff
changeset
|
6 /* purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * |
15823 | 8 * Purple is the legal property of its developers, whose names are too numerous |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * to list here. Please refer to the COPYRIGHT file distributed with this |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * source distribution. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * This program is free software; you can redistribute it and/or modify |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * it under the terms of the GNU General Public License as published by |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * the Free Software Foundation; either version 2 of the License, or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * This program is distributed in the hope that it will be useful, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * GNU General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
21 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
22 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19507
diff
changeset
|
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
25 */ |
24292
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23847
diff
changeset
|
26 #define _PURPLE_SSLCONN_C_ |
8282911d5e17
Build everything with the *_DISABLE_DEPRECATED flags set. This allows us
Richard Laager <rlaager@wiktel.com>
parents:
23847
diff
changeset
|
27 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "internal.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 |
18956
014e0cd9e471
- sslconn.c will need the certificate API
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18931
diff
changeset
|
30 #include "certificate.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "debug.h" |
23847
48958ca5abad
Close notify and request dialogs with PurpleSslConnection as handle.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20074
diff
changeset
|
32 #include "request.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 #include "sslconn.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 static gboolean _ssl_initialized = FALSE; |
15823 | 36 static PurpleSslOps *_ssl_ops = NULL; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 ssl_init(void) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 { |
15823 | 41 PurplePlugin *plugin; |
42 PurpleSslOps *ops; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 if (_ssl_initialized) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 |
15823 | 47 plugin = purple_plugins_find_with_id("core-ssl"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 |
15823 | 49 if (plugin != NULL && !purple_plugin_is_loaded(plugin)) |
50 purple_plugin_load(plugin); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 |
15823 | 52 ops = purple_ssl_get_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
53 if ((ops == NULL) || (ops->init == NULL) || (ops->uninit == NULL) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
54 (ops->connectfunc == NULL) || (ops->close == NULL) || |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 (ops->read == NULL) || (ops->write == NULL)) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
24752
5295ae18a77b
A patch from fqueze to prevent re-initalization of the SSL stuff. Fixes #7764.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
24292
diff
changeset
|
60 return (_ssl_initialized = ops->init()); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 gboolean |
15823 | 64 purple_ssl_is_supported(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 #ifdef HAVE_SSL |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 ssl_init(); |
15823 | 68 return (purple_ssl_get_ops() != NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 #else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
71 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
72 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
73 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
74 static void |
15823 | 75 purple_ssl_connect_cb(gpointer data, gint source, const gchar *error_message) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
76 { |
15823 | 77 PurpleSslConnection *gsc; |
78 PurpleSslOps *ops; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
79 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
80 gsc = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
81 gsc->connect_data = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 if (source < 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 if (gsc->error_cb != NULL) |
15823 | 86 gsc->error_cb(gsc, PURPLE_SSL_CONNECT_FAILED, gsc->connect_cb_data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 |
15823 | 88 purple_ssl_close(gsc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 gsc->fd = source; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
93 |
15823 | 94 ops = purple_ssl_get_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 ops->connectfunc(gsc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
97 |
15823 | 98 PurpleSslConnection * |
99 purple_ssl_connect(PurpleAccount *account, const char *host, int port, | |
100 PurpleSslInputFunction func, PurpleSslErrorFunction error_func, | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 void *data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 { |
27631
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
103 return purple_ssl_connect_with_ssl_cn(account, host, port, func, error_func, |
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
104 NULL, data); |
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
105 } |
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
106 |
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
107 PurpleSslConnection * |
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
108 purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, int port, |
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
109 PurpleSslInputFunction func, PurpleSslErrorFunction error_func, |
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
110 const char *ssl_cn, void *data) |
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
111 { |
15823 | 112 PurpleSslConnection *gsc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
114 g_return_val_if_fail(host != NULL, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
115 g_return_val_if_fail(port != 0 && port != -1, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
116 g_return_val_if_fail(func != NULL, NULL); |
15823 | 117 g_return_val_if_fail(purple_ssl_is_supported(), NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
118 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
119 if (!_ssl_initialized) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
120 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 if (!ssl_init()) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
124 |
15823 | 125 gsc = g_new0(PurpleSslConnection, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 gsc->fd = -1; |
27631
bff61dad9a6b
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <paul@darkrain42.org>
parents:
25415
diff
changeset
|
128 gsc->host = ssl_cn ? g_strdup(ssl_cn) : g_strdup(host); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 gsc->port = port; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 gsc->connect_cb_data = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 gsc->connect_cb = func; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 gsc->error_cb = error_func; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 |
18998
3273fa6a52a8
(this revision will be disapproved)
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18997
diff
changeset
|
134 /* TODO: Move this elsewhere */ |
3273fa6a52a8
(this revision will be disapproved)
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18997
diff
changeset
|
135 gsc->verifier = purple_certificate_find_verifier("x509","tls_cached"); |
3273fa6a52a8
(this revision will be disapproved)
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18997
diff
changeset
|
136 |
15823 | 137 gsc->connect_data = purple_proxy_connect(NULL, account, host, port, purple_ssl_connect_cb, gsc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 if (gsc->connect_data == NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
141 g_free(gsc->host); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 g_free(gsc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 |
15823 | 147 return (PurpleSslConnection *)gsc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
148 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 static void |
15823 | 151 recv_cb(gpointer data, gint source, PurpleInputCondition cond) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 { |
15823 | 153 PurpleSslConnection *gsc = data; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 gsc->recv_cb(gsc->recv_cb_data, gsc, cond); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 void |
15823 | 159 purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 void *data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 g_return_if_fail(func != NULL); |
15823 | 163 g_return_if_fail(purple_ssl_is_supported()); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 gsc->recv_cb_data = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 gsc->recv_cb = func; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
15823 | 168 gsc->inpa = purple_input_add(gsc->fd, PURPLE_INPUT_READ, recv_cb, gsc); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 |
18968
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
171 const gchar * |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
172 purple_ssl_strerror(PurpleSslErrorType error) |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
173 { |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
174 switch(error) { |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
175 case PURPLE_SSL_CONNECT_FAILED: |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
176 return _("SSL Connection Failed"); |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
177 case PURPLE_SSL_HANDSHAKE_FAILED: |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
178 return _("SSL Handshake Failed"); |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
179 case PURPLE_SSL_CERTIFICATE_INVALID: |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
180 return _("SSL peer presented an invalid certificate"); |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
181 default: |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
182 purple_debug_warning("sslconn", "Unknown SSL error code %d\n", error); |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
183 return _("Unknown SSL error"); |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
184 } |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
185 } |
1677ead39ee3
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18958
diff
changeset
|
186 |
15823 | 187 PurpleSslConnection * |
188 purple_ssl_connect_fd(PurpleAccount *account, int fd, | |
189 PurpleSslInputFunction func, | |
17558
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
190 PurpleSslErrorFunction error_func, |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
191 void *data) |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
192 { |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
193 return purple_ssl_connect_with_host_fd(account, fd, func, error_func, NULL, data); |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
194 } |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
195 |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
196 PurpleSslConnection * |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
197 purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
198 PurpleSslInputFunction func, |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
199 PurpleSslErrorFunction error_func, |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
200 const char *host, |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
201 void *data) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 { |
15823 | 203 PurpleSslConnection *gsc; |
204 PurpleSslOps *ops; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
205 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 g_return_val_if_fail(fd != -1, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 g_return_val_if_fail(func != NULL, NULL); |
15823 | 208 g_return_val_if_fail(purple_ssl_is_supported(), NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 if (!_ssl_initialized) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 if (!ssl_init()) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 return NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 |
15823 | 216 gsc = g_new0(PurpleSslConnection, 1); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
217 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 gsc->connect_cb_data = data; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 gsc->connect_cb = func; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
220 gsc->error_cb = error_func; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
221 gsc->fd = fd; |
17558
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
222 if(host) |
988102692e39
Fixed one of the issues in the ssl stuff, allowing CN cert checks for starttls-connections in XMPP.
Andreas Monitzer <pidgin@monitzer.com>
parents:
17290
diff
changeset
|
223 gsc->host = g_strdup(host); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 |
18998
3273fa6a52a8
(this revision will be disapproved)
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18997
diff
changeset
|
225 /* TODO: Move this elsewhere */ |
3273fa6a52a8
(this revision will be disapproved)
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18997
diff
changeset
|
226 gsc->verifier = purple_certificate_find_verifier("x509","tls_cached"); |
3273fa6a52a8
(this revision will be disapproved)
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18997
diff
changeset
|
227 |
25415
584063555949
Remove trailing whitespace
Mark Doliner <mark@kingant.net>
parents:
24752
diff
changeset
|
228 |
15823 | 229 ops = purple_ssl_get_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 ops->connectfunc(gsc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 |
15823 | 232 return (PurpleSslConnection *)gsc; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
235 void |
15823 | 236 purple_ssl_close(PurpleSslConnection *gsc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 { |
15823 | 238 PurpleSslOps *ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 g_return_if_fail(gsc != NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 |
23847
48958ca5abad
Close notify and request dialogs with PurpleSslConnection as handle.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20074
diff
changeset
|
242 purple_request_close_with_handle(gsc); |
48958ca5abad
Close notify and request dialogs with PurpleSslConnection as handle.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20074
diff
changeset
|
243 purple_notify_close_with_handle(gsc); |
48958ca5abad
Close notify and request dialogs with PurpleSslConnection as handle.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
20074
diff
changeset
|
244 |
15823 | 245 ops = purple_ssl_get_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 (ops->close)(gsc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
248 if (gsc->connect_data != NULL) |
15823 | 249 purple_proxy_connect_cancel(gsc->connect_data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
250 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 if (gsc->inpa > 0) |
15823 | 252 purple_input_remove(gsc->inpa); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 if (gsc->fd >= 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
255 close(gsc->fd); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 g_free(gsc->host); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
258 g_free(gsc); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 size_t |
15823 | 262 purple_ssl_read(PurpleSslConnection *gsc, void *data, size_t len) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 { |
15823 | 264 PurpleSslOps *ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
265 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 g_return_val_if_fail(gsc != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 g_return_val_if_fail(data != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
268 g_return_val_if_fail(len > 0, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 |
15823 | 270 ops = purple_ssl_get_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 return (ops->read)(gsc, data, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 size_t |
15823 | 275 purple_ssl_write(PurpleSslConnection *gsc, const void *data, size_t len) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 { |
15823 | 277 PurpleSslOps *ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 g_return_val_if_fail(gsc != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 g_return_val_if_fail(data != NULL, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 g_return_val_if_fail(len > 0, 0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 |
15823 | 283 ops = purple_ssl_get_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
284 return (ops->write)(gsc, data, len); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 |
18931
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
287 GList * |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
288 purple_ssl_get_peer_certificates(PurpleSslConnection *gsc) |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
289 { |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
290 PurpleSslOps *ops; |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
291 |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
292 g_return_val_if_fail(gsc != NULL, NULL); |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
293 |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
294 ops = purple_ssl_get_ops(); |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
295 return (ops->get_peer_certificates)(gsc); |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
296 } |
e634122cec47
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17558
diff
changeset
|
297 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 void |
15823 | 299 purple_ssl_set_ops(PurpleSslOps *ops) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 _ssl_ops = ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 |
15823 | 304 PurpleSslOps * |
305 purple_ssl_get_ops(void) | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
307 return _ssl_ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 void |
15823 | 311 purple_ssl_init(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 { |
19216
ab7cd6c95b2f
- Force full initialization of SSL system at startup
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18998
diff
changeset
|
313 /* Although purple_ssl_is_supported will do the initialization on |
ab7cd6c95b2f
- Force full initialization of SSL system at startup
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18998
diff
changeset
|
314 command, SSL plugins tend to register CertificateSchemes as well |
ab7cd6c95b2f
- Force full initialization of SSL system at startup
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18998
diff
changeset
|
315 as providing SSL ops. */ |
19504
d5ecaf5bce93
Fix the win32 build for the cert SoC branch merge.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19216
diff
changeset
|
316 if (!ssl_init()) { |
d5ecaf5bce93
Fix the win32 build for the cert SoC branch merge.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19216
diff
changeset
|
317 purple_debug_error("sslconn", "Unable to initialize SSL.\n"); |
d5ecaf5bce93
Fix the win32 build for the cert SoC branch merge.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
19216
diff
changeset
|
318 } |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
319 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 void |
15823 | 322 purple_ssl_uninit(void) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 { |
15823 | 324 PurpleSslOps *ops; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 if (!_ssl_initialized) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 return; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 |
15823 | 329 ops = purple_ssl_get_ops(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 ops->uninit(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 _ssl_initialized = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 } |