Mon, 13 Jul 2009 05:01:42 +0000
On MSN, pop up an "invite message" request similar to oscar, and send that
in the add request. We really should try and move this into the add buddy
dialog instead of an extra prompt.
Fixes #8503.
| 8849 | 1 | /* |
| 2 | ||
| 15884 | 3 | silcpurple_pk.c |
| 8849 | 4 | |
| 5 | Author: Pekka Riikonen <priikone@silcnet.org> | |
| 6 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
7 | Copyright (C) 2004 - 2007 Pekka Riikonen |
| 8849 | 8 | |
| 9 | This program is free software; you can redistribute it and/or modify | |
| 10 | it under the terms of the GNU General Public License as published by | |
| 11 | the Free Software Foundation; version 2 of the License. | |
| 12 | ||
| 13 | This program is distributed in the hope that it will be useful, | |
| 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | GNU General Public License for more details. | |
| 17 | ||
| 18 | */ | |
| 19 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
20 | #include "silc.h" |
| 8849 | 21 | #include "silcclient.h" |
| 15884 | 22 | #include "silcpurple.h" |
| 8849 | 23 | |
| 24 | /************************* Public Key Verification ***************************/ | |
| 25 | ||
| 26 | typedef struct { | |
| 27 | SilcClient client; | |
| 28 | SilcClientConnection conn; | |
| 29 | char *filename; | |
| 30 | char *entity; | |
| 31 | char *entity_name; | |
| 32 | char *fingerprint; | |
| 33 | char *babbleprint; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
34 | SilcPublicKey public_key; |
| 8849 | 35 | SilcVerifyPublicKey completion; |
| 36 | void *context; | |
| 37 | gboolean changed; | |
| 38 | } *PublicKeyVerify; | |
| 39 | ||
| 15884 | 40 | static void silcpurple_verify_ask(const char *entity, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
41 | const char *fingerprint, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
42 | const char *babbleprint, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
43 | PublicKeyVerify verify); |
| 8849 | 44 | |
| 15884 | 45 | static void silcpurple_verify_cb(PublicKeyVerify verify, gint id) |
| 8849 | 46 | { |
| 47 | if (id != 2) { | |
| 48 | if (verify->completion) | |
| 49 | verify->completion(FALSE, verify->context); | |
| 50 | } else { | |
| 51 | if (verify->completion) | |
| 52 | verify->completion(TRUE, verify->context); | |
| 53 | ||
| 54 | /* Save the key for future checking */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
55 | silc_pkcs_save_public_key(verify->filename, verify->public_key, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
56 | SILC_PKCS_FILE_BASE64); |
| 8849 | 57 | } |
| 58 | ||
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
59 | g_free(verify->filename); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
60 | g_free(verify->entity); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
61 | g_free(verify->entity_name); |
| 8849 | 62 | silc_free(verify->fingerprint); |
| 63 | silc_free(verify->babbleprint); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
64 | silc_pkcs_public_key_free(verify->public_key); |
| 8849 | 65 | silc_free(verify); |
| 66 | } | |
| 67 | ||
| 15884 | 68 | static void silcpurple_verify_details_cb(PublicKeyVerify verify) |
| 8849 | 69 | { |
| 70 | /* What a hack. We have to display the accept dialog _again_ | |
| 15884 | 71 | because Purple closes the dialog after you press the button. Purple |
| 8849 | 72 | should have option for the dialogs whether the buttons close them |
| 73 | or not. */ | |
| 15884 | 74 | silcpurple_verify_ask(verify->entity, verify->fingerprint, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
75 | verify->babbleprint, verify); |
| 8849 | 76 | } |
| 77 | ||
| 15884 | 78 | static void silcpurple_verify_details(PublicKeyVerify verify, gint id) |
| 8849 | 79 | { |
| 15884 | 80 | PurpleConnection *gc = verify->client->application; |
| 81 | SilcPurple sg = gc->proto_data; | |
| 8849 | 82 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
83 | silcpurple_show_public_key(sg, verify->entity_name, verify->public_key, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
84 | G_CALLBACK(silcpurple_verify_details_cb), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
85 | verify); |
| 8849 | 86 | } |
| 87 | ||
| 15884 | 88 | static void silcpurple_verify_ask(const char *entity, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
89 | const char *fingerprint, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
90 | const char *babbleprint, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
91 | PublicKeyVerify verify) |
| 8849 | 92 | { |
|
16492
4f0dc2d16e55
Update SILC to match resent request API changes
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
93 | PurpleConnection *gc = verify->client->application; |
| 8849 | 94 | char tmp[256], tmp2[256]; |
| 95 | ||
| 96 | if (verify->changed) { | |
| 97 | g_snprintf(tmp, sizeof(tmp), | |
| 98 | _("Received %s's public key. Your local copy does not match this " | |
| 99 | "key. Would you still like to accept this public key?"), | |
| 100 | entity); | |
| 101 | } else { | |
| 102 | g_snprintf(tmp, sizeof(tmp), | |
| 103 | _("Received %s's public key. Would you like to accept this " | |
| 104 | "public key?"), entity); | |
| 105 | } | |
| 106 | g_snprintf(tmp2, sizeof(tmp2), | |
| 107 | _("Fingerprint and babbleprint for the %s key are:\n\n" | |
| 108 | "%s\n%s\n"), entity, fingerprint, babbleprint); | |
| 109 | ||
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
110 | purple_request_action(gc, _("Verify Public Key"), tmp, tmp2, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
111 | PURPLE_DEFAULT_ACTION_NONE, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
112 | purple_connection_get_account(gc), entity, NULL, verify, 3, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
113 | _("Yes"), G_CALLBACK(silcpurple_verify_cb), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
114 | _("No"), G_CALLBACK(silcpurple_verify_cb), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
115 | _("_View..."), G_CALLBACK(silcpurple_verify_details)); |
| 8849 | 116 | } |
| 117 | ||
| 15884 | 118 | void silcpurple_verify_public_key(SilcClient client, SilcClientConnection conn, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
119 | const char *name, SilcConnectionType conn_type, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
120 | SilcPublicKey public_key, |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
121 | SilcVerifyPublicKey completion, void *context) |
| 8849 | 122 | { |
| 15884 | 123 | PurpleConnection *gc = client->application; |
| 8849 | 124 | int i; |
| 125 | char file[256], filename[256], filename2[256], *ipf, *hostf = NULL; | |
| 126 | char *fingerprint, *babbleprint; | |
| 127 | struct passwd *pw; | |
| 128 | struct stat st; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
129 | char *entity = ((conn_type == SILC_CONN_SERVER || |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
130 | conn_type == SILC_CONN_ROUTER) ? |
| 8849 | 131 | "server" : "client"); |
| 132 | PublicKeyVerify verify; | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
133 | const char *ip, *hostname; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
134 | SilcUInt16 port; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
135 | unsigned char *pk; |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
136 | SilcUInt32 pk_len; |
| 8849 | 137 | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
138 | if (silc_pkcs_get_type(public_key) != SILC_PKCS_SILC) { |
| 15884 | 139 | purple_notify_error(gc, _("Verify Public Key"), |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
140 | _("Unsupported public key type"), NULL); |
| 8849 | 141 | if (completion) |
| 142 | completion(FALSE, context); | |
| 143 | return; | |
| 144 | } | |
| 145 | ||
| 146 | pw = getpwuid(getuid()); | |
| 147 | if (!pw) { | |
| 148 | if (completion) | |
| 149 | completion(FALSE, context); | |
| 150 | return; | |
| 151 | } | |
| 152 | ||
| 153 | memset(filename, 0, sizeof(filename)); | |
| 154 | memset(filename2, 0, sizeof(filename2)); | |
| 155 | memset(file, 0, sizeof(file)); | |
| 156 | ||
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
157 | silc_socket_stream_get_info(silc_packet_stream_get_stream(conn->stream), |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
158 | NULL, &hostname, &ip, &port); |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
159 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
160 | pk = silc_pkcs_public_key_encode(public_key, &pk_len); |
|
20289
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17675
diff
changeset
|
161 | if (!pk) { |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17675
diff
changeset
|
162 | if (completion) |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17675
diff
changeset
|
163 | completion(FALSE, context); |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17675
diff
changeset
|
164 | return; |
|
5c844288fbec
applied changes from 32f31e981f0618a4167aa98bcc22c2dab13d1550
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17675
diff
changeset
|
165 | } |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
166 | |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
167 | if (conn_type == SILC_CONN_SERVER || |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
168 | conn_type == SILC_CONN_ROUTER) { |
| 8849 | 169 | if (!name) { |
| 170 | g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
171 | ip, port); |
| 8849 | 172 | g_snprintf(filename, sizeof(filename) - 1, |
| 173 | "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", | |
| 15884 | 174 | silcpurple_silcdir(), entity, file); |
| 8849 | 175 | |
| 176 | g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
177 | hostname, port); |
| 8849 | 178 | g_snprintf(filename2, sizeof(filename2) - 1, |
| 179 | "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", | |
| 15884 | 180 | silcpurple_silcdir(), entity, file); |
| 8849 | 181 | |
| 182 | ipf = filename; | |
| 183 | hostf = filename2; | |
| 184 | } else { | |
| 185 | g_snprintf(file, sizeof(file) - 1, "%skey_%s_%d.pub", entity, | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
186 | name, port); |
| 8849 | 187 | g_snprintf(filename, sizeof(filename) - 1, |
| 188 | "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", | |
| 15884 | 189 | silcpurple_silcdir(), entity, file); |
| 8849 | 190 | |
| 191 | ipf = filename; | |
| 192 | } | |
| 193 | } else { | |
| 194 | /* Replace all whitespaces with `_'. */ | |
| 195 | fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); | |
| 196 | for (i = 0; i < strlen(fingerprint); i++) | |
| 197 | if (fingerprint[i] == ' ') | |
| 198 | fingerprint[i] = '_'; | |
| 199 | ||
| 200 | g_snprintf(file, sizeof(file) - 1, "%skey_%s.pub", entity, fingerprint); | |
| 201 | g_snprintf(filename, sizeof(filename) - 1, | |
| 202 | "%s" G_DIR_SEPARATOR_S "%skeys" G_DIR_SEPARATOR_S "%s", | |
| 15884 | 203 | silcpurple_silcdir(), entity, file); |
| 8849 | 204 | silc_free(fingerprint); |
| 205 | ||
| 206 | ipf = filename; | |
| 207 | } | |
| 208 | ||
| 209 | verify = silc_calloc(1, sizeof(*verify)); | |
| 210 | if (!verify) | |
| 211 | return; | |
| 212 | verify->client = client; | |
| 213 | verify->conn = conn; | |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
214 | verify->filename = g_strdup(ipf); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
215 | verify->entity = g_strdup(entity); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
216 | verify->entity_name = (conn_type != SILC_CONN_CLIENT ? |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
217 | (name ? g_strdup(name) : g_strdup(hostname)) |
| 8849 | 218 | : NULL); |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
219 | verify->public_key = silc_pkcs_public_key_copy(public_key); |
| 8849 | 220 | verify->completion = completion; |
| 221 | verify->context = context; | |
| 222 | fingerprint = verify->fingerprint = silc_hash_fingerprint(NULL, pk, pk_len); | |
| 223 | babbleprint = verify->babbleprint = silc_hash_babbleprint(NULL, pk, pk_len); | |
| 224 | ||
| 225 | /* Check whether this key already exists */ | |
|
10589
4e10236e06d4
[gaim-migrate @ 11994]
Daniel Atallah <datallah@pidgin.im>
parents:
10116
diff
changeset
|
226 | if (g_stat(ipf, &st) < 0 && (!hostf || g_stat(hostf, &st) < 0)) { |
| 8849 | 227 | /* Key does not exist, ask user to verify the key and save it */ |
| 15884 | 228 | silcpurple_verify_ask(name ? name : entity, |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
229 | fingerprint, babbleprint, verify); |
| 8849 | 230 | return; |
| 231 | } else { | |
| 232 | /* The key already exists, verify it. */ | |
| 233 | SilcPublicKey public_key; | |
| 234 | unsigned char *encpk; | |
| 235 | SilcUInt32 encpk_len; | |
| 236 | ||
| 237 | /* Load the key file, try for both IP filename and hostname filename */ | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
238 | if (!silc_pkcs_load_public_key(ipf, &public_key) && |
|
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
239 | (!hostf || (!silc_pkcs_load_public_key(hostf, &public_key)))) { |
| 15884 | 240 | silcpurple_verify_ask(name ? name : entity, |
| 8849 | 241 | fingerprint, babbleprint, verify); |
| 242 | return; | |
| 243 | } | |
| 244 | ||
| 245 | /* Encode the key data */ | |
| 246 | encpk = silc_pkcs_public_key_encode(public_key, &encpk_len); | |
| 247 | if (!encpk) { | |
| 15884 | 248 | silcpurple_verify_ask(name ? name : entity, |
| 8849 | 249 | fingerprint, babbleprint, verify); |
| 250 | return; | |
| 251 | } | |
| 252 | ||
| 253 | /* Compare the keys */ | |
| 254 | if (memcmp(encpk, pk, encpk_len)) { | |
| 255 | /* Ask user to verify the key and save it */ | |
| 256 | verify->changed = TRUE; | |
| 15884 | 257 | silcpurple_verify_ask(name ? name : entity, |
| 8849 | 258 | fingerprint, babbleprint, verify); |
| 259 | return; | |
| 260 | } | |
| 261 | ||
| 262 | /* Local copy matched */ | |
| 263 | if (completion) | |
| 264 | completion(TRUE, context); | |
|
22972
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
265 | g_free(verify->filename); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
266 | g_free(verify->entity); |
|
2942c1995c22
Cleanup allocations/frees to match and plug some leaks.
Daniel Atallah <datallah@pidgin.im>
parents:
21630
diff
changeset
|
267 | g_free(verify->entity_name); |
| 8849 | 268 | silc_free(verify->fingerprint); |
| 269 | silc_free(verify->babbleprint); | |
|
17675
e7069bf1de1a
Patch from Pekka Riikonen to update the SILC protocol plugin to work with
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16492
diff
changeset
|
270 | silc_pkcs_public_key_free(verify->public_key); |
| 8849 | 271 | silc_free(verify); |
| 272 | } | |
| 273 | } |