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>
This commit is contained in:
Colin Leroy 2005-09-26 16:53:03 +00:00
parent fbf945dc88
commit 4ca879bd76
6 changed files with 60 additions and 8 deletions

View 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

View file

@ -821,3 +821,4 @@
( 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

View 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=

View 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;
}

View 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);
}

View 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);