2012-08-09 [colin] 3.8.1cvs27
[claws.git] / src / gtk / sslcertwindow.c
1 /*
2  * Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
3  * Copyright (C) 1999-2012 Colin Leroy <colin@colino.net> 
4  * and the Claws Mail team
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  * 
19  */
20
21 #ifdef HAVE_CONFIG_H
22 #  include "config.h"
23 #include "claws-features.h"
24 #endif
25
26 #ifdef USE_GNUTLS
27
28 #include <gnutls/gnutls.h>
29 #include <gnutls/x509.h>
30 #include <sys/types.h>
31 #include <sys/stat.h>
32 #include <stdio.h>
33 #include <unistd.h>
34 #include <string.h>
35
36 #include <glib.h>
37 #include <glib/gi18n.h>
38 #include <gtk/gtk.h>
39
40 #include "prefs_common.h"
41 #include "defs.h"
42 #include "ssl_certificate.h"
43 #include "utils.h"
44 #include "alertpanel.h"
45 #include "hooks.h"
46
47 static gboolean sslcertwindow_ask_new_cert(SSLCertificate *cert);
48 static gboolean sslcertwindow_ask_expired_cert(SSLCertificate *cert);
49 static gboolean sslcertwindow_ask_changed_cert(SSLCertificate *old_cert, SSLCertificate *new_cert);
50
51 static GtkWidget *cert_presenter(SSLCertificate *cert)
52 {
53         GtkWidget *vbox = NULL;
54         GtkWidget *hbox = NULL;
55         GtkWidget *frame_owner = NULL;
56         GtkWidget *frame_signer = NULL;
57         GtkWidget *frame_status = NULL;
58         GtkTable *owner_table = NULL;
59         GtkTable *signer_table = NULL;
60         GtkTable *status_table = NULL;
61         GtkWidget *label = NULL;
62         
63         char *issuer_commonname, *issuer_location, *issuer_organization;
64         char *subject_commonname, *subject_location, *subject_organization;
65         char *sig_status, *exp_date;
66         char *md5_fingerprint, *sha1_fingerprint, *fingerprint;
67         size_t n;
68         char buf[100];
69         unsigned char md[128];  
70         char *tmp;
71         time_t exp_time_t;
72         struct tm lt;
73
74         /* issuer */    
75         issuer_commonname = g_malloc(BUFFSIZE);
76         issuer_location = g_malloc(BUFFSIZE);
77         issuer_organization = g_malloc(BUFFSIZE);
78         subject_commonname = g_malloc(BUFFSIZE);
79         subject_location = g_malloc(BUFFSIZE);
80         subject_organization = g_malloc(BUFFSIZE);
81
82         n = BUFFSIZE;
83         if (gnutls_x509_crt_get_issuer_dn_by_oid(cert->x509_cert, 
84                 GNUTLS_OID_X520_COMMON_NAME, 0, 0, issuer_commonname, &n))
85                 strncpy(issuer_commonname, _("<not in certificate>"), BUFFSIZE);
86         n = BUFFSIZE;
87
88         if (gnutls_x509_crt_get_issuer_dn_by_oid(cert->x509_cert, 
89                 GNUTLS_OID_X520_LOCALITY_NAME, 0, 0, issuer_location, &n)) {
90                 if (gnutls_x509_crt_get_issuer_dn_by_oid(cert->x509_cert, 
91                         GNUTLS_OID_X520_COUNTRY_NAME, 0, 0, issuer_location, &n)) {
92                         strncpy(issuer_location, _("<not in certificate>"), BUFFSIZE);
93                 }
94         } else {
95                 tmp = g_malloc(BUFFSIZE);
96                 if (gnutls_x509_crt_get_issuer_dn_by_oid(cert->x509_cert, 
97                         GNUTLS_OID_X520_COUNTRY_NAME, 0, 0, tmp, &n) == 0) {
98                         strncat(issuer_location, ", ", BUFFSIZE-strlen(issuer_location)-1);
99                         strncat(issuer_location, tmp, BUFFSIZE-strlen(issuer_location)-1);
100                 }
101                 g_free(tmp);
102         }
103
104         n = BUFFSIZE;
105         if (gnutls_x509_crt_get_issuer_dn_by_oid(cert->x509_cert, 
106                 GNUTLS_OID_X520_ORGANIZATION_NAME, 0, 0, issuer_organization, &n))
107                 strncpy(issuer_organization, _("<not in certificate>"), BUFFSIZE);
108
109         n = BUFFSIZE;
110         if (gnutls_x509_crt_get_dn_by_oid(cert->x509_cert, 
111                 GNUTLS_OID_X520_COMMON_NAME, 0, 0, subject_commonname, &n))
112                 strncpy(subject_commonname, _("<not in certificate>"), BUFFSIZE);
113         n = BUFFSIZE;
114
115         if (gnutls_x509_crt_get_dn_by_oid(cert->x509_cert, 
116                 GNUTLS_OID_X520_LOCALITY_NAME, 0, 0, subject_location, &n)) {
117                 if (gnutls_x509_crt_get_dn_by_oid(cert->x509_cert, 
118                         GNUTLS_OID_X520_COUNTRY_NAME, 0, 0, subject_location, &n)) {
119                         strncpy(subject_location, _("<not in certificate>"), BUFFSIZE);
120                 }
121         } else {
122                 tmp = g_malloc(BUFFSIZE);
123                 if (gnutls_x509_crt_get_dn_by_oid(cert->x509_cert, 
124                         GNUTLS_OID_X520_COUNTRY_NAME, 0, 0, tmp, &n) == 0) {
125                         strncat(subject_location, ", ", BUFFSIZE-strlen(subject_location)-1);
126                         strncat(subject_location, tmp, BUFFSIZE-strlen(subject_location)-1);
127                 }
128                 g_free(tmp);
129         }
130
131         n = BUFFSIZE;
132         if (gnutls_x509_crt_get_dn_by_oid(cert->x509_cert, 
133                 GNUTLS_OID_X520_ORGANIZATION_NAME, 0, 0, subject_organization, &n))
134                 strncpy(subject_organization, _("<not in certificate>"), BUFFSIZE);
135                 
136         exp_time_t = gnutls_x509_crt_get_expiration_time(cert->x509_cert);
137
138         memset(buf, 0, sizeof(buf));
139         if (exp_time_t > 0) {
140                 fast_strftime(buf, sizeof(buf)-1, prefs_common.date_format, localtime_r(&exp_time_t, &lt));
141                 exp_date = (*buf) ? g_strdup(buf):g_strdup("?");
142         } else
143                 exp_date = g_strdup("");
144
145         /* fingerprint */
146         n = 128;
147         gnutls_x509_crt_get_fingerprint(cert->x509_cert, GNUTLS_DIG_MD5, md, &n);
148         md5_fingerprint = readable_fingerprint(md, (int)n);
149         n = 128;
150         gnutls_x509_crt_get_fingerprint(cert->x509_cert, GNUTLS_DIG_SHA1, md, &n);
151         sha1_fingerprint = readable_fingerprint(md, (int)n);
152
153         /* signature */
154         sig_status = ssl_certificate_check_signer(cert->x509_cert, cert->status);
155
156         if (sig_status==NULL)
157                 sig_status = g_strdup(_("Correct"));
158
159         vbox = gtk_vbox_new(FALSE, 5);
160         hbox = gtk_hbox_new(FALSE, 5);
161         
162         frame_owner  = gtk_frame_new(_("Owner"));
163         frame_signer = gtk_frame_new(_("Signer"));
164         frame_status = gtk_frame_new(_("Status"));
165         
166         owner_table = GTK_TABLE(gtk_table_new(3, 2, FALSE));
167         signer_table = GTK_TABLE(gtk_table_new(3, 2, FALSE));
168         status_table = GTK_TABLE(gtk_table_new(3, 2, FALSE));
169         
170         label = gtk_label_new(_("Name: "));
171         gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
172         gtk_table_attach(owner_table, label, 0, 1, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
173         label = gtk_label_new(subject_commonname);
174         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
175         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
176         gtk_table_attach(owner_table, label, 1, 2, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
177         
178         label = gtk_label_new(_("Organization: "));
179         gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
180         gtk_table_attach(owner_table, label, 0, 1, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
181         label = gtk_label_new(subject_organization);
182         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
183         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
184         gtk_table_attach(owner_table, label, 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
185         
186         label = gtk_label_new(_("Location: "));
187         gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
188         gtk_table_attach(owner_table, label, 0, 1, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
189         label = gtk_label_new(subject_location);
190         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
191         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
192         gtk_table_attach(owner_table, label, 1, 2, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
193
194         label = gtk_label_new(_("Name: "));
195         gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
196         gtk_table_attach(signer_table, label, 0, 1, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
197         label = gtk_label_new(issuer_commonname);
198         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
199         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
200         gtk_table_attach(signer_table, label, 1, 2, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
201         
202         label = gtk_label_new(_("Organization: "));
203         gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
204         gtk_table_attach(signer_table, label, 0, 1, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
205         label = gtk_label_new(issuer_organization);
206         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
207         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
208         gtk_table_attach(signer_table, label, 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
209         
210         label = gtk_label_new(_("Location: "));
211         gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
212         gtk_table_attach(signer_table, label, 0, 1, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
213         label = gtk_label_new(issuer_location);
214         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
215         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
216         gtk_table_attach(signer_table, label, 1, 2, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
217
218         label = gtk_label_new(_("Fingerprint: \n"));
219         gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
220         gtk_table_attach(status_table, label, 0, 1, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
221         fingerprint = g_strdup_printf("MD5: %s\nSHA1: %s", 
222                         md5_fingerprint, sha1_fingerprint);
223         label = gtk_label_new(fingerprint);
224         g_free(fingerprint);
225         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
226         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
227         gtk_table_attach(status_table, label, 1, 2, 0, 1, GTK_EXPAND|GTK_FILL, 0, 0, 0);
228         label = gtk_label_new(_("Signature status: "));
229         gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
230         gtk_table_attach(status_table, label, 0, 1, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
231         label = gtk_label_new(sig_status);
232         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
233         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
234         gtk_table_attach(status_table, label, 1, 2, 1, 2, GTK_EXPAND|GTK_FILL, 0, 0, 0);
235         label = gtk_label_new(_("Expires on: "));
236         gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
237         gtk_table_attach(status_table, label, 0, 1, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
238         label = gtk_label_new(exp_date);
239         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
240         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
241         gtk_table_attach(status_table, label, 1, 2, 2, 3, GTK_EXPAND|GTK_FILL, 0, 0, 0);
242         
243         gtk_container_add(GTK_CONTAINER(frame_owner), GTK_WIDGET(owner_table));
244         gtk_container_add(GTK_CONTAINER(frame_signer), GTK_WIDGET(signer_table));
245         gtk_container_add(GTK_CONTAINER(frame_status), GTK_WIDGET(status_table));
246         
247         gtk_box_pack_end(GTK_BOX(hbox), frame_signer, TRUE, TRUE, 0);
248         gtk_box_pack_end(GTK_BOX(hbox), frame_owner, TRUE, TRUE, 0);
249         gtk_box_pack_end(GTK_BOX(vbox), frame_status, TRUE, TRUE, 0);
250         gtk_box_pack_end(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
251         
252         gtk_widget_show_all(vbox);
253         
254         g_free(issuer_commonname);
255         g_free(issuer_location);
256         g_free(issuer_organization);
257         g_free(subject_commonname);
258         g_free(subject_location);
259         g_free(subject_organization);
260         g_free(md5_fingerprint);
261         g_free(sha1_fingerprint);
262         g_free(sig_status);
263         g_free(exp_date);
264         return vbox;
265 }
266
267 static gboolean sslcert_ask_hook(gpointer source, gpointer data)
268 {
269         SSLCertHookData *hookdata = (SSLCertHookData *)source;
270
271         if (hookdata == NULL) {
272                 return FALSE;
273         }
274         
275         if (prefs_common.skip_ssl_cert_check) {
276                 hookdata->accept = TRUE;
277                 return TRUE;
278         }
279
280         if (hookdata->old_cert == NULL) {
281                 if (hookdata->expired)
282                         hookdata->accept = sslcertwindow_ask_expired_cert(hookdata->cert);
283                 else
284                         hookdata->accept = sslcertwindow_ask_new_cert(hookdata->cert);
285         } else {
286                 hookdata->accept = sslcertwindow_ask_changed_cert(hookdata->old_cert, hookdata->cert);
287         }
288
289         return TRUE;
290 }
291
292 void sslcertwindow_register_hook(void)
293 {
294         hooks_register_hook(SSLCERT_ASK_HOOKLIST, sslcert_ask_hook, NULL);
295 }
296
297 void sslcertwindow_show_cert(SSLCertificate *cert)
298 {
299         GtkWidget *cert_widget = cert_presenter(cert);
300         gchar *buf;
301         
302         buf = g_strdup_printf(_("SSL certificate for %s"), cert->host);
303         alertpanel_full(buf, NULL, GTK_STOCK_CLOSE, NULL, NULL,
304                         FALSE, cert_widget, ALERT_NOTICE, G_ALERTDEFAULT);
305         g_free(buf);
306 }
307
308 static gchar *sslcertwindow_get_invalid_str(SSLCertificate *cert)
309 {
310         gchar *subject_cn = NULL;
311         gchar *str = NULL;
312
313         if (ssl_certificate_check_subject_cn(cert))
314                 return g_strdup("");
315         
316         subject_cn = ssl_certificate_get_subject_cn(cert);
317         
318         str = g_strdup_printf(_("Certificate is for %s, but connection is to %s.\n"
319                                 "You may be connecting to a rogue server.\n\n"), 
320                                 subject_cn, cert->host);
321         g_free(subject_cn);
322         
323         return str;
324 }
325
326 static gboolean sslcertwindow_ask_new_cert(SSLCertificate *cert)
327 {
328         gchar *buf, *sig_status;
329         AlertValue val;
330         GtkWidget *vbox;
331         GtkWidget *label;
332         GtkWidget *button;
333         GtkWidget *cert_widget;
334         gchar *invalid_str = sslcertwindow_get_invalid_str(cert);
335         const gchar *title;
336
337         vbox = gtk_vbox_new(FALSE, 5);
338         buf = g_strdup_printf(_("Certificate for %s is unknown.\n%sDo you want to accept it?"), cert->host, invalid_str);
339         g_free(invalid_str);
340
341         label = gtk_label_new(buf);
342         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
343         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
344         g_free(buf);
345         
346         sig_status = ssl_certificate_check_signer(cert->x509_cert, cert->status);
347         if (sig_status==NULL)
348                 sig_status = g_strdup(_("Correct"));
349
350         buf = g_strdup_printf(_("Signature status: %s"), sig_status);
351         label = gtk_label_new(buf);
352         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
353         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
354         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
355         g_free(buf);
356         g_free(sig_status);
357         
358         button = gtk_expander_new_with_mnemonic(_("_View certificate"));
359         gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
360         cert_widget = cert_presenter(cert);
361         gtk_container_add(GTK_CONTAINER(button), cert_widget);
362
363         if (!ssl_certificate_check_subject_cn(cert))
364                 title = _("SSL certificate is invalid");
365         else
366                 title = _("SSL Certificate is unknown");
367
368         val = alertpanel_full(title, NULL,
369                               _("_Cancel connection"), _("_Accept and save"), NULL,
370                               FALSE, vbox, ALERT_QUESTION, G_ALERTDEFAULT);
371         
372         return (val == G_ALERTALTERNATE);
373 }
374
375 static gboolean sslcertwindow_ask_expired_cert(SSLCertificate *cert)
376 {
377         gchar *buf, *sig_status;
378         AlertValue val;
379         GtkWidget *vbox;
380         GtkWidget *label;
381         GtkWidget *button;
382         GtkWidget *cert_widget;
383         gchar *invalid_str = sslcertwindow_get_invalid_str(cert);
384         const gchar *title;
385
386         vbox = gtk_vbox_new(FALSE, 5);
387         buf = g_strdup_printf(_("Certificate for %s is expired.\n%sDo you want to continue?"), cert->host, invalid_str);
388         g_free(invalid_str);
389
390         label = gtk_label_new(buf);
391         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
392         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
393         g_free(buf);
394         
395         sig_status = ssl_certificate_check_signer(cert->x509_cert, cert->status);
396
397         if (sig_status==NULL)
398                 sig_status = g_strdup(_("Correct"));
399
400         buf = g_strdup_printf(_("Signature status: %s"), sig_status);
401         label = gtk_label_new(buf);
402         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
403         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
404         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
405         g_free(buf);
406         g_free(sig_status);
407         
408         button = gtk_expander_new_with_mnemonic(_("_View certificate"));
409         gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
410         cert_widget = cert_presenter(cert);
411         gtk_container_add(GTK_CONTAINER(button), cert_widget);
412
413         if (!ssl_certificate_check_subject_cn(cert))
414                 title = _("SSL certificate is invalid and expired");
415         else
416                 title = _("SSL certificate is expired");
417
418         val = alertpanel_full(title, NULL,
419                               _("_Cancel connection"), _("_Accept"), NULL,
420                               FALSE, vbox, ALERT_QUESTION, G_ALERTDEFAULT);
421         
422         return (val == G_ALERTALTERNATE);
423 }
424
425 static gboolean sslcertwindow_ask_changed_cert(SSLCertificate *old_cert, SSLCertificate *new_cert)
426 {
427         GtkWidget *old_cert_widget = cert_presenter(old_cert);
428         GtkWidget *new_cert_widget = cert_presenter(new_cert);
429         GtkWidget *vbox;
430         gchar *buf, *sig_status;
431         GtkWidget *vbox2;
432         GtkWidget *label;
433         GtkWidget *button;
434         AlertValue val;
435         gchar *invalid_str = sslcertwindow_get_invalid_str(new_cert);
436         const gchar *title;
437
438         vbox = gtk_vbox_new(FALSE, 5);
439         label = gtk_label_new(_("New certificate:"));
440         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
441         gtk_box_pack_end(GTK_BOX(vbox), new_cert_widget, TRUE, TRUE, 0);
442         gtk_box_pack_end(GTK_BOX(vbox), label, TRUE, TRUE, 0);
443         gtk_box_pack_end(GTK_BOX(vbox), gtk_hseparator_new(), TRUE, TRUE, 0);
444         label = gtk_label_new(_("Known certificate:"));
445         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
446         gtk_box_pack_end(GTK_BOX(vbox), old_cert_widget, TRUE, TRUE, 0);
447         gtk_box_pack_end(GTK_BOX(vbox), label, TRUE, TRUE, 0);
448         gtk_widget_show_all(vbox);
449         
450         vbox2 = gtk_vbox_new(FALSE, 5);
451         buf = g_strdup_printf(_("Certificate for %s has changed.\n%sDo you want to accept it?"), new_cert->host, invalid_str);
452         g_free(invalid_str);
453
454         label = gtk_label_new(buf);
455         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
456         gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0);
457         g_free(buf);
458         
459         sig_status = ssl_certificate_check_signer(new_cert->x509_cert, new_cert->status);
460
461         if (sig_status==NULL)
462                 sig_status = g_strdup(_("Correct"));
463
464         buf = g_strdup_printf(_("Signature status: %s"), sig_status);
465         label = gtk_label_new(buf);
466         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
467         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
468         gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0);
469         g_free(buf);
470         g_free(sig_status);
471         
472         button = gtk_expander_new_with_mnemonic(_("_View certificates"));
473         gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, FALSE, 0);
474         gtk_container_add(GTK_CONTAINER(button), vbox);
475
476         if (!ssl_certificate_check_subject_cn(new_cert))
477                 title = _("SSL certificate changed and is invalid");
478         else
479                 title = _("SSL certificate changed");
480         val = alertpanel_full(title, NULL,
481                               _("_Cancel connection"), _("_Accept and save"), NULL,
482                               FALSE, vbox2, ALERT_WARNING, G_ALERTDEFAULT);
483         
484         return (val == G_ALERTALTERNATE);
485 }
486 #endif