Mailing List Archive

quote_pgsql and ${sg.... in the same acl condition?
I'm having quoting issues and can't see what I'm doing wrong here.
Here's the rule (commented, but when uncommented I get the error below)

# deny message = ${extract{message} {\
# ${lookup pgsql{select deny_address,message
from \
# blacklist_address where \
# '${quote_pgsql:$h_From:}' ilike deny_address
\
# }}}}
# log_message = BLACKLIST_ADDR ${extract{message} {\
# ${lookup pgsql{select deny_address,message
from \
# blacklist_address where \
# '${quote_pgsql:$h_From:}' ilike deny_address
\
# }}}}
# condition = ${lookup pgsql{select 1 as truth from
blacklist_address where \
#
'${quote_pgsql:${sg{$h_From:}{.*(<.*>).*}{\$1}}}' ilike
deny_address}{$value}}

[1\66] 1rOjXw-00000000OOZ-0f3u H=malur.postgresql.org
[217.196.149.56]:36880 I=[192.147.25.65]:25 X=TLS1.3:TLS_
AES_256_GCM_SHA384:256 CV=yes DN="/CN=lists.postgresql.org"
F=<pgsql-committers-owner+M2386-532225@lists.postgresql.org> temporarily
rejected after DATA: PGSQL: query failed: ERROR: unterm
inated quoted string at or near "'<tgl@sss.pgh.pa.us>'' ilike
deny_address{"


The From: line is:
[47\66] F From: Tom Lane <tgl@sss.pgh.pa.us>

What am I missing here?
exim 4.97.1 (FreeBSD), PostgreSQL 15.5

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 214-642-9640 E-Mail: ler@lerctr.org
US Mail: 5708 Sabbia Dr, Round Rock, TX 78665-2106

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: quote_pgsql and ${sg.... in the same acl condition? [ In reply to ]
On 1/13/24 19:46, Larry Rosenman via Exim-users wrote:
> What am I missing here?

You have three lookups; we need to know which. My money's on the
one with the "sg" just from the complexity that adds...

a) run it with debug. We want to see the expansions getting done
bit-by-bit.

b) look into the ${addresses:<string>} operator, in case that
is really what you're trying to do with that ${sg }.
--
Cheers,
Jeremy


--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: quote_pgsql and ${sg.... in the same acl condition? [ In reply to ]
On 01/13/2024 2:29 pm, Jeremy Harris via Exim-users wrote:
> On 1/13/24 19:46, Larry Rosenman via Exim-users wrote:
>> What am I missing here?
>
> You have three lookups; we need to know which. My money's on the
> one with the "sg" just from the complexity that adds...
>
> a) run it with debug. We want to see the expansions getting done
> bit-by-bit.
>
> b) look into the ${addresses:<string>} operator, in case that
> is really what you're trying to do with that ${sg }.
> --
> Cheers,
> Jeremy

Thank You, I didn't realize there was ${addresses:<string>}, which does
what I want

--
Larry Rosenman http://www.lerctr.org/~ler
Phone: +1 214-642-9640 E-Mail: ler@lerctr.org
US Mail: 5708 Sabbia Dr, Round Rock, TX 78665-2106

--
## subscription configuration (requires account):
## https://lists.exim.org/mailman3/postorius/lists/exim-users.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-users-unsubscribe@lists.exim.org
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/