2006-06-01 [colin] 2.2.0cvs71
authorColin Leroy <colin@colino.net>
Thu, 1 Jun 2006 17:14:34 +0000 (17:14 +0000)
committerColin Leroy <colin@colino.net>
Thu, 1 Jun 2006 17:14:34 +0000 (17:14 +0000)
* src/compose.c
Better guards against IMAP races
* src/main.c
* src/prefs_common.c
* src/prefs_common.h
* src/common/ssl_certificate.c
* src/etpan/imap-thread.c
* src/etpan/imap-thread.h
* src/gtk/sslcertwindow.c
New hidden option ssl_skip_cert_check to
avoid dups of bug #959 (libetpan linked
against gnutls and gnutls buggy on 64bit)
Present expired warning only once per
session/server.
* manual/advanced.xml
* manual/fr/advanced.xml
Document new option

13 files changed:
ChangeLog
PATCHSETS
configure.ac
manual/advanced.xml
manual/fr/advanced.xml
src/common/ssl_certificate.c
src/compose.c
src/etpan/imap-thread.c
src/etpan/imap-thread.h
src/gtk/sslcertwindow.c
src/main.c
src/prefs_common.c
src/prefs_common.h

index c9455baf188ffae528b3b3a582ba48f58273ea3c..93e2dc9d0f8953be396914eb6551e8a7d4183095 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+2006-06-01 [colin]     2.2.0cvs71
+
+       * src/compose.c
+               Better guards against IMAP races
+       * src/main.c
+       * src/prefs_common.c
+       * src/prefs_common.h
+       * src/common/ssl_certificate.c
+       * src/etpan/imap-thread.c
+       * src/etpan/imap-thread.h
+       * src/gtk/sslcertwindow.c
+               New hidden option ssl_skip_cert_check to 
+               avoid dups of bug #959 (libetpan linked
+               against gnutls and gnutls buggy on 64bit)
+               Present expired warning only once per
+               session/server.
+       * manual/advanced.xml
+       * manual/fr/advanced.xml
+               Document new option
+
 2006-06-01 [wwp]       2.2.0cvs70
 
        * src/messageview.c
index b6ec7b1847a091f1a3de601b54dc5db472d7ac9a..720f33b82ff69ffefb45c89f86b73f91f46d2cba 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.60.2.17 -r 1.60.2.18 src/filtering.c;  cvs diff -u -r 1.179.2.118 -r 1.179.2.119 src/imap.c;  cvs diff -u -r 1.149.2.49 -r 1.149.2.50 src/inc.c;  cvs diff -u -r 1.1.4.37 -r 1.1.4.38 src/etpan/imap-thread.c;  ) > 2.2.0cvs68.patchset
 ( cvs diff -u -r 1.9.2.13 -r 1.9.2.14 src/common/ssl.c;  ) > 2.2.0cvs69.patchset
 ( cvs diff -u -r 1.94.2.84 -r 1.94.2.85 src/messageview.c;  ) > 2.2.0cvs70.patchset
+( cvs diff -u -r 1.382.2.274 -r 1.382.2.275 src/compose.c;  cvs diff -u -r 1.115.2.87 -r 1.115.2.88 src/main.c;  cvs diff -u -r 1.204.2.86 -r 1.204.2.87 src/prefs_common.c;  cvs diff -u -r 1.103.2.49 -r 1.103.2.50 src/prefs_common.h;  cvs diff -u -r 1.4.2.9 -r 1.4.2.10 src/common/ssl_certificate.c;  cvs diff -u -r 1.1.4.38 -r 1.1.4.39 src/etpan/imap-thread.c;  cvs diff -u -r 1.1.4.9 -r 1.1.4.10 src/etpan/imap-thread.h;  cvs diff -u -r 1.9.2.11 -r 1.9.2.12 src/gtk/sslcertwindow.c;  cvs diff -u -r 1.1.2.18 -r 1.1.2.19 manual/advanced.xml;  cvs diff -u -r 1.1.2.9 -r 1.1.2.10 manual/fr/advanced.xml;  ) > 2.2.0cvs71.patchset
index 13481118e4b92538fa55bce28da73f43b5bfa2fa..4d8784211515aa40027658d94bc2111fb20f73a0 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=2
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=70
+EXTRA_VERSION=71
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index bf3f55de4f2281b110c6494e006586c48920e7b0..ea7ccce767454e4c0c3fa36c287c662485195be5 100644 (file)
            <varlistentry><term>log_error_color</term><term>log_in_color</term><term>log_msg_color</term><term>log_out_color</term><term>log_warn_color</term>
                        <listitem><para>colours used in log window</para></listitem>
            </varlistentry>
+           <varlistentry><term>skip_ssl_cert_check</term>
+                   <listitem><para>Disables the verification of SSL certificates</para></listitem>
+           </varlistentry>
            <varlistentry><term>statusbar_update_step</term>
                    <listitem><para>update stepping in progress bars</para></listitem>
            </varlistentry>
index 5d13ef8e1920cb4a40f6f0f848f7ccac654f0a7f..3b5ecbe49d53a9238c36799f4460d3fff7ee67e3 100644 (file)
            <varlistentry><term>log_error_color</term><term>log_in_color</term><term>log_msg_color</term><term>log_out_color</term><term>log_warn_color</term>
                        <listitem><para>Couleurs utilisées dans la fenêtre de traces</para></listitem>
            </varlistentry>
+           <varlistentry><term>skip_ssl_cert_check</term>
+                   <listitem><para>Permet de ne pas faire la vérification des certificats SSL</para></listitem>
+           </varlistentry>
            <varlistentry><term>statusbar_update_step</term>
                    <listitem><para>Étapes de progression lors de la mise à jour dans les barres de progression.</para></listitem>
            </varlistentry>
index 08ad0ef2a2fb9a0e27dcf5a1df7d898f24b3b1a3..b2d76c15f6cf0a578c9c9c1bed9e71a1d40b4587 100644 (file)
@@ -34,6 +34,8 @@
 #include "socket.h"
 #include "hooks.h"
 
+static GHashTable *warned_expired = NULL;
+
 static SSLCertificate *ssl_certificate_new_lookup(X509 *x509_cert, gchar *host, gushort port, gboolean lookup);
 
 /* from Courier */
