2005-09-26 [colin] 1.9.14cvs53
authorColin Leroy <colin@colino.net>
Mon, 26 Sep 2005 16:53:03 +0000 (16:53 +0000)
committerColin Leroy <colin@colino.net>
Mon, 26 Sep 2005 16:53:03 +0000 (16:53 +0000)
* src/imap.c
log_error instead of alertpanel according to the pref
* src/etpan/imap-thread.c
Print connect status, copy only necessary size to
logger
* src/plugins/pgpmime/pgpmime.c
Handle S/Mime signatures (verification only). Patch based
on a patch for Sylpheed Main by Thomas White <taw27@cam.ac.uk>

ChangeLog-gtk2.claws
PATCHSETS
configure.ac
src/etpan/imap-thread.c
src/imap.c
src/plugins/pgpmime/pgpmime.c

index de87c0b6d3e9a616f685227873ce5d48c612ab3f..d36ac29bfc692b532a7e9342b6655081cc8c7d9b 100644 (file)
@@ -1,3 +1,14 @@
+2005-09-26 [colin]     1.9.14cvs53
+
+       * src/imap.c
+               log_error instead of alertpanel according to the pref
+       * src/etpan/imap-thread.c
+               Print connect status, copy only necessary size to 
+               logger
+       * src/plugins/pgpmime/pgpmime.c
+               Handle S/Mime signatures (verification only). Patch based
+               on a patch for Sylpheed Main by Thomas White <taw27@cam.ac.uk>
+
 2005-09-26 [paul]      1.9.14cvs52
 
        * src/common/passcrypt.c
index 3e52b4a6ba7c51068671845cd84a37a40d8871c3..c2f92618cb107f4b096bad28fc53aad30da5b343 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.150.2.46 -r 1.150.2.47 src/procmsg.c;  ) > 1.9.14cvs50.patchset
 ( cvs diff -u -r 1.395.2.127 -r 1.395.2.128 src/summaryview.c;  cvs diff -u -r 1.3.2.1 -r 1.3.2.2 src/common/passcrypt.c;  ) > 1.9.14cvs51.patchset
 ( cvs diff -u -r 1.3.2.2 -r 1.3.2.3 src/common/passcrypt.c;  ) > 1.9.14cvs52.patchset
+( cvs diff -u -r 1.179.2.72 -r 1.179.2.73 src/imap.c;  cvs diff -u -r 1.1.4.20 -r 1.1.4.21 src/etpan/imap-thread.c;  cvs diff -u -r 1.1.2.24 -r 1.1.2.25 src/plugins/pgpmime/pgpmime.c;  ) > 1.9.14cvs53.patchset
index b80c20abe87fb37d86cecba54e5b3ffe13e9bec4..cfd2d6d82c5b161358a6468a853169b69449c9df 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=9
 MICRO_VERSION=14
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=52
+EXTRA_VERSION=53
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 43868a03986b7bba614c88ca7c8235628fde22f8..f53cd2df56fd6e0a277612cb6a2f369c04d9feb8 100644 (file)
@@ -42,7 +42,7 @@ static gboolean thread_manager_event(GIOChannel * source,
 void imap_logger(int direction, const char * str, size_t size) 
 {
        gchar buf[512];
-       strncpy(buf, str, 511);
+       strncpy(buf, str, size > 510 ? 510:size);
        buf[511] = '\0';
        if (size < 511)
                buf[size] = '\0';
@@ -320,7 +320,7 @@ int imap_threaded_connect_ssl(Folder * folder, const char * server, int port)
        
        threaded_run(folder, &param, &result, connect_ssl_run);
        
-       debug_print("connect ok\n");
+       debug_print("connect %d\n", result.error);
        
        return result.error;
 }
index 0d578dfd0f560f45cfaeba757a611bcdd5cbf150..85ad190c79d466dfdac64731a4ec6f448f66df37 100644 (file)
@@ -607,8 +607,15 @@ static gint imap_auth(IMAPSession *session, const gchar *user, const gchar *pass
                }
                
                if (time(NULL) - last_login_err > 10) {
-                       alertpanel_error(_("Connection to %s failed: login refused.%s"),
+                       if (!prefs_common.no_recv_err_panel) {
+                               alertpanel_error(_("Connection to %s failed: "
+                                       "login refused.%s"),
                                        SESSION(session)->server, ext_info);
+                       } else {
+                               log_error(_("Connection to %s failed: "
+                                       "login refused.%s\n"),
+                                       SESSION(session)->server, ext_info);
+                       }
                }
                last_login_err = time(NULL);
        }
@@ -777,7 +784,7 @@ static IMAPSession *imap_session_new(Folder * folder,
                        alertpanel_error(_("Can't connect to IMAP4 server: %s:%d"),
                                         account->recv_server, port);
                } else {
-                       log_error(_("Can't connect to IMAP4 server: %s:%d"),
+                       log_error(_("Can't connect to IMAP4 server: %s:%d\n"),
                                         account->recv_server, port);
                } 
                
index c0c29220c9724ed997272f2b561214161a1deaf0..8241c8bf106a0fe9cb993db78bce88d722244693 100644 (file)
@@ -49,6 +49,7 @@ struct _PrivacyDataPGP
        gboolean        is_signed;
        gpgme_verify_result_t   sigstatus;
        gpgme_ctx_t     ctx;
+       gboolean        is_pkcs7;
 };
 
 static PrivacySystem pgpmime_system;
@@ -98,7 +99,10 @@ static gboolean pgpmime_is_signed(MimeInfo *mimeinfo)
            g_ascii_strcasecmp(parent->subtype, "signed"))
                return FALSE;
        protocol = procmime_mimeinfo_get_parameter(parent, "protocol");
