put back includes, cleaner ssl certs popups
authorColin Leroy <colin@colino.net>
Sun, 8 Dec 2002 15:57:35 +0000 (15:57 +0000)
committerColin Leroy <colin@colino.net>
Sun, 8 Dec 2002 15:57:35 +0000 (15:57 +0000)
ChangeLog.claws
configure.in
src/gtk/sslcertwindow.c
src/prefs_common.c
src/prefs_common.h
src/ssl_certificate.c
src/undo.c

index e1cafa7a10d504ceadef806afb6253716a2c2be9..103a2450c4270a680e48f2296dbd5363afaa93bb 100644 (file)
@@ -1,3 +1,14 @@
+2002-12-08 [colin]     0.8.6claws80
+       
+       * src/gtk/sslcertwindow.c
+               Cleaner popups when asking
+       * src/ssl_certificate.c
+       * src/prefs_common.[ch]
+               remove ssl certificate pref
+               put back needed include
+       * src/undo.c
+               put back needed include
+
 2002-12-08 [christoph] 0.8.6claws79
 
        * src/folderview.c
index 1f47cdd8d96ca07c30f5e7682e8081dcf21b9f40..35e21eb33aa3bede50da4dd05262c92d565b6202 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws79
+EXTRA_VERSION=claws80
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index b20fd521962a8ca78f337f7c1651296c30324535..d7d2d17d362410f15fc2676c47005cc37711d336 100644 (file)
@@ -31,6 +31,9 @@
 #include "../common/utils.h"
 #include "../alertpanel.h"
 
+static void toggle_cert_cb(GtkWidget   *widget,
+                        gpointer        data);
+
 GtkWidget *cert_presenter(SSLCertificate *cert)
 {
        GtkWidget *vbox = NULL;
@@ -42,7 +45,7 @@ GtkWidget *cert_presenter(SSLCertificate *cert)
        GtkTable *signer_table = NULL;
        GtkTable *status_table = NULL;
        GtkWidget *label = NULL;
-       char *ret, buf[100];
+       char buf[100];
        char *issuer_commonname, *issuer_location, *issuer_organization;
        char *subject_commonname, *subject_location, *subject_organization;
        char *fingerprint, *sig_status;
@@ -206,14 +209,57 @@ void sslcertwindow_show_cert(SSLCertificate *cert)
        g_free(buf);
 }
 
+static void toggle_cert_cb(GtkWidget   *widget,
+                        gpointer        data)
+{
+       GtkWidget *cert_widget = GTK_WIDGET(data);
+       GtkWidget *box = widget->parent;
+       if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) {
+               if(cert_widget->parent == NULL) {
+                       gtk_box_pack_start(GTK_BOX(box), cert_widget, TRUE, TRUE, 0);
+                       gtk_widget_show(cert_widget);
+               } else
+                       gtk_widget_show(cert_widget);
+       } else
+               gtk_widget_hide(cert_widget);
+}
+
 gboolean sslcertwindow_ask_new_cert(SSLCertificate *cert)
 {
-       GtkWidget *cert_widget = cert_presenter(cert);
-       gchar *buf;
+       gchar *buf, *sig_status;
        AlertValue val;
-       buf = g_strdup_printf(_("Do you want to accept SSL certificate for %s?"), cert->host);
-       val = alertpanel_with_widget(_("Unknown SSL Certificate"), buf, _("Accept and save"), _("Cancel connection"), NULL, cert_widget);
+       GtkWidget *vbox;
+       GtkWidget *label;
+       GtkWidget *button;
+       GtkWidget *cert_widget;
+       
+       vbox = gtk_vbox_new(FALSE, 5);
+       buf = g_strdup_printf(_("Certificate for %s is unknown. Do you want to accept it?"), cert->host);
+       label = gtk_label_new(buf);
+       gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+       gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
+       g_free(buf);
+       
+       sig_status = ssl_certificate_check_signer(cert->x509_cert);
+
+       if (sig_status==NULL)
+               sig_status = g_strdup(_("correct"));
+
+       buf = g_strdup_printf(_("Signature status: %s"), sig_status);
+       label = gtk_label_new(buf);
+       gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+       gtk_box_pack_start(GTK_BOX(vbox), label, TRUE, TRUE, 0);
        g_free(buf);
+       g_free(sig_status);
+       
+       button = gtk_toggle_button_new_with_label(_("View certificate"));
+       gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
+       cert_widget = cert_presenter(cert);
+       gtk_signal_connect(GTK_OBJECT(button), "toggled",
+                          GTK_SIGNAL_FUNC(toggle_cert_cb), cert_widget);
+
+       val = alertpanel_with_widget(_("Unknown SSL Certificate"), NULL, _("Accept and save"), _("Cancel connection"), NULL, vbox);
+       
        return (val == G_ALERTDEFAULT);
 }
 
