From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2A2A1431FBC for ; Mon, 3 Feb 2014 11:52:44 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EungCdJOoANT for ; Mon, 3 Feb 2014 11:52:40 -0800 (PST) Received: from mail-ee0-f47.google.com (mail-ee0-f47.google.com [74.125.83.47]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D6195431FAF for ; Mon, 3 Feb 2014 11:52:09 -0800 (PST) Received: by mail-ee0-f47.google.com with SMTP id d49so3828953eek.20 for ; Mon, 03 Feb 2014 11:52:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=JKL4q0NcwwMW+X4vuzPJGyeaaLNVo8HvF2YsNXxwPfo=; b=CkK/AKGJvLOCLIDu6eHMUe8K+YIzC2e0NoBRdfdy5bceqdUYp6vMa6hgSIlp0caeA6 KBPYZLVdtoaFNy9RsQFthcYU5izSxrIueCB10LZqjHpy/JQjT+H41EqfW2QEZUnVqPTF FZC0pMBb/JdPTk9IY6ptkDoJFHGexYQNOpLmK+aROT2rBlXiYAggjX8WKkIqp1X0N189 wDfs4Vh2z6mK+THIHCOLePrxS2Ej50VwWuQ9ate129iMtbSM91lP4A025FHqGRyMRgBm zKgwelsOfe/y2ZCYK3IF204juOwsWzBuKH5hTv8B/f22ZyLpewCq77XRmNYeEZZMxU3O wx5w== X-Gm-Message-State: ALoCoQll34WFVhBR1S/vKdrf3GkdqyN5CZJUetKRPjQe+1O5bODGTA02z1jaAwg+2gD7Qda9DDh5 X-Received: by 10.15.61.7 with SMTP id h7mr10466550eex.49.1391457128563; Mon, 03 Feb 2014 11:52:08 -0800 (PST) Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. [88.195.111.91]) by mx.google.com with ESMTPSA id m1sm78836622een.7.2014.02.03.11.52.06 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 03 Feb 2014 11:52:07 -0800 (PST) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH v3 4/6] cli: sanitize the received header before scanning for replies Date: Mon, 3 Feb 2014 21:51:44 +0200 Message-Id: X-Mailer: git-send-email 1.8.5.2 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Feb 2014 19:52:44 -0000 This makes the from guessing agnostic to header folding by spaces or tabs. --- notmuch-reply.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/notmuch-reply.c b/notmuch-reply.c index 47993d2..3f7021e 100644 --- a/notmuch-reply.c +++ b/notmuch-reply.c @@ -21,6 +21,7 @@ */ #include "notmuch-client.h" +#include "string-util.h" #include "sprinter.h" static void @@ -465,14 +466,21 @@ guess_from_in_received_headers (notmuch_config_t *config, notmuch_message_t *message) { const char *received, *addr; + char *sanitized; received = notmuch_message_get_header (message, "received"); if (! received) return NULL; - addr = guess_from_in_received_for (config, received); + sanitized = sanitize_string (config, received); + if (! sanitized) + return NULL; + + addr = guess_from_in_received_for (config, sanitized); if (! addr) - addr = guess_from_in_received_by (config, received); + addr = guess_from_in_received_by (config, sanitized); + + talloc_free (sanitized); return addr; } -- 1.8.5.2