-       if ((protocol == NULL) || g_ascii_strcasecmp(protocol, "application/pgp-signature"))
+       if ((protocol == NULL) || 
+           (g_ascii_strcasecmp(protocol, "application/pgp-signature") &&
+            g_ascii_strcasecmp(protocol, "application/pkcs7-signature") &&
+            g_ascii_strcasecmp(protocol, "application/x-pkcs7-signature")))
                return FALSE;
 
        /* check if mimeinfo is the first child */
@@ -111,13 +115,22 @@ static gboolean pgpmime_is_signed(MimeInfo *mimeinfo)
        if (signature == NULL)
                return FALSE;
        if ((signature->type != MIMETYPE_APPLICATION) ||
-           g_ascii_strcasecmp(signature->subtype, "pgp-signature"))
+           (g_ascii_strcasecmp(signature->subtype, "pgp-signature") &&
+            g_ascii_strcasecmp(signature->subtype, "pkcs7-signature") &&
+            g_ascii_strcasecmp(signature->subtype, "x-pkcs7-signature")))
                return FALSE;
 
        if (data == NULL) {
                data = pgpmime_new_privacydata();
                mimeinfo->privacy = (PrivacyData *) data;
        }
+       
+       if (!g_ascii_strcasecmp(signature->subtype, "pkcs7-signature") ||
+           !g_ascii_strcasecmp(signature->subtype, "x-pkcs7-signature"))
+               data->is_pkcs7 = TRUE;
+       else
+               data->is_pkcs7 = FALSE;
+
        data->done_sigtest = TRUE;
        data->is_signed = TRUE;
 
@@ -169,7 +182,17 @@ static gint pgpmime_check_signature(MimeInfo *mimeinfo)
        data = (PrivacyDataPGP *) mimeinfo->privacy;
        gpgme_new(&data->ctx);
        
-       debug_print("Checking PGP/MIME signature\n");
+       debug_print("Checking %s/MIME signature\n", data->is_pkcs7?"S":"PGP");
+
+       if (data->is_pkcs7) {
+               err = gpgme_set_protocol(data->ctx, GPGME_PROTOCOL_CMS);
+       } else
+               err = gpgme_set_protocol(data->ctx, GPGME_PROTOCOL_OpenPGP);
+
+       if (err) {
+               debug_print ("gpgme_set_protocol failed: %s\n",
+                   gpgme_strerror (err));
+       }
        parent = procmime_mimeinfo_parent(mimeinfo);
 
        fp = g_fopen(parent->data.filename, "rb");
@@ -189,6 +212,16 @@ static gint pgpmime_check_signature(MimeInfo *mimeinfo)
        signature = (MimeInfo *) mimeinfo->node->next->data;
        sigdata = sgpgme_data_from_mimeinfo(signature);
 
+       err = 0;
+       if (signature->encoding_type == ENC_BASE64) {
+               err = gpgme_data_set_encoding (sigdata, GPGME_DATA_ENCODING_BASE64);
+       }
+       
+       if (err) {
+               debug_print ("gpgme_data_set_encoding failed: %s\n",
+                       gpgme_strerror (err));
+       }
+
        data->sigstatus =
                sgpgme_verify_signature (data->ctx, sigdata, textdata, NULL);