From a0c093ed244b8187e8f1eed40ed3598493468741 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Thu, 27 Sep 2001 22:32:11 +0000 Subject: CRLF decode the stream before parsing it into a MIME part. This fixes bug 2001-09-27 Jeffrey Stedfast * camel-pgp-mime.c (camel_pgp_mime_part_decrypt): CRLF decode the stream before parsing it into a MIME part. This fixes bug #10521. * camel-store.c: Remove the old folder from the vTrash folder. svn path=/trunk/; revision=13199 --- camel/ChangeLog | 7 +++++++ camel/camel-pgp-mime.c | 16 +++++++++++++++- camel/camel-store.c | 15 +++++++++++++-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 3c0abde3f2..ce3b17a206 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,10 @@ +2001-09-27 Jeffrey Stedfast + + * camel-pgp-mime.c (camel_pgp_mime_part_decrypt): CRLF decode the + stream before parsing it into a MIME part. This fixes bug #10521. + + * camel-store.c: Remove the old folder from the vTrash folder. + 2001-09-27 Dan Winship * camel-service.c: Change "gboolean connected" to diff --git a/camel/camel-pgp-mime.c b/camel/camel-pgp-mime.c index 149e1baf3b..fb17256528 100644 --- a/camel/camel-pgp-mime.c +++ b/camel/camel-pgp-mime.c @@ -31,11 +31,14 @@ #include "camel-mime-filter-crlf.h" #include "camel-stream-filter.h" #include "camel-stream-mem.h" +#include "camel-stream-fs.h" #include #include #include +#define PGPMIME_DEBUG + #define d(x) x /** rfc2015 stuff (aka PGP/MIME) *******************************/ @@ -495,6 +498,8 @@ camel_pgp_mime_part_decrypt (CamelPgpContext *context, CamelMimePart *mime_part, CamelMimePart *encrypted_part, *part; CamelContentType *mime_type; CamelStream *stream, *ciphertext; + CamelStreamFilter *filtered_stream; + CamelMimeFilter *crlf_filter; g_return_val_if_fail (mime_part != NULL, NULL); g_return_val_if_fail (CAMEL_IS_MIME_PART (mime_part), NULL); @@ -530,8 +535,17 @@ camel_pgp_mime_part_decrypt (CamelPgpContext *context, CamelMimePart *mime_part, /* construct the new decrypted mime part from the stream */ part = camel_mime_part_new (); - camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (part), stream); + + crlf_filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_DECODE, + CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY); + filtered_stream = camel_stream_filter_new_with_stream (stream); camel_object_unref (CAMEL_OBJECT (stream)); + camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlf_filter)); + camel_object_unref (CAMEL_OBJECT (crlf_filter)); + + camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (part), CAMEL_STREAM (filtered_stream)); + + camel_object_unref (CAMEL_OBJECT (filtered_stream)); return part; } diff --git a/camel/camel-store.c b/camel/camel-store.c index 4c70ae9981..31b410604e 100644 --- a/camel/camel-store.c +++ b/camel/camel-store.c @@ -333,9 +333,11 @@ camel_store_delete_folder (CamelStore *store, const char *folder_name, CamelExce if (g_hash_table_lookup_extended(store->folders, folder_name, (void **)&key, (void **)&folder)) { g_hash_table_remove(store->folders, key); g_free(key); + camel_object_ref (CAMEL_OBJECT (folder)); CAMEL_STORE_UNLOCK(store, cache_lock); if (store->vtrash) camel_vee_folder_remove_folder((CamelVeeFolder *)store->vtrash, folder); + camel_object_unref (CAMEL_OBJECT (folder)); } else { CAMEL_STORE_UNLOCK(store, cache_lock); } @@ -373,14 +375,23 @@ camel_store_rename_folder (CamelStore *store, const char *old_name, const char * CAMEL_STORE_LOCK(store, folder_lock); CS_CLASS (store)->rename_folder (store, old_name, new_name, ex); - + /* remove the old name from the cache if it is there */ CAMEL_STORE_LOCK(store, cache_lock); if (g_hash_table_lookup_extended(store->folders, old_name, (void **)&key, (void **)&folder)) { g_hash_table_remove(store->folders, key); g_free(key); + + camel_object_ref (CAMEL_OBJECT (folder)); + + CAMEL_STORE_UNLOCK(store, cache_lock); + + if (store->vtrash) + camel_vee_folder_remove_folder (CAMEL_VEE_FOLDER (store->vtrash), folder); + camel_object_unref (CAMEL_OBJECT (folder)); + } else { + CAMEL_STORE_UNLOCK(store, cache_lock); } - CAMEL_STORE_UNLOCK(store, cache_lock); CAMEL_STORE_UNLOCK(store, folder_lock); } -- cgit