@@ -410,6 +412,18 @@ gboolean ssl_certificate_check (X509 *x509_cert, gchar *host, gushort port)
                        return TRUE;
                }
        } else if (asn1toTime(X509_get_notAfter(current_cert->x509_cert)) < time(NULL)) {
+               gchar *tmp = g_strdup_printf("%s:%d", current_cert->host, current_cert->port);
+               
+               if (warned_expired == NULL)
+                       warned_expired = g_hash_table_new(g_str_hash, g_str_equal);
+               
+               if (g_hash_table_lookup(warned_expired, tmp)) {
+                       g_free(tmp);
+                       ssl_certificate_destroy(current_cert);
+                       ssl_certificate_destroy(known_cert);
+                       return TRUE;
+               }
+                       
                cert_hook_data.cert = current_cert;
                cert_hook_data.old_cert = NULL;
                cert_hook_data.expired = TRUE;
@@ -418,10 +432,12 @@ gboolean ssl_certificate_check (X509 *x509_cert, gchar *host, gushort port)
                hooks_invoke(SSLCERT_ASK_HOOKLIST, &cert_hook_data);
 
                if (!cert_hook_data.accept) {
+                       g_free(tmp);
                        ssl_certificate_destroy(current_cert);
                        ssl_certificate_destroy(known_cert);
                        return FALSE;
                } else {
+                       g_hash_table_insert(warned_expired, tmp, GINT_TO_POINTER(1));
                        ssl_certificate_destroy(current_cert);
                        ssl_certificate_destroy(known_cert);
                        return TRUE;
index e9d2cf620ee423ccbb96229f8699fa32b6cfca6b..a34eb738207eba557782afb623ce90b6e9c24b3e 100644 (file)
@@ -1259,21 +1259,17 @@ static Compose *compose_generic_reply(MsgInfo *msginfo, gboolean quote,
                reply_account = account;
 
        compose = compose_create(account, COMPOSE_REPLY, FALSE);
+
+       compose->updating = TRUE;
+
        ifactory = gtk_item_factory_from_widget(compose->menubar);
 
        menu_set_active(ifactory, "/Options/Remove references", FALSE);
        menu_set_sensitive(ifactory, "/Options/Remove references", TRUE);
 
-       compose->updating = TRUE;
        compose->replyinfo = procmsg_msginfo_get_full_info(msginfo);
        if (!compose->replyinfo)
                compose->replyinfo = procmsg_msginfo_copy(msginfo);
-       compose->updating = FALSE;
-
-       if (compose->deferred_destroy) {
-               compose_destroy(compose);
-               return NULL;
-       }
 
        compose_extract_original_charset(compose);
        
@@ -1343,6 +1339,14 @@ static Compose *compose_generic_reply(MsgInfo *msginfo, gboolean quote,
                
        compose->modified = FALSE;
        compose_set_title(compose);
+
+       compose->updating = FALSE;
+
+       if (compose->deferred_destroy) {
+               compose_destroy(compose);
+               return NULL;
+       }
+
        return compose;
 }
 
@@ -1377,12 +1381,6 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
        compose->fwdinfo = procmsg_msginfo_get_full_info(msginfo);
        if (!compose->fwdinfo)
                compose->fwdinfo = procmsg_msginfo_copy(msginfo);
-       compose->updating = FALSE;
-
-       if (compose->deferred_destroy) {
-               compose_destroy(compose);
-               return NULL;
-       }
 
        compose_extract_original_charset(compose);
 
@@ -1420,16 +1418,9 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
                gchar *qmark;
                MsgInfo *full_msginfo;
 
-               compose->updating = TRUE;
                full_msginfo = procmsg_msginfo_get_full_info(msginfo);
                if (!full_msginfo)
                        full_msginfo = procmsg_msginfo_copy(msginfo);
-               compose->updating = FALSE;
-
-               if (compose->deferred_destroy) {
-                       compose_destroy(compose);
-                       return NULL;
-               }
 
                if (prefs_common.fw_quotemark &&
                    *prefs_common.fw_quotemark)
@@ -1476,6 +1467,14 @@ Compose *compose_forward(PrefsAccount *account, MsgInfo *msginfo,
        
        compose->modified = FALSE;
        compose_set_title(compose);
+
+       compose->updating = FALSE;
+
+       if (compose->deferred_destroy) {
+               compose_destroy(compose);
+               return NULL;
+       }
+
         return compose;
 }
 
@@ -1515,20 +1514,16 @@ Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list)
 
        compose = compose_create(account, COMPOSE_FORWARD, FALSE);
 
+       compose->updating = TRUE;
+
        textview = GTK_TEXT_VIEW(compose->text);
        textbuf = gtk_text_view_get_buffer(textview);
        compose_create_tags(textview, compose);
        
        undo_block(compose->undostruct);
        for (msginfo = msginfo_list; msginfo != NULL; msginfo = msginfo->next) {
-               compose->updating = TRUE;
                msgfile = procmsg_get_message_file_path((MsgInfo *)msginfo->data);
-               compose->updating = FALSE;
-               if (compose->deferred_destroy) {
-                       compose_destroy(compose);
-                       g_free(msgfile);
-                       return NULL;
-               }
+
                if (!is_file_exist(msgfile))
                        g_warning("%s: file not exist\n", msgfile);
                else
@@ -1573,6 +1568,14 @@ Compose *compose_forward_multiple(PrefsAccount *account, GSList *msginfo_list)
        undo_unblock(compose->undostruct);
        compose->modified = FALSE;
        compose_set_title(compose);
+
+       compose->updating = FALSE;
+
+       if (compose->deferred_destroy) {
+               compose_destroy(compose);
+               return NULL;
+       }
+
        return compose;
 }
 
@@ -1706,6 +1709,9 @@ void compose_reedit(MsgInfo *msginfo)
        g_return_if_fail(account != NULL);
 
        compose = compose_create(account, COMPOSE_REEDIT, FALSE);
+       
+       compose->updating = TRUE;
+       
        if (privacy_system != NULL) {
                compose->privacy_system = privacy_system;
                compose_use_signing(compose, use_signing);
@@ -1715,14 +1721,7 @@ void compose_reedit(MsgInfo *msginfo)
                activate_privacy_system(compose, account, FALSE);
        }
 
-       compose->updating = TRUE;
        compose->targetinfo = procmsg_msginfo_copy(msginfo);
-       compose->updating = FALSE;
-       
-       if (compose->deferred_destroy) {
-               compose_destroy(compose);
-               return;
-       }
 
        compose_extract_original_charset(compose);
 
@@ -1749,6 +1748,8 @@ void compose_reedit(MsgInfo *msginfo)
        }
        
        if (compose_parse_header(compose, msginfo) < 0) {
+               compose->updating = FALSE;
+               compose_destroy(compose);
                return;
        }
        compose_reedit_set_entry(compose, msginfo);
@@ -1804,6 +1805,12 @@ void compose_reedit(MsgInfo *msginfo)
        }
        compose->modified = FALSE;
        compose_set_title(compose);
