[gmime: 2/5] Use the FormatOptions when verifying multipart/signed signatures
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime: 2/5] Use the FormatOptions when verifying multipart/signed signatures
- Date: Tue, 21 Mar 2017 11:58:28 +0000 (UTC)
commit 9227191cb48246829c348ed3cff2a0881bfe8835
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Tue Mar 21 07:30:32 2017 -0400
Use the FormatOptions when verifying multipart/signed signatures
gmime/gmime-header.c | 2 +-
gmime/gmime-multipart-signed.c | 16 +++++-----------
util/packed.c | 2 ++
3 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/gmime/gmime-header.c b/gmime/gmime-header.c
index f3522b5..9a36ce1 100644
--- a/gmime/gmime-header.c
+++ b/gmime/gmime-header.c
@@ -890,7 +890,7 @@ g_mime_header_list_write_to_stream (GMimeHeaderList *headers, GMimeFormatOptions
header = (GMimeHeader *) headers->array->pdata[i];
if (!g_mime_format_options_is_hidden_header (options, header->name)) {
- if ((nwritten = g_mime_header_write_to_stream (headers, header, options, stream)) ==
-1)
+ if ((nwritten = g_mime_header_write_to_stream (headers, header, options, filtered))
== -1)
return -1;
total += nwritten;
diff --git a/gmime/gmime-multipart-signed.c b/gmime/gmime-multipart-signed.c
index 7f87e39..196e33b 100644
--- a/gmime/gmime-multipart-signed.c
+++ b/gmime/gmime-multipart-signed.c
@@ -370,9 +370,9 @@ check_protocol_supported (const char *protocol, const char *supported)
GMimeSignatureList *
g_mime_multipart_signed_verify (GMimeMultipartSigned *mps, GMimeVerifyFlags flags, GError **err)
{
- GMimeStream *filtered, *stream, *sigstream;
const char *supported, *protocol;
GMimeObject *content, *signature;
+ GMimeStream *stream, *sigstream;
GMimeSignatureList *signatures;
GMimeFormatOptions *options;
GMimeDataWrapper *wrapper;
@@ -434,20 +434,14 @@ g_mime_multipart_signed_verify (GMimeMultipartSigned *mps, GMimeVerifyFlags flag
/* get the content stream */
stream = g_mime_stream_mem_new ();
- filtered = g_mime_stream_filter_new (stream);
/* Note: see rfc2015 or rfc3156, section 5.1 */
- filter = g_mime_filter_unix2dos_new (FALSE);
- g_mime_stream_filter_add ((GMimeStreamFilter *) filtered, filter);
- g_object_unref (filter);
- // FIXME: use the GMimeFormatOptions...
- //options = _g_mime_format_options_clone (NULL, FALSE);
- //g_mime_format_options_set_newline_format (options, GMIME_NEWLINE_FORMAT_DOS);
+ options = _g_mime_format_options_clone (NULL, FALSE);
+ g_mime_format_options_set_newline_format (options, GMIME_NEWLINE_FORMAT_DOS);
- g_mime_object_write_to_stream (content, NULL, filtered);
- //g_mime_format_options_free (options);
+ g_mime_object_write_to_stream (content, options, stream);
+ g_mime_format_options_free (options);
g_mime_stream_reset (stream);
- g_object_unref (filtered);
/* get the signature stream */
wrapper = g_mime_part_get_content ((GMimePart *) signature);
diff --git a/util/packed.c b/util/packed.c
index 187f26c..6d5bbff 100644
--- a/util/packed.c
+++ b/util/packed.c
@@ -36,6 +36,8 @@ packed_byte_array_new (void)
packed->allocated = 64;
packed->cur = -1;
packed->len = 0;
+
+ return packed;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]