diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-01-24 05:14:47 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-01-24 05:14:47 +0800 |
commit | 62a7c2c37017f209e2d9be12cf5ce19c16cb91d2 (patch) | |
tree | d135df45fc0b8c2b3f5136489bf04fee53b761dd | |
parent | 4b207455eeec18dbaf3c6c448eb6d2d5d09d9490 (diff) | |
download | gsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.tar.gz gsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.tar.zst gsoc2013-evolution-62a7c2c37017f209e2d9be12cf5ce19c16cb91d2.zip |
A few minor tweaks.
2001-01-23 Jeffrey Stedfast <fejj@ximian.com>
* openpgp-utils.c:
* mail-crypto.c: A few minor tweaks.
svn path=/trunk/; revision=7755
-rw-r--r-- | mail/ChangeLog | 5 | ||||
-rw-r--r-- | mail/mail-crypto.c | 29 | ||||
-rw-r--r-- | mail/openpgp-utils.c | 4 |
3 files changed, 24 insertions, 14 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 583fbe98ba..374c06e971 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,8 @@ +2001-01-23 Jeffrey Stedfast <fejj@ximian.com> + + * openpgp-utils.c: + * mail-crypto.c: A few minor tweaks. + 2001-01-23 Not Zed <NotZed@Ximian.com> * message-list.c (build_tree): Try turning off the BROKEN_ETREE diff --git a/mail/mail-crypto.c b/mail/mail-crypto.c index b343e8cda8..7d7369c488 100644 --- a/mail/mail-crypto.c +++ b/mail/mail-crypto.c @@ -259,9 +259,10 @@ pgp_mime_part_verify (CamelMimePart *mime_part, CamelException *ex) CamelMimePart *part, *sigpart; CamelStreamFilter *filtered_stream; CamelMimeFilter *crlf_filter; + CamelStream *stream; + GByteArray *content, *signature; gboolean valid = FALSE; - CamelStreamMem *sigstream, *cstream; - + g_return_val_if_fail (mime_part != NULL, FALSE); g_return_val_if_fail (CAMEL_IS_MIME_PART (mime_part), FALSE); @@ -273,25 +274,31 @@ pgp_mime_part_verify (CamelMimePart *mime_part, CamelException *ex) /* get the plain part */ part = camel_multipart_get_part (multipart, 0); - cstream = (CamelStreamMem *)camel_stream_mem_new (); + content = g_byte_array_new (); + stream = camel_stream_mem_new (); + camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), content); crlf_filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_ENCODE, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY); - filtered_stream = camel_stream_filter_new_with_stream ((CamelStream *)cstream); + filtered_stream = camel_stream_filter_new_with_stream (stream); camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlf_filter)); camel_object_unref (CAMEL_OBJECT (crlf_filter)); camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (part), CAMEL_STREAM (filtered_stream)); camel_object_unref (CAMEL_OBJECT (filtered_stream)); + camel_object_unref (CAMEL_OBJECT (stream)); /* get the signed part */ sigpart = camel_multipart_get_part (multipart, 1); - sigstream = (CamelStreamMem *)camel_stream_mem_new (); - camel_data_wrapper_write_to_stream (camel_medium_get_content_object (CAMEL_MEDIUM (sigpart)), (CamelStream *)sigstream); + signature = g_byte_array_new (); + stream = camel_stream_mem_new (); + camel_stream_mem_set_byte_array (CAMEL_STREAM_MEM (stream), signature); + camel_data_wrapper_write_to_stream (camel_medium_get_content_object (CAMEL_MEDIUM (sigpart)), stream); + camel_object_unref (CAMEL_OBJECT (stream)); /* verify */ - valid = openpgp_verify (cstream->buffer->data, cstream->buffer->len, - sigstream->buffer->data, sigstream->buffer->len, ex); - - camel_object_unref (CAMEL_OBJECT (sigstream)); - camel_object_unref (CAMEL_OBJECT (cstream)); + valid = openpgp_verify (content->data, content->len, + signature->data, signature->len, ex); + + g_byte_array_free (content, TRUE); + g_byte_array_free (signature, TRUE); return valid; } diff --git a/mail/openpgp-utils.c b/mail/openpgp-utils.c index 43252a890a..8a1d66c783 100644 --- a/mail/openpgp-utils.c +++ b/mail/openpgp-utils.c @@ -1013,7 +1013,7 @@ swrite (const char *data, int len) char *template; int fd; - template = g_strdup ("/tmp/gmime-crypto-XXXXXX"); + template = g_strdup ("/tmp/evolution-pgp.XXXXXX"); fd = mkstemp (template); if (fd == -1) { g_free (template); @@ -1033,7 +1033,6 @@ openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, gint siglen, Ca char *cleartext = NULL; char *diagnostics = NULL; int passwd_fds[2]; - char passwd_fd[32]; char *sigfile = NULL; int retval, i, clearlen; gboolean valid = TRUE; @@ -1119,7 +1118,6 @@ openpgp_verify (const gchar *in, gint inlen, const gchar *sigin, gint siglen, Ca g_free (sigfile); } - /* FIXME: maybe we should always set an exception? */ if (retval != 0) { camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, "%s", diagnostics); |