+
+       compose->updating = FALSE;
+
+       if (compose->deferred_destroy) {
+               compose_destroy(compose);
+       }
 }
 
 Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
@@ -1822,6 +1829,9 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
        g_return_val_if_fail(account != NULL, NULL);
 
        compose = compose_create(account, COMPOSE_REDIRECT, batch);
+
+       compose->updating = TRUE;
+
        ifactory = gtk_item_factory_from_widget(compose->menubar);
        compose_create_tags(GTK_TEXT_VIEW(compose->text), compose);
        compose->replyinfo = NULL;
@@ -1831,18 +1841,14 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
 
        gtk_widget_grab_focus(compose->header_last->entry);
 
-       compose->updating = TRUE;
        filename = procmsg_get_message_file_path(msginfo);
-       compose->updating = FALSE;
 
-       if (compose->deferred_destroy) {
+       if (filename == NULL) {
+               compose->updating = FALSE;
                compose_destroy(compose);
-               g_free(filename);
-               return NULL;
-       }
 
-       if (filename == NULL)
                return NULL;
+       }
 
        compose->redirect_filename = filename;
        
@@ -1901,7 +1907,14 @@ Compose *compose_redirect(PrefsAccount *account, MsgInfo *msginfo,
 
        compose->modified = FALSE;
        compose_set_title(compose);
-        return compose;
+       compose->updating = FALSE;
+
+       if (compose->deferred_destroy) {
+               compose_destroy(compose);
+               return NULL;
+       }
+       
+       return compose;
 }
 
 GList *compose_get_compose_list(void)
@@ -7718,7 +7731,7 @@ static gint compose_delete_cb(GtkWidget *widget, GdkEventAny *event,
        prefs_common.compose_x = x;
        prefs_common.compose_y = y;
 
-       if (compose->sending)
+       if (compose->sending || compose->updating)
                return TRUE;
        compose_close_cb(compose, 0, NULL);
        return TRUE;
index c12ea907cbd3d9099f8f26b3982c808d83c725b8..ff0b75a825a6db3a5b1ef38ad2fcd4552a1dfbe1 100644 (file)
@@ -106,11 +106,13 @@ void imap_logger_fetch(int direction, const char * str, size_t size)
 }
 
 #define ETPAN_DEFAULT_NETWORK_TIMEOUT 60
