f954eef6c9ee875bf43b03ed0edaa1feba3a12e2
[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         label = gtk_label_new(buf);
340         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
341         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
342         g_free(buf);
343         
344         sig_status = ssl_certificate_check_signer(cert->x509_cert, cert->status);
345         if (sig_status==NULL)
346                 sig_status = g_strdup(_("Correct"));
347
348         buf = g_strdup_printf(_("Signature status: %s"), sig_status);
349         label = gtk_label_new(buf);
350         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
351         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
352         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
353         g_free(buf);
354         g_free(sig_status);
355         
356         button = gtk_expander_new_with_mnemonic(_("_View certificate"));
357         gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
358         cert_widget = cert_presenter(cert);
359         gtk_container_add(GTK_CONTAINER(button), cert_widget);
360
361         if (!ssl_certificate_check_subject_cn(cert))
362                 title = _("SSL certificate is invalid");
363         else
364                 title = _("SSL Certificate is unknown");
365
366         val = alertpanel_full(title, NULL,
367                               _("_Cancel connection"), _("_Accept and save"), NULL,
368                               FALSE, vbox, ALERT_QUESTION, G_ALERTDEFAULT);
369         
370         return (val == G_ALERTALTERNATE);
371 }
372
373 static gboolean sslcertwindow_ask_expired_cert(SSLCertificate *cert)
374 {
375         gchar *buf, *sig_status;
376         AlertValue val;
377         GtkWidget *vbox;
378         GtkWidget *label;
379         GtkWidget *button;
380         GtkWidget *cert_widget;
381         gchar *invalid_str = sslcertwindow_get_invalid_str(cert);
382         const gchar *title;
383
384         vbox = gtk_vbox_new(FALSE, 5);
385         buf = g_strdup_printf(_("Certificate for %s is expired.\n%sDo you want to continue?"), cert->host, invalid_str);
386         g_free(invalid_str);
387
388         label = gtk_label_new(buf);
389         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
390         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
391         g_free(buf);
392         
393         sig_status = ssl_certificate_check_signer(cert->x509_cert, cert->status);
394
395         if (sig_status==NULL)
396                 sig_status = g_strdup(_("Correct"));
397
398         buf = g_strdup_printf(_("Signature status: %s"), sig_status);
399         label = gtk_label_new(buf);
400         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
401         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
402         gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
403         g_free(buf);
404         g_free(sig_status);
405         
406         button = gtk_expander_new_with_mnemonic(_("_View certificate"));
407         gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
408         cert_widget = cert_presenter(cert);
409         gtk_container_add(GTK_CONTAINER(button), cert_widget);
410
411         if (!ssl_certificate_check_subject_cn(cert))
412                 title = _("SSL certificate is invalid and expired");
413         else
414                 title = _("SSL certificate is expired");
415
416         val = alertpanel_full(title, NULL,
417                               _("_Cancel connection"), _("_Accept"), NULL,
418                               FALSE, vbox, ALERT_QUESTION, G_ALERTDEFAULT);
419         
420         return (val == G_ALERTALTERNATE);
421 }
422
423 static gboolean sslcertwindow_ask_changed_cert(SSLCertificate *old_cert, SSLCertificate *new_cert)
424 {
425         GtkWidget *old_cert_widget = cert_presenter(old_cert);
426         GtkWidget *new_cert_widget = cert_presenter(new_cert);
427         GtkWidget *vbox;
428         gchar *buf, *sig_status;
429         GtkWidget *vbox2;
430         GtkWidget *label;
431         GtkWidget *button;
432         AlertValue val;
433         gchar *invalid_str = sslcertwindow_get_invalid_str(new_cert);
434         const gchar *title;
435
436         vbox = gtk_vbox_new(FALSE, 5);
437         label = gtk_label_new(_("New certificate:"));
438         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
439         gtk_box_pack_end(GTK_BOX(vbox), new_cert_widget, TRUE, TRUE, 0);
440         gtk_box_pack_end(GTK_BOX(vbox), label, TRUE, TRUE, 0);
441         gtk_box_pack_end(GTK_BOX(vbox), gtk_hseparator_new(), TRUE, TRUE, 0);
442         label = gtk_label_new(_("Known certificate:"));
443         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
444         gtk_box_pack_end(GTK_BOX(vbox), old_cert_widget, TRUE, TRUE, 0);
445         gtk_box_pack_end(GTK_BOX(vbox), label, TRUE, TRUE, 0);
446         gtk_widget_show_all(vbox);
447         
448         vbox2 = gtk_vbox_new(FALSE, 5);
449         buf = g_strdup_printf(_("Certificate for %s has changed.\n%sDo you want to accept it?"), new_cert->host, invalid_str);
450         g_free(invalid_str);
451
452         label = gtk_label_new(buf);
453         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
454         gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0);
455         g_free(buf);
456         
457         sig_status = ssl_certificate_check_signer(new_cert->x509_cert, new_cert->status);
458
459         if (sig_status==NULL)
460                 sig_status = g_strdup(_("Correct"));
461
462         buf = g_strdup_printf(_("Signature status: %s"), sig_status);
463         label = gtk_label_new(buf);
464         gtk_label_set_selectable(GTK_LABEL(label), TRUE);
465         gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
466         gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0);
467         g_free(buf);
468         g_free(sig_status);
469         
470         button = gtk_expander_new_with_mnemonic(_("_View certificates"));
471         gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, FALSE, 0);
472         gtk_container_add(GTK_CONTAINER(button), vbox);
473
474         if (!ssl_certificate_check_subject_cn(new_cert))
475                 title = _("SSL certificate changed and is invalid");
476         else
477                 title = _("SSL certificate changed");
478         val = alertpanel_full(title, NULL,
479                               _("_Cancel connection"), _("_Accept and save"), NULL,
480                               FALSE, vbox2, ALERT_WARNING, G_ALERTDEFAULT);
481         
482         return (val == G_ALERTALTERNATE);
483 }
484 #endif