I could solve the strange problem using a strange approach.

I don't try to read the data through stdin in my binary anymore, but I save the stdin into a temporary file (in script, using dd) and then I start my binary with this file as an argument to read data from. Now the binary sees the whole data with headers, multipart correctly encoded in base64, and it can decode it. Probably, stdin data was not correctly sent to binary from script in case of base64 encoded data. I would like to understand - why? But the problem is solved now.

Peter


On 09/04/2024 20:47, Doug via dovecot wrote:
That looks like base64 encoding to me. Possibly your sieve script is parsing
the output and truncating the data before handing it off to base64.

Doug

-----Original Message-----
From: Peter via dovecot <dovecot@dovecot.org>
Sent: Tuesday, April 9, 2024 2:03 PM
To: dovecot@dovecot.org
Subject: Re: Strange problem with sieve

Thanks for the advise.

Yes, the mails are automatically created. Unfortunately, the software
that generates them are out of our control.

I supposed that it is a base64 code, but if I try to manually pass the
text into 'base64 -d' - nothing usable goes out (you can try yourself
with the first part of the mail I've posted). Maybe it is salted, but I
don't see how to decode it...

Peter


On 09/04/2024 16:15, Doug via dovecot wrote:
-----Original Message-----
From: Peter via dovecot <dovecot@dovecot.org>
Sent: Tuesday, April 9, 2024 5:18 AM
To: dovecot@dovecot.org
Subject: Strange problem with sieve

Hello,

I use Dovecot 2.3.20 on FreeBSD 13.2 (in jail) as a part of iRedMail
installation.

Some mailboxes are configured for automatic mails processing using
sieve
(execute :pipe) and a custom binary (started by script). The system was
configured and was working correctly during several weeks.

Since ~10 days the system starts to work strangely. _*/Some/*_ mails
cannot be decoded anymore. No changes at our side, no updates etc.

I dumped the content received by my binary, and it looks really
strange:
pOUc9Z33O0GbfzbW5Mrmi

3L4tTlvKfsD8wP+hc6vN1v1bv+Vx827kW+YX5n/Zxtl240erH4t+nNyeuL1zh92
O0p24nYKd

vbtcd1UVyBdkFwztDtrdsIexJ2/Pu71L914vnFdYto+0T7JvoCiwqGm/7v6d+78
U
Jxf3lHiU

1B9QO7D1wIeD3IO3S91K68rUy/LLPv/E/6m/3Le8oUK/ovAQ7lDWoaeHow6
3/8z8ubpStTK/

This is a start of one mail. No headers, no readable data.

I removed "discard;" from sieve script to put such mails in the
mailbox,
and the mails look normally:

Mime-Version:1.0
Content-Type:multipart/mixed; boundary="=-
/3n/zeVGlN5thgeL28RKiw=="
--=-/3n/zeVGlN5thgeL28RKiw==
Content-Type: multipart/alternative; boundary="=-
sE/MdvfJZlakBmrKkcdzCg=="

--=-sE/MdvfJZlakBmrKkcdzCg==
Content-Type: multipart/related; boundary="=-
cgJVnLNlzX5YuD6yaI5USQ=="
--=-cgJVnLNlzX5YuD6yaI5USQ==
Content-Transfer-Encoding: base64
Content-Type: text/html; charset=utf-8

etc.

Really, I have no idea about any direction to explore. The server is
totally under my control, I can do anything, but I have no idea how to
debug this situation.

I tried to redirect such mails to another mailbox and process them
there, but I get the same strange data. If I connect Thunderbird to the
mailbox - I can read the mails correctly. So, the problem arrives at
the
moment when the sieve system is invoked - the mail data is corrupted
somehow.

Any advise will be really appreciated.

Peter
RE:
--=-cgJVnLNlzX5YuD6yaI5USQ==
Content-Transfer-Encoding: base64

What has changed is the body content of incoming emails is now base64
encoded. Because you are trying to process these messages with a script,
I'm
going to guess that the emails in question are automatically generated
somewhere. Go back to the process that is creating these emails and
disable
base64 encoding. Or, add a base64 decode step to the sieve execute script.
Doug

_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org
_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to