Re: [exim] raw mime_filename

Top Page
Delete this message
Reply to this message
Author: Mikhail Golub
Date:  
To: exim-users
Subject: Re: [exim] raw mime_filename
Exim version 4.95 #5 (FreeBSD 12.3) built 18-Oct-2022 13:42:33
Copyright (c) University of Cambridge, 1995 - 2018
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007
- 2020
Probably Berkeley DB version 1.8x (native mode)
Support for: crypteq iconv() use_setclassresources Expand_dlfunc OpenSSL
TLS_resume Content_Scanning DKIM DMARC PIPE_CONNECT
Experimental_Queue_Ramp SPF SRS TCP_Fast_Open Experimental_ARC
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm
dbmjz dbmnz dnsdb dsearch ldap ldapdn ldapm mysql passwd
Authenticators: plaintext
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/mbx autoreply pipe smtp


In exim config:
warn condition = ${if def:mime_filename}
     logwrite = TEST: $mime_filename



With this mime part (utf-8) all ok:

--------------hJ1w4fdd7nJgV1TgS95Plkir
Content-Type: text/plain; charset=UTF-8;
name="=?UTF-8?B?0L/QtdGA0LXQstGW0YDQutCw0ZfSkS50eHQ=?="
Content-Disposition: attachment;
filename*0*=UTF-8''%D0%BF%D0%B5%D1%80%D0%B5%D0%B2%D1%96%D1%80%D0%BA%D0%B0;
filename*1*=%D1%97%D2%91%2E%74%78%74
Content-Transfer-Encoding: base64

ZGdkZmdkZg==

--------------hJ1w4fdd7nJgV1TgS95Plkir--


Exim running with debug:
------------pBj0VVcSTH1a84AUmONrMFYf
13:45:06 71378 MIME: found content-type: header, value is 'text/plain'
13:45:06 71378 MIME:   considering paramlist 
'charset=UTF-8;name="=?UTF-8?B?0L/QtdGA0LXQstGW0YDQutCw0ZfSkS50eHQ=?=";'
13:45:06 71378 MIME:  found charset= parameter in content-type: header, 
value 'UTF-8'
13:45:06 71378 MIME:   considering paramlist 
'name="=?UTF-8?B?0L/QtdGA0LXQstGW0YDQutCw0ZfSkS50eHQ=?=";'
13:45:06 71378 MIME:  found name= parameter in content-type: header, 
value 'перевіркаїґ.txt'
13:45:06 71378 MIME: found content-disposition: header, value is 
'attachment'
13:45:06 71378 MIME:   considering paramlist 
'filename*0*=UTF-8''%D0%BF%D0%B5%D1%80%D0%B5%D0%B2%D1%96%D1%80%D0%BA%D0%B0;filename*1*=%D1%97%D2%91%2E%74%78%74;'
13:45:06 71378 MIME:   considering paramlist 
'filename*1*=%D1%97%D2%91%2E%74%78%74;'
13:45:06 71378 MIME:  found filename parameter in content-disposition: 
header, value is 'перевіркаїґ.txt'
13:45:06 71378 MIME: found content-transfer-encoding: header, value is 
'base64'
13:45:06 71378 using ACL "acl_check_mime"
13:45:06 71378 processing "warn" (/usr/local/etc/exim/configure 358)
13:45:06 71378 check decode = default
13:45:06 71378 warn: condition test succeeded in ACL "acl_check_mime"
13:45:06 71378 processing "warn" (/usr/local/etc/exim/configure 362)
13:45:06 71378  ╭considering: ${if def:mime_filename}
13:45:06 71378  ├──condition: def:mime_filename
13:45:06 71378  ├─────result: true
13:45:06 71378  ├──expanding: ${if def:mime_filename}
13:45:06 71378  ╰─────result: true
13:45:06 71378 check condition = ${if def:mime_filename}
13:45:06 71378                 = true
13:45:06 71378  ╭considering: TEST: $mime_filename
13:45:06 71378  ├──expanding: TEST: $mime_filename
13:45:06 71378  ╰─────result: TEST: перевіркаїґ.txt
13:45:06 71378             ╰──(tainted)
13:45:06 71378 check logwrite = TEST: $mime_filename
13:45:06 71378                = TEST: перевіркаїґ.txt
13:45:06 71378 LOG: MAIN
13:45:06 71378   TEST: перевіркаїґ.txt




