Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:GA
dovecot22.16060
0006-lib-mail-Refactor-code-to-make-the-next-co...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0006-lib-mail-Refactor-code-to-make-the-next-commit-small.patch of Package dovecot22.16060
From 18a7a161c8dae6f630770a3cbab7374a0c3dd732 Mon Sep 17 00:00:00 2001 From: Timo Sirainen <timo.sirainen@dovecot.fi> Date: Tue, 9 Jan 2018 11:33:59 -0500 Subject: [PATCH 6/7] lib-mail: Refactor code to make the next commit smaller --- src/lib-mail/message-address.c | 4 ++-- src/lib-mail/message-id.c | 30 +++++++++++++----------------- src/lib-mail/message-parser.c | 5 ++--- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/src/lib-mail/message-address.c b/src/lib-mail/message-address.c index 88d638a..afeef88 100644 --- a/src/lib-mail/message-address.c +++ b/src/lib-mail/message-address.c @@ -400,9 +400,9 @@ message_address_parse_real(pool_t pool, const unsigned char *data, size_t size, if (rfc822_skip_lwsp(&ctx.parser) <= 0) { /* no addresses */ - return NULL; + } else { + (void)parse_address_list(&ctx, max_addresses); } - (void)parse_address_list(&ctx, max_addresses); return ctx.first_addr; } diff --git a/src/lib-mail/message-id.c b/src/lib-mail/message-id.c index d6aa357..772535b 100644 --- a/src/lib-mail/message-id.c +++ b/src/lib-mail/message-id.c @@ -9,6 +9,7 @@ static bool get_untokenized_msgid(const char **msgid_p, string_t *msgid) { struct rfc822_parser_context parser; int ret; + bool success = FALSE; rfc822_parser_init(&parser, (const unsigned char *)*msgid_p, strlen(*msgid_p), NULL); @@ -27,23 +28,18 @@ static bool get_untokenized_msgid(const char **msgid_p, string_t *msgid) ret = rfc822_parse_quoted_string(&parser, msgid); else ret = rfc822_parse_dot_atom(&parser, msgid); - if (ret <= 0) - return FALSE; - - if (*parser.data != '@') - return FALSE; - str_append_c(msgid, '@'); - parser.data++; - rfc822_skip_lwsp(&parser); - - if (rfc822_parse_dot_atom(&parser, msgid) <= 0) - return FALSE; - - if (*parser.data != '>') - return FALSE; - - *msgid_p = (const char *)parser.data + 1; - return TRUE; + if (ret > 0 && *parser.data == '@') { + str_append_c(msgid, '@'); + parser.data++; + rfc822_skip_lwsp(&parser); + + if (rfc822_parse_dot_atom(&parser, msgid) > 0 && + *parser.data == '>') { + *msgid_p = (const char *)parser.data + 1; + success = TRUE; + } + } + return success; } static void strip_lwsp(char *str) diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c index 8caf7d8..b95448a 100644 --- a/src/lib-mail/message-parser.c +++ b/src/lib-mail/message-parser.c @@ -499,9 +499,8 @@ static void parse_content_type(struct message_parser_ctx *ctx, ctx->part->flags |= MESSAGE_PART_FLAG_MULTIPART_DIGEST; } - if (ret < 0) - return; - if ((ctx->part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0 || + if (ret < 0 || + (ctx->part->flags & MESSAGE_PART_FLAG_MULTIPART) == 0 || ctx->last_boundary != NULL) return; -- 2.1.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor