From d15cdfc929687f1c37939e78a08c30e4e4b636de Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 19 May 2004 07:06:10 +0000 Subject: use the article number instead of the messageid. Some servers are just 2004-05-19 Not Zed * providers/nntp/camel-nntp-folder.c (nntp_folder_get_message): use the article number instead of the messageid. Some servers are just broken. (nntp_folder_cache_message): same. See #58655. * camel-smime-context.c (sm_verify_cmsg): import the certs as UsageEmailRecipient as well as signer, and also save the certs always. svn path=/trunk/; revision=25975 --- camel/ChangeLog | 9 +++++++++ camel/camel-smime-context.c | 12 ++++++++---- camel/providers/nntp/camel-nntp-folder.c | 27 ++++++++++++++++----------- 3 files changed, 33 insertions(+), 15 deletions(-) (limited to 'camel') diff --git a/camel/ChangeLog b/camel/ChangeLog index 2aacd3d40b..d2af643192 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,14 @@ 2004-05-19 Not Zed + * providers/nntp/camel-nntp-folder.c (nntp_folder_get_message): + use the article number instead of the messageid. Some servers are + just broken. + (nntp_folder_cache_message): same. See #58655. + + * camel-smime-context.c (sm_verify_cmsg): import the certs as + UsageEmailRecipient as well as signer, and also save the certs + always. + ** See #58641. * camel-vee-folder.c (vee_sync): don't rebuild auto-type vfolders. diff --git a/camel/camel-smime-context.c b/camel/camel-smime-context.c index f18fa4fd21..f087ccdb05 100644 --- a/camel/camel-smime-context.c +++ b/camel/camel-smime-context.c @@ -609,8 +609,13 @@ sm_verify_cmsg(CamelCipherContext *context, NSSCMSMessage *cmsg, CamelStream *ex poolp = NULL; } - /* import the certificates */ - if (NSS_CMSSignedData_ImportCerts(sigd, p->certdb, certUsageEmailSigner, PR_FALSE) != SECSuccess) { + /* import all certificates present */ + if (NSS_CMSSignedData_ImportCerts(sigd, p->certdb, certUsageEmailSigner, PR_TRUE) != SECSuccess) { + camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Certificate import failed")); + goto fail; + } + + if (NSS_CMSSignedData_ImportCerts(sigd, p->certdb, certUsageEmailRecipient, PR_TRUE) != SECSuccess) { camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM, _("Certificate import failed")); goto fail; } @@ -618,8 +623,7 @@ sm_verify_cmsg(CamelCipherContext *context, NSSCMSMessage *cmsg, CamelStream *ex /* check for certs-only message */ nsigners = NSS_CMSSignedData_SignerInfoCount(sigd); if (nsigners == 0) { - /* ?? Should we check other usages? */ - NSS_CMSSignedData_ImportCerts(sigd, p->certdb, certUsageEmailSigner, PR_TRUE); + /* already imported certs above, not sure what usage we should use here or if this isn't handled above */ if (NSS_CMSSignedData_VerifyCertsOnly(sigd, p->certdb, certUsageEmailSigner) != SECSuccess) { g_string_printf(description, _("Certificate only message, cannot verify certificates")); } else { diff --git a/camel/providers/nntp/camel-nntp-folder.c b/camel/providers/nntp/camel-nntp-folder.c index 4762cf974a..3c8b248a7b 100644 --- a/camel/providers/nntp/camel-nntp-folder.c +++ b/camel/providers/nntp/camel-nntp-folder.c @@ -178,18 +178,21 @@ nntp_folder_cache_message (CamelDiscoFolder *disco_folder, const char *uid, Came { CamelNNTPStore *nntp_store = (CamelNNTPStore *)((CamelFolder *) disco_folder)->parent_store; CamelStream *stream; - const char *msgid; - - if (!(msgid = strchr (uid, ','))) { + char *article, *msgid; + + article = alloca(strlen(uid)+1); + strcpy(article, uid); + msgid = strchr(uid, ','); + if (!msgid) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Internal error: uid in invalid format: %s"), uid); return; } - msgid++; + *msgid++ = 0; CAMEL_NNTP_STORE_LOCK(nntp_store, command_lock); - stream = nntp_folder_download_message ((CamelNNTPFolder *) disco_folder, msgid, ex); + stream = nntp_folder_download_message ((CamelNNTPFolder *) disco_folder, article, ex); if (stream) { camel_object_unref (stream); } else { @@ -210,20 +213,22 @@ nntp_folder_get_message (CamelFolder *folder, const char *uid, CamelException *e CamelNNTPFolder *nntp_folder; CamelStream *stream = NULL; char *line = NULL; - const char *msgid; - + char *article, *msgid; + nntp_store = (CamelNNTPStore *) folder->parent_store; nntp_folder = (CamelNNTPFolder *) folder; CAMEL_NNTP_STORE_LOCK(nntp_store, command_lock); - + + article = alloca(strlen(uid)+1); + strcpy(article, uid); msgid = strchr (uid, ','); if (msgid == NULL) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, _("Internal error: uid in invalid format: %s"), uid); goto fail; } - msgid++; + *msgid++ = 0; /* Lookup in cache, NEWS is global messageid's so use a global cache path */ stream = camel_data_cache_get (nntp_store->cache, "cache", msgid, NULL); @@ -233,8 +238,8 @@ nntp_folder_get_message (CamelFolder *folder, const char *uid, CamelException *e _("This message is not currently available")); goto fail; } - - stream = nntp_folder_download_message (nntp_folder, msgid, ex); + + stream = nntp_folder_download_message (nntp_folder, article, ex); if (stream == NULL) goto fail; } -- cgit v1.2.3