+static gboolean etpan_skip_ssl_cert_check = FALSE;
 
-void imap_main_init(void)
+void imap_main_init(gboolean skip_ssl_cert_check)
 {
        int fd_thread_manager;
        
+       etpan_skip_ssl_cert_check = skip_ssl_cert_check;
        mailstream_network_delay.tv_sec = ETPAN_DEFAULT_NETWORK_TIMEOUT;
        mailstream_network_delay.tv_usec = 0;
        
@@ -391,7 +393,7 @@ int imap_threaded_connect_ssl(Folder * folder, const char * server, int port)
        
        threaded_run(folder, &param, &result, connect_ssl_run);
        
-       if (result.error >= 0) {
+       if (result.error >= 0 && !etpan_skip_ssl_cert_check) {
                cert_len = mailstream_ssl_get_certificate(imap->imap_stream, &certificate);
                if (etpan_certificate_check(certificate, cert_len, &param) < 0)
                        return -1;
@@ -804,7 +806,7 @@ int imap_threaded_starttls(Folder * folder, const gchar *host, int port)
        
        debug_print("imap starttls - end\n");
        
-       if (result.error == 0) {
+       if (result.error == 0 && !etpan_skip_ssl_cert_check) {
                cert_len = mailstream_ssl_get_certificate(param.imap->imap_stream, &certificate);
                if (etpan_certificate_check(certificate, cert_len, &param) < 0)
                        result.error = MAILIMAP_ERROR_STREAM;
index 5f6ee4fd72a226dce3ca14f7960e839db2b7224a..882f1ec61c94a39dc4c816c429b245e7f904b5a7 100644 (file)
@@ -8,7 +8,7 @@
 #define IMAP_SET_MAX_COUNT 100
 
 void imap_main_set_timeout(int sec);
-void imap_main_init(void);
+void imap_main_init(gboolean skip_ssl_cert_check);
 void imap_main_done(void);
 
 void imap_init(Folder * folder);
index 386bca061b3fe6a83bd4f6dfe4ae46bb766cf386..b0571b9fc49f589a1d0d0a83d978517161153b20 100644 (file)
@@ -226,6 +226,10 @@ GtkWidget *cert_presenter(SSLCertificate *cert)
 static gboolean sslcert_ask_hook(gpointer source, gpointer data)
 {
        SSLCertHookData *hookdata = (SSLCertHookData *)source;
+
+       if (prefs_common.skip_ssl_cert_check)
+               return TRUE;
+
        if (hookdata == NULL) {
                return FALSE;
        }
index 057967c7d4070bce1931e812bec7506a695f13f9..47d86df9e1e7d231c9b10fdf3bb97d288ffcf059 100644 (file)
@@ -480,7 +480,7 @@ int main(int argc, char *argv[])
        main_window_popup(mainwin);
 
 #ifdef HAVE_LIBETPAN
-       imap_main_init();
+       imap_main_init(prefs_common.skip_ssl_cert_check);
 #endif 
        account_set_missing_folder();
        folder_set_missing_folders();
index cd656145335d81acd91c21edc48223d858d43566..57f52982a2da7f32fc0d30d44919231fb54fe19f 100644 (file)
@@ -766,6 +766,8 @@ static PrefParam param[] = {
         NULL, NULL, NULL},
        {"compose_no_markup", "FALSE", &prefs_common.compose_no_markup, P_BOOL,
         NULL, NULL, NULL},
+       {"skip_ssl_cert_check", "FALSE", &prefs_common.skip_ssl_cert_check, P_BOOL,
+        NULL, NULL, NULL},
 
        {NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
index c6015d2c212984cdc536715e435079c30af15d45..1838da456d5bb2c8e8bad427df4d46e8ad4045e8 100644 (file)
@@ -371,6 +371,7 @@ struct _PrefsCommon
 
        gint warn_dnd;
        gint broken_are_utf8;
+       gint skip_ssl_cert_check;
 };
 
 extern PrefsCommon prefs_common;