Have a problem with this MIME part (windows-1251):
------------0D414212928A8F055
Content-Type: text/plain; charset=windows-1251
Content-Transfer-Encoding: quoted-printable

=EF=E5=F0=E5=E2=B3=F0=EA=E0
------------0D414212928A8F055
Content-Type: TEXT/PLAIN;
name="=?windows-1251?Q?=EF=E5=F0=E5=E2=B3=F0=EA=E0=BF=B4=2Etxt?="
Content-transfer-encoding: base64
Content-Disposition: attachment;
filename="=?windows-1251?Q?=EF=E5=F0=E5=E2=B3=F0=EA=E0=BF=B4=2Etxt?="

ZGdkZmdkZg==
------------0D414212928A8F055--

Debug:
17:34:38 71940 MIME: Next part with boundary ----------0D414212928A8F055
17:34:38 71940 MIME: found content-type: header, value is 'text/plain'
17:34:38 71940 MIME:   considering paramlist 
'name="=?windows-1251?Q?=EF=E5=F0=E5=E2=B3=F0=EA=E0=BF=B4=2Etxt?=";'
17:34:38 71940 MIME:  found name= parameter in content-type: header, 
value '▒▒▒▒▒▒▒࿴.txt'
17:34:38 71940 MIME: found content-transfer-encoding: header, value is 
'base64'
17:34:38 71940 MIME: found content-disposition: header, value is 
'attachment'
17:34:38 71940 MIME:   considering paramlist 
'filename="=?windows-1251?Q?=EF=E5=F0=E5=E2=B3=F0=EA=E0=BF=B4=2Etxt?=";'
17:34:38 71940 MIME:  found filename= parameter in content-disposition: 
header, value '▒▒▒▒▒▒▒࿴.txt'
17:34:38 71940 MIME:  found filename parameter in content-disposition: 
header, value is '▒▒▒▒▒▒▒࿴.txt'
17:34:38 71940 using ACL "acl_check_mime"
17:34:38 71940 processing "warn" (/usr/local/etc/exim/configure 362)
17:34:38 71940  ╭considering: ${if def:mime_filename}
17:34:38 71940  ├──condition: def:mime_filename
17:34:38 71940  ├─────result: true
17:34:38 71940  ├──expanding: ${if def:mime_filename}
17:34:38 71940  ╰─────result: true
17:34:38 71940 check condition = ${if def:mime_filename}
17:34:38 71940                 = true
17:34:38 71940  ╭considering: TEST: $mime_filename
17:34:38 71940  ├──expanding: TEST: $mime_filename
17:34:38 71940  ╰─────result: TEST: ▒▒▒▒▒▒▒࿴.txt
17:34:38 71940             ╰──(tainted)
17:34:38 71940 check logwrite = TEST: $mime_filename
17:34:38 71940                = TEST: ▒▒▒▒▒▒▒࿴.txt
17:34:38 71940 LOG: MAIN
17:34:38 71940   TEST: ▒▒▒▒▒▒▒࿴.txt




On 18.10.2022 16:42, Mikhail Golub via Exim-users wrote:
> Developers, can you help me?
>
> On 14.10.2022 18:03, Andrew C Aitchison wrote:
>> On Fri, 14 Oct 2022, Mikhail Golub via Exim-users wrote:
>>
>>> One more example.
>>>
>>> In letter:
>>> Content-Description: =?windows-1251?B?wvXu5F/C+/Xu5C54bHN4?=
>>>
>>> In $mime_content_description:
>>> =?windows-1251?b?wvxu5f/c+/xu5c54bhn4?=
>>>
>>> Compare it:
>>> =?windows-1251?B?wvXu5F/C+/Xu5C54bHN4?=
>>> =?windows-1251?b?wvxu5f/c+/xu5c54bhn4?=
>>
>> I have a script https://www.aitchison.me.uk/clearsubject.pl
>> piping the above though it gives:
>> ----------------------------------
>> In letter:
>> Content-Description: Вход_Выход.xlsx
>>
>> In $mime_content_description:
>> ВьnеяЬыьnеОxnш
>>
>> Compare it:
>> Вход_Выход.xlsx
>> ВьnеяЬыьnеОxnш
>> ----------------------------------
>>
>> So $mime_content_description: has not preserved the case of the
>> encoded text,
>> which means that the decoded version is wrong !
>
>
>