@@ -222,8 +268,10 @@ gboolean sslcertwindow_ask_changed_cert(SSLCertificate *old_cert, SSLCertificate
        GtkWidget *old_cert_widget = cert_presenter(old_cert);
        GtkWidget *new_cert_widget = cert_presenter(new_cert);
        GtkWidget *vbox;
+       gchar *buf, *sig_status;
+       GtkWidget *vbox2;
        GtkWidget *label;
-       gchar *buf;
+       GtkWidget *button;
        AlertValue val;
        
        vbox = gtk_vbox_new(FALSE, 5);
@@ -238,9 +286,32 @@ gboolean sslcertwindow_ask_changed_cert(SSLCertificate *old_cert, SSLCertificate
        gtk_box_pack_end(GTK_BOX(vbox), label, TRUE, TRUE, 0);
        gtk_widget_show_all(vbox);
        
-       buf = g_strdup_printf(_("Do you want to accept new SSL certificate for %s?"), new_cert->host);
-       val = alertpanel_with_widget(_("Changed SSL Certificate"), buf, _("Accept and save"), _("Cancel connection"), NULL, vbox);
+       vbox2 = gtk_vbox_new(FALSE, 5);
+       buf = g_strdup_printf(_("Certificate for %s has changed. Do you want to accept it?"), new_cert->host);
+       label = gtk_label_new(buf);
+       gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+       gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0);
+       g_free(buf);
+       
+       sig_status = ssl_certificate_check_signer(new_cert->x509_cert);
+
+       if (sig_status==NULL)
+               sig_status = g_strdup(_("correct"));
+
+       buf = g_strdup_printf(_("Signature status: %s"), sig_status);
+       label = gtk_label_new(buf);
+       gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+       gtk_box_pack_start(GTK_BOX(vbox2), label, TRUE, TRUE, 0);
        g_free(buf);
+       g_free(sig_status);
+       
+       button = gtk_toggle_button_new_with_label(_("View certificates"));
+       gtk_box_pack_start(GTK_BOX(vbox2), button, FALSE, FALSE, 0);
+       gtk_signal_connect(GTK_OBJECT(button), "toggled",
+                          GTK_SIGNAL_FUNC(toggle_cert_cb), vbox);
+
+       val = alertpanel_with_widget(_("Changed SSL Certificate"), NULL, _("Accept and save"), _("Cancel connection"), NULL, vbox2);
+       
        return (val == G_ALERTDEFAULT);
 }
 #endif
index a0ec0c8b200922ffc725cea87ad2000a0e275d20..f246894e695cdf18f05707d3bd21496a5b7d8743 100644 (file)
@@ -237,9 +237,12 @@ static struct Other {
        GtkWidget *checkbtn_warnqueued;
         GtkWidget *checkbtn_cliplog;
         GtkWidget *loglength_entry;
+#if 0
 #ifdef USE_OPENSSL
        GtkWidget *checkbtn_ssl_ask_unknown_valid;
 #endif
+#endif
+
 } other;
 
 static struct MessageColorButtons {
@@ -801,10 +804,12 @@ static PrefParam param[] = {
        {"warn_queued_on_exit", "TRUE", &prefs_common.warn_queued_on_exit,
         P_BOOL, &other.checkbtn_warnqueued,
         prefs_set_data_from_toggle, prefs_set_toggle},
+#if 0
 #ifdef USE_OPENSSL
        {"ssl_ask_unknown_valid", "TRUE", &prefs_common.ssl_ask_unknown_valid,
         P_BOOL, &other.checkbtn_ssl_ask_unknown_valid,
         prefs_set_data_from_toggle, prefs_set_toggle},
+#endif
 #endif
        {"work_offline", "FALSE", &prefs_common.work_offline, P_BOOL,
         NULL, NULL, NULL},
@@ -2849,11 +2854,13 @@ static void prefs_other_create(void)
        GtkWidget *checkbtn_cleanonexit;
        GtkWidget *checkbtn_askonclean;
        GtkWidget *checkbtn_warnqueued;
+#if 0
 #ifdef USE_OPENSSL
        GtkWidget *frame_ssl;
        GtkWidget *vbox_ssl;
        GtkWidget *hbox_ssl;
        GtkWidget *checkbtn_ssl_ask_unknown_valid;
+#endif
 #endif
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -2963,6 +2970,7 @@ static void prefs_other_create(void)
                            FALSE, TRUE, 0);
        SET_TOGGLE_SENSITIVITY(checkbtn_cliplog, loglength_entry);
 
+#if 0
 #ifdef USE_OPENSSL
        /* SSL */
        PACK_FRAME (vbox1, frame_ssl, _("Security"));
@@ -2976,6 +2984,7 @@ static void prefs_other_create(void)
        hbox_ssl = gtk_hbox_new (FALSE, 3);
        gtk_container_add (GTK_CONTAINER (vbox_ssl), hbox_ssl);
        gtk_widget_show (hbox_ssl);
+#endif
 #endif
        
        /* On Exit */
@@ -3019,9 +3028,11 @@ static void prefs_other_create(void)
        other.checkbtn_askonclean  = checkbtn_askonclean;
        other.checkbtn_warnqueued  = checkbtn_warnqueued;
        
+#if 0
 #ifdef USE_OPENSSL
        other.checkbtn_ssl_ask_unknown_valid = checkbtn_ssl_ask_unknown_valid;
 #endif
+#endif
 }
 
 static void date_format_ok_btn_clicked(GtkButton *button, GtkWidget **widget)
