ATTACHMENT_POINTER without attachment inserted in nested MIME attachments

Issue #1194 closed
Jörn Stein created an issue

While exporting emails from an 1.3.0 piler installation I came across a few mails where attachments seemed to be missing. I found out that piler seemingly inserted an ATTACHMENT pointer where there was no attachment and also removed the last MIME boundary.

This is a (shortened) email that shows the problem before sending it to piler:

Return-Path: <mail_sender@t-online.de>
Delivered-To: recv@company.com
Received: from localhost (localhost [127.0.0.1])
    by hermes2.company.local (Postfix) with ESMTP id 8906224A05DB
    for <h.recv@company.com>; Fri, 16 Feb 2018 19:29:20 +0100 (CET)
Subject: Fwd: Request for offer
To: First Receiver <h.recv@company.com>
From: First Sender <mail_sender@t-online.de>
Message-ID: <4ee0d41a-50da-249e-13ab-eefbe25813a4@t-online.de>
Date: Fri, 16 Feb 2018 19:27:58 +0100
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101
 Thunderbird/52.4.0
MIME-Version: 1.0
Content-Type: multipart/mixed;
 boundary="------------99848263C7D110ECFFC188A5"

This is a multi-part message in MIME format.
--------------99848263C7D110ECFFC188A5
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit

Angebot für ....

Gruss First

--------------99848263C7D110ECFFC188A5
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Transfer-Encoding: base64
Content-Disposition: inline;
 filename="document.xlsx"

UEsDBBQABgAIAAAAIQDfz5sukgEAAJQGAAATANwBW0NvbnRlbnRfVHlwZXNdLnhtbCCi2AEo
AADc6AAAAAA=
--------------99848263C7D110ECFFC188A5
Content-Type: message/rfc822
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="Request for offer.eml"

Return-Path: <agency@gmail.com>
Received: from ...t-online.de ([172.20.27.2])
    by ....t-online.de (Dovecot) with LMTP id XNYwIgdVhlo7MQAAmrS6BA;
    Fri, 16 Feb 2018 04:50:31 +0100
MIME-Version: 1.0
From: foreign agency <agency@gmail.com>
Date: Fri, 16 Feb 2018 09:50:21 +0600
Message-ID: <CABMAVwk4x+0yGG+Jq5xP=fjFe-s8x2QxLR1hD6MjfONWv9CgmA@mail.gmail.com>
Subject: Request for offer
To: "Dr. First Sender" <mail_sender@t-online.de>, "First Receiver" <h.recv@company.com>
Content-Type: multipart/alternative; boundary="001a113b03ba6fca4b05654c3e50"

--001a113b03ba6fca4b05654c3e50
Content-Type: text/plain; charset="UTF-8"

Dear,
...
Regds.
H

--001a113b03ba6fca4b05654c3e50
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Dear,<div dir=3D"auto"><br></div><div dir=3D"auto=
">...<div dir=3D"auto"><br></div><div dir=3D"auto">Regds.</div><div d=
ir=3D"auto">H</div></div>

--001a113b03ba6fca4b05654c3e50--

--------------99848263C7D110ECFFC188A5--

I used pilerimport to import the EML file into piler. Afterwards I see the email in the database

select id,piler_id,subject from metadata where piler_id='5000000060f1511128e25cac0034904ff6ce';
+-------+--------------------------------------+------------------------+
| id    | piler_id                             | subject                |
+-------+--------------------------------------+------------------------+
| 33373 | 5000000060f1511128e25cac0034904ff6ce | Fwd: Request for offer |
+-------+--------------------------------------+------------------------+

The attachment table shows one attachment:

select * from v_attachment where piler_id='5000000060f1511128e25cac0034904ff6ce';
+-------+--------------------------------------+---------------+------+----------+
| i     | piler_id                             | attachment_id | ptr  | refcount |
+-------+--------------------------------------+---------------+------+----------+
| 18903 | 5000000060f1511128e25cac0034904ff6ce |             1 |    0 |        0 |
+-------+--------------------------------------+---------------+------+----------+

And it’s the XLSX document mentioned in the mail.

However, when I try to retrieve the email with pilerget, it has some differences to the original (only showing the end here):

diff san.eml san-piler.eml
147c147
< --001a113b03ba6fca4b05654c3e50
---
> ATTACHMENT_POINTER_5000000060f1511128e25cac0034904ff6ce.a2_XXX_PILER--001a113b03ba6fca4b05654c3e50

Needless to say that there is no attachment 2 in the database.

The issue was discovered in 1.3.0, but these examples were reproduced on a freshly installed1.3.11:

root@archive:/tmp# piler -V
piler 1.3.11, build 1001, Janos SUTO <sj@acts.hu>

Build Date: Wed Jul 7 08:36:11 UTC 2021
ldd version: ldd (Debian GLIBC 2.28-10) 2.28
gcc version: gcc version 8.3.0 (Debian 8.3.0-6)
OS: Linux archive 5.4.124-1-pve #1 SMP PVE 5.4.124-1 (Wed, 23 Jun 2021 13:47:09 +0200) x86_64 GNU/Linux
Configure command: ./configure --localstatedir=/var --with-database=mysql --enable-tcpwrappers --enable-memcached
MySQL client library version: 10.3.29
Extractors: /usr/bin/pdftotext /usr/bin/catdoc /usr/bin/catppt /usr/bin/xls2csv /usr/bin/unrtf /usr/bin/tnef libzip

I can provide the full email to reproduce this by mail.

Comments (3)

  1. Log in to comment