Mailing List Archive

How long does $value last?
I do this in acl_smtp_mail:

ASN_DOMAIN = asn.routeviews.org

warn
condition = ${lookup dnsdb{>; txt=${reverse_ip:$sender_host_address}.ASN_DOMAIN}}
set acl_c_sender_asn = $value

and later on, I check acl_c_sender_asn, but it seems to be empty. I
peeked in my named log and I see the query indeed takes place and
returns the expected information. So why is $value unset (apparently)?
Does it only last till the end of the current expansion? That is not
the sense I got from the documentation.

--
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: How long does $value last? [ In reply to ]
On 31/01/2019 17:26, Ian Zimmerman via Exim-users wrote:
> warn
> condition = ${lookup dnsdb{>; txt=${reverse_ip:$sender_host_address}.ASN_DOMAIN}}
> set acl_c_sender_asn = $value
>
> and later on, I check acl_c_sender_asn, but it seems to be empty. I
> peeked in my named log and I see the query indeed takes place and
> returns the expected information. So why is $value unset (apparently)?
> Does it only last till the end of the current expansion? That is not
> the sense I got from the documentation.
>

The docs say, regarding ${lookup } :-

If the lookup succeeds, <string1> is expanded and replaces the entire
item. During its expansion, the variable $value contains the data
returned by the lookup. Afterwards it reverts to the value it had
previously (at the outer level it is empty).

Which part of the docs were you reading, to get a different sense?
--
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/
Re: How long does $value last? [ In reply to ]
On 2019-01-31 19:00, Jeremy Harris wrote:

> > Does it only last till the end of the current expansion? That is not
> > the sense I got from the documentation.
> >
>
> The docs say, regarding ${lookup } :-
>
> If the lookup succeeds, <string1> is expanded and replaces the entire
> item. During its expansion, the variable $value contains the data
> returned by the lookup. Afterwards it reverts to the value it had
> previously (at the outer level it is empty).
>
> Which part of the docs were you reading, to get a different sense?

I think I confused it with the use of $value in ${if acl{...} ...} which
seems to have no such stacking regime, or at least it is not
documented. Is that by design and why?

Be that as it may, this overloading in itself feels like a mistake. The
ACL condition should have set $acl_value or something like that. Sadly
it's probably too late to change it ...

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