index f693e0457be4688f082cb4cb6afc0a73401d4993..f83d97a73df66e0076c477416748a5182e7c7568 100644 (file)
@@ -255,8 +255,10 @@ struct _PrefsCommon
        gboolean clean_on_exit;
        gboolean ask_on_clean;
        gboolean warn_queued_on_exit;
+#if 0
 #ifdef USE_OPENSSL
        gboolean ssl_ask_unknown_valid;
+#endif
 #endif
        /* Memory cache*/
        gint cache_max_mem_usage;
index d44ca318f2d231a8b1443d569323531b64d93424..a3676ce140b0ef7fd47382e25ca852e967308243 100644 (file)
@@ -29,8 +29,8 @@
 #include "sslcertwindow.h"
 #include "utils.h"
 #include "intl.h"
-#include "prefs_common.h"
 #include "log.h"
+#include "socket.h"
 
 static SSLCertificate *ssl_certificate_new_lookup(X509 *x509_cert, gchar *host, gushort port, gboolean lookup);
 
@@ -349,6 +349,7 @@ gboolean ssl_certificate_check (X509 *x509_cert, gchar *host, gushort port)
                
                sig_status = ssl_certificate_check_signer(x509_cert);
 
+#if 0 /* disabled pref for now */
                if (sig_status == NULL && !prefs_common.ssl_ask_unknown_valid) {
                        /* trust and accept silently if hostnames match */
                        char *buf; /* don't free buf ! */
@@ -361,7 +362,7 @@ gboolean ssl_certificate_check (X509 *x509_cert, gchar *host, gushort port)
                                        return TRUE;            
                                }
                }
-
+#endif
                g_free(sig_status);
 
                cur_cert_str = ssl_certificate_to_string(current_cert);
@@ -371,6 +372,7 @@ gboolean ssl_certificate_check (X509 *x509_cert, gchar *host, gushort port)
                                          cur_cert_str);
                g_free (cur_cert_str);
 
+#if 0 /* disabled for now */
                if (prefs_common.no_recv_err_panel) {
                        log_error(_("%s\n\nMail won't be retrieved on this account until you save the certificate.\n(Uncheck the \"%s\" preference).\n"),
                                        err_msg,
@@ -378,7 +380,7 @@ gboolean ssl_certificate_check (X509 *x509_cert, gchar *host, gushort port)
                        g_free(err_msg);
                        return FALSE;
                }
-               
+#endif
                /* FIXME: replace this with a hook, then uncomment the check in ssl.c */ 
                val = sslcertwindow_ask_new_cert(current_cert);
                g_free(err_msg);
@@ -405,6 +407,7 @@ gboolean ssl_certificate_check (X509 *x509_cert, gchar *host, gushort port)
                g_free (cur_cert_str);
                g_free (known_cert_str);
 
+#if 0
                if (prefs_common.no_recv_err_panel) {
                        log_error(_("%s\n\nMail won't be retrieved on this account until you save the certificate.\n(Uncheck the \"%s\" preference).\n"),
                                        err_msg,
@@ -412,7 +415,8 @@ gboolean ssl_certificate_check (X509 *x509_cert, gchar *host, gushort port)
                        g_free(err_msg);
                        return FALSE;
                }
-
+#endif
+               
                /* FIXME: replace this with a hook, then uncomment the check in ssl.c */ 
                val = sslcertwindow_ask_changed_cert(known_cert, current_cert);
                g_free(err_msg);
index fbcd5e2b61d3f8fcabc528aeff66b715d11e50ad..ee837b992369d2690766a9f674fd3c98db7601a7 100644 (file)
@@ -25,6 +25,7 @@
 #endif
 
 #include <glib.h>
+#include "gtkstext.h"
 
 #include <string.h> /* for strlen */
 #include <stdlib.h> /* for mbstowcs */