Mailing List Archive

Matching RFC 2047 encoded text
An unwanted message arrived to my mailbox with the following Subject:

Subject: =?UTF-8?B?VXMgY29uZ3Jlc3MgaGVhcmluZyBvZiBtYWFuIGFsc2FhbiBNb25leSBsYXVuZHJ5INmC?=
=?UTF-8?B?2LbZitipINin2YTZg9mI2YbYutis2LHYsyDZhNi62LPZitmEINin2YTYo9mF2YjYp9mEINmE2YTZhdmE?=
=?UTF-8?B?2YrYp9iv2YrYsSDZhdi52YYg2KfZhNi12KfZhti5?=

Try decoding it yourself if you dare ;-) I have a rule in my .forward
file (functioning as an Exim filter) which _should have_ matched the
ASCII part of the decoded material. That rule looks like

if $h_subject: matches ${readfile{$home/.spamey-subjects}{|}}

{...drop into seldom-read spambox...}

and I know it works with all the other, less exotic, lines in
~/.spamey-subjects. But it didn't in this case, so what happened? Note
that the expansion is "$h_subject:" and not any of its raw siblings, so
I believe it should in fact expand to the decoded form. Right? Also
the condition is "matches" and not "MATCHES", so case shouldn't matter.
Right? What else could it stop from working?

--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Matching RFC 2047 encoded text [ In reply to ]
> From: Ian Zimmerman

> An unwanted message arrived to my mailbox with the following Subject:
>
> Subject: =?UTF-8?B?VXMgY29uZ3Jlc3MgaGVhcmluZyBvZiBtYWFuIGFsc2FhbiBNb25leSBsYXVuZHJ5INmC?=
> =?UTF-8?B?2LbZitipINin2YTZg9mI2YbYutis2LHYsyDZhNi62LPZitmEINin2YTYo9mF2YjYp9mEINmE2YTZhdmE?=
> =?UTF-8?B?2YrYp9iv2YrYsSDZhdi52YYg2KfZhNi12KfZhti5?=
>
> Try decoding it yourself if you dare ;-)

> What else could it stop from working?

In the beginning of Exim config:

check_rfc2047_length = false


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Matching RFC 2047 encoded text [ In reply to ]
Am 17.04.19 um 14:30 schrieb Lena--- via Exim-users:
> =?UTF-8?B?VXMgY29uZ3Jlc3MgaGVhcmluZyBvZiBtYWFuIGFsc2FhbiBNb25leSBsYXVuZHJ5INmC?=
> =?UTF-8?B?2LbZitipINin2YTZg9mI2YbYutis2LHYsyDZhNi62LPZitmEINin2YTYo9mF2YjYp9mEINmE2YTZhdmE?=
> =?UTF-8?B?2YrYp9iv2YrYsSDZhdi52YYg2KfZhNi12KfZhti5?=
In Case you need such a tool:

http://dogmamix.com/MimeHeadersDecoder/


best regards,
Marius

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Matching RFC 2047 encoded text [ In reply to ]
Le 17/04/2019 à 14:47, Cyborg via Exim-users a écrit :
> In Case you need such a tool:
Or simply use Perl:

M="=?UTF-8?B?VXMgY29uZ3Jlc3MgaGVhcmluZyBvZiBtYWFuIGFsc2FhbiBNb25leSBsYXVuZHJ5INmC?=
       
=?UTF-8?B?2LbZitipINin2YTZg9mI2YbYutis2LHYsyDZhNi62LPZitmEINin2YTYo9mF2YjYp9mEINmE2YTZhdmE?=
        =?UTF-8?B?2YrYp9iv2YrYsSDZhdi52YYg2KfZhNi12KfZhti5?="
perl -C -MEncode -E "say decode('MIME-Header', '$M')"

Regards,
--
Mathieu

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Matching RFC 2047 encoded text [ In reply to ]
On 2019-04-17 16:50, Mathieu wrote:

> > In Case you need such a tool:
> Or simply use Perl:

Yeah. I knew perfectly well what the decoded text was; perhaps I didn't
make that clear enough. My problem was - and is - that the filter rule
didn't match, despite one of the alternatives in the regexp being
"money[[:space:]]+laundry".

--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Matching RFC 2047 encoded text [ In reply to ]
Ian Zimmerman via Exim-users <exim-users@exim.org> wrote:
[...]
> My problem was - and is - that the filter rule
> didn't match, despite one of the alternatives in the regexp being
> "money[[:space:]]+laundry".

I think Lena's reply explains this.

cu Andreas
--
`What a good friend you are to him, Dr. Maturin. His other friends are
so grateful to you.'
`I sew his ears on from time to time, sure'


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Matching RFC 2047 encoded text [ In reply to ]
On 2019-04-17 15:30, Lena--- wrote:

> check_rfc2047_length = false

Thanks, Lena.

If I leave it as true (the default), and $h_subject: turns out to
contain "=?UTF-8?B?", can I assume (not with certainty, but with a high
likelihood) the message violates the RFC?

--
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Matching RFC 2047 encoded text [ In reply to ]
> From: Ian Zimmerman

> > check_rfc2047_length = false
>
> Thanks, Lena.
>
> If I leave it as true (the default), and $h_subject: turns out to
> contain "=?UTF-8?B?", can I assume (not with certainty, but with a high
> likelihood) the message violates the RFC?

Yes, but filtering on that is fraught with false positives.


--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Matching RFC 2047 encoded text [ In reply to ]
On 2019-04-21, Ian Zimmerman via Exim-users <exim-users@exim.org> wrote:
> On 2019-04-17 15:30, Lena--- wrote:
>
>> check_rfc2047_length = false
>
> Thanks, Lena.
>
> If I leave it as true (the default), and $h_subject: turns out to
> contain "=?UTF-8?B?", can I assume (not with certainty, but with a high
> likelihood) the message violates the RFC?

yes, there is a small probability that the sender actually intended
"=?UTF-8?B?" to be presented to the recipient. in all other cases the
message does not meet the RFC. possibly you should also check for "=?UTF-8?P?" etc...

--
When I tried casting out nines I made a hash of it.

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/