Re: [exim] defined and Exim::expand_string ('$variable')

Top Page
Delete this message
Reply to this message
Author: David Saez
Date:  
To: exim-users
Subject: Re: [exim] defined and Exim::expand_string ('$variable')
Not sure what your problem is but you can do:

set acl_m_helo_check_a = ${lookup dnsdb{>: defer_never,
a=$sender_helo_name}{$value}}

and check if the lookup defered with

   condition      = ${if eq {$acl_m9}{}}


> Hello.
>
> I have the following conditions:
> ------------------------------------------
> |warn      log_message   = "HELO test A record is [$acl_m_helo_check_a]"
>             !authenticated = *
>             hosts         = !127.0.0.1 : !localhost : *
>             condition     = ${if !eq{$acl_m_helo_is_fqdn}{}}
>             set acl_m_helo_check_a = ${lookup dnsdb{>: 
> a=$sender_helo_name}{$value}}

>
>   warn      !authenticated = *
>             log_message   = "DEFER IS TRUE: $acl_m_testtest"
>             hosts         = !127.0.0.1 : !localhost : *
>             set acl_m_testtest = ${perl{def_helo_check_a}}|
> ------------------------------------------

>
> And this simple perl script:
> ------------------------------------------
> |#!/usr/bin/perl
> sub def_helo_check_a {
> if (defined Exim::expand_string('$acl_m_helo_check_a')) {
>    return 0
>    } else {
>    return 1
>    }
> }
> ------------------------------------------

>
> Debug logs:
> ------------------------------------------
> ||...
> processing "warn"
> check !authenticated = *
> check hosts = !127.0.0.1 : !localhost : *
> gethostbyname2(af=inet6) returned 2 (TRY_AGAIN)
> gethostbyname2 looked up these IP addresses:
>   name=localhost.localdomain address=127.0.0.1
> host in "!127.0.0.1 : !localhost : *"? yes (matched "*")
> check condition = ${if !eq{$acl_m_helo_is_fqdn}{}}
>                 = true
> search_open: dnsdb "NULL"
> search_find: file="NULL"
>   key=">: a=ya.ru" partial=-1 affix=NULL starflags=0
> LRU list:
> internal_search_find: file="NULL"
>   type=dnsdb key=">: a=ya.ru"
> database lookup required for >: a=ya.ru
> dnsdb key: ya.ru
> DNS lookup of ya.ru (A) gave TRY_AGAIN
> ya.ru in dns_again_means_nonexist? no (option unset)
> returning DNS_AGAIN
> lookup deferred:
> warn: condition test deferred in ACL "acl_check_rcpt"
> LOG: MAIN
>   H=(ya.ru) [62.117.85.73] Warning: ACL "warn" statement skipped: 
> condition test deferred: failed to expand ACL string "${lookup 
> dnsdb{>: a=$sender_helo_name}{$value}}": lookup of ">: a=ya.ru" gave 
> DEFER:
> processing "warn"
> check !authenticated = *
> check hosts = !127.0.0.1 : !localhost : *
> gethostbyname2(af=inet6) returned 2 (TRY_AGAIN)
> gethostbyname2 looked up these IP addresses:
>   name=localhost.localdomain address=127.0.0.1
> host in "!127.0.0.1 : !localhost : *"? yes (matched "*")
> Starting Perl interpreter
> check set acl_m_testtest = ${perl{def_helo_check_a}}
>                          = 0
> warn: condition test succeeded in ACL "acl_check_rcpt"
> LOG: MAIN
>   H=(ya.ru) [x.x.x.x] Warning: "DEFER IS TRUE: 0"
> processing "deny"
> ...
> ||------------------------------------------

>
> ||$acl_m_helo_check_a don't defined, but perl think what
> ||$acl_m_helo_check_a defined.
> Why does defined function in perl receives this value?
>
> Thanks.
> |