Mailing List Archive

A couple questions about strings expansion using ${addresses} from header
Hi,
Firstly I wish all the best in 2021 year!

I have a couple of cases which makes me scratching the head.

1. Difference in behaviour when I use "-be" vs "-bem":

# cat /tmp/test2
From: =?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?=
# exim -bem /tmp/test2 '${addresses:$h_from:}'
aaaa-aaaa:bbbbb@jowisz.mejor.pl

# exim -be '${addresses:$h_from:From:
=?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?= }'
=?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?=

Why exim -bem adds hostname to parsed header? I expect exim should not
add anything. Why exim doesn't add hostname in invocation with "-be"?
Shouldn't behave in the same way?

2. comma in addresses:

# cat /tmp/test2
From: =?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?= <a@a.a>
# exim -bem /tmp/test2 '${addresses:$h_from:}'
aaaa-aaaa:a@a.a

Why exim sees two addresses? There is no literally coma, comma is
encoded with base64. There is in doc "It does not see the comma because
it’s still encoded as "=2C" ", so meseems it still shouldn't interpret
comma also for base64


3. "-be" vs "-bem". The same header as above.
# cat /tmp/test2
From: =?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?= <a@a.a>
# exim -bem /tmp/test2 '${addresses:$h_from:}'
aaaa-aaaa:a@a.a

vs
# exim -be '${addresses:$h_from:From:
=?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?= <a@a.a>}'
a@a.a

Shouldn't be result of expansion the same in both cases?

4. All above was because I wanted to reject messages when header From is
more than once in email:) I did:
${if >{${listcount:${addresses:$h_from:}}}{1}{yes}{no}}

which triggered a couple of problems described earlier.

Marcin





--
## 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: A couple questions about strings expansion using ${addresses} from header [ In reply to ]
On 31/12/2020 12:17, Marcin Miros?aw via Exim-users wrote:
> 1. Difference in behaviour when I use "-be" vs "-bem":
>
> # cat /tmp/test2
> From: =?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?=
> # exim -bem /tmp/test2 '${addresses:$h_from:}'
> aaaa-aaaa:bbbbb@jowisz.mejor.pl
>
> # exim -be '${addresses:$h_from:From: =?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?= }'
> =?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?=
>
> Why exim -bem adds hostname to parsed header? I expect exim should not add anything.

Per the discussion of the local_from_check config option:
"An unqualified address (no domain) in the From: header
in a locally submitted message is automatically qualified
by Exim, unless the -bnq command line option is used"


> Why exim doesn't add hostname in invocation with "-be"?

Because your expansion had no From: header to work with,
and the only string left was the thing starting with an =
that you explicitly gave it.

>
> 2. comma in addresses:
>
> # cat /tmp/test2
> From: =?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?= <a@a.a>
> # exim -bem /tmp/test2 '${addresses:$h_from:}'
> aaaa-aaaa:a@a.a
>
> Why exim sees two addresses? There is no literally coma, comma is encoded with base64. There is in doc "It does not see the comma because it’s still encoded as "=2C" ", so meseems it still shouldn't interpret comma also for base64

The doc sentence is discussing use of $rheader_from: - which is the Q-coded
string. You used $header_from: - which has been decoded, so has a
visible comma.


>
>
> 3. "-be" vs "-bem". The same header as above.
> # cat /tmp/test2
> From: =?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?= <a@a.a>
> # exim -bem /tmp/test2 '${addresses:$h_from:}'
> aaaa-aaaa:a@a.a
>
> vs
> # exim -be '${addresses:$h_from:From: =?utf-8?B?YWFhYS1hYWFhLCBiYmJiYg==?= <a@a.a>}'
> a@a.a
>
> Shouldn't be result of expansion the same in both cases?

No, for the multiple reasons described above.
--
Cheers,
Jeremy

--
## 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/