Messing around with Heiko's issue I started trying to
lay out some example coding, and ran into some brainfade.

I'd got to here:

${if forany \
     {mail:EximMailPrimaryAddress:EximMailAlternateAddress} \
     {inlisti {$local_part} \
              {<, ${extract {$item} \
                         {${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}}\
                }\
              }\
     }\
 }

and, replacing the $local_part for testing, failed like so:

> ${if forany \
     {mail:EximMailPrimaryAddress:EximMailAlternateAddress} \
     {inlisti {[email protected]} \
              {<, ${extract {$item} \
                         {${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}}\
                }\
              }\
     }\
 }
expanding: mail:EximMailPrimaryAddress:EximMailAlternateAddress
   result: mail:EximMailPrimaryAddress:EximMailAlternateAddress
expanding: [email protected]
   result: [email protected]
skipping: result is not used
expanding: $item
   result:
skipping: result is not used
expanding: ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4
   result: ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4
skipping: result is not used
expanding: ${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}
   result:
skipping: result is not used
failed to expand: <, ${extract {$item} {${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}}}}}}
   error message: missing or misplaced { or }
failed to expand: ${if forany
{mail:EximMailPrimaryAddress:EximMailAlternateAddress} {inlisti
{[email protected]} {<, ${extract {$item} {${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}}}}}}
   error message: missing or misplaced { or } inside "forany" condition
Failed: missing or misplaced { or } inside "forany" condition
>

This looks to be a syntax-check initial run through
the arguments for the forany, failing because $item
is empty and ${extract requires nonempty.

Replace the $item with a dummy and it works.
Ideas?










(full expansion for the working test-hack:)

> ${if forany \
     {mail:EximMailPrimaryAddress:EximMailAlternateAddress} \
     {inlisti {[email protected]} \
              {<, ${extract {EximMailAlternateAddress} \
                         {${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}}\
                }\
              }\
     }\
 }
expanding: mail:EximMailPrimaryAddress:EximMailAlternateAddress
   result: mail:EximMailPrimaryAddress:EximMailAlternateAddress
expanding: [email protected]
   result: [email protected]
skipping: result is not used
expanding: EximMailAlternateAddress
   result: EximMailAlternateAddress
skipping: result is not used
expanding: ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4
   result: ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4
skipping: result is not used
expanding: ${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}
   result:
skipping: result is not used
expanding: <, ${extract {EximMailAlternateAddress} {${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}}}
   result: <,
skipping: result is not used
forany: $item = "mail"
expanding: [email protected]
   result: [email protected]
expanding: EximMailAlternateAddress
   result: EximMailAlternateAddress
expanding: ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4
   result: ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4
search_open: ldapm "NULL"
search_find: file="NULL"
  key="ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4";
partial=-1 affix=NULL starflags=0
LRU list:
internal_search_find: file="NULL"
  type=ldapm
key="ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4";
database lookup required for
ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4
LDAP parameters: user=NULL pass=NULL size=0 time=0 connect=0
dereference=0 referrals=on
perform_ldap_search: ldapm URL =
"ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4";
server=NULL port=0 sizelimit=0 timelimit=0 tcplimit=0
after ldap_url_parse: host=localhost port=389
ldap_initialize with URL ldap://localhost:389/
initialized for LDAP (v3) server localhost:389
LDAP_OPT_X_TLS_TRY set due to ldap:// URI
binding with user=NULL password=NULL
Start search
ldap_result loop
LDAP entry loop
LDAP attr loop cn:user4
LDAP attr loop mail:[email protected]
LDAP attr loop EximMailPrimaryAddress:[email protected]
LDAP attr loop EximMailAlternateAddress:[email protected]
LDAP attr loop EximMailAlternateAddress:[email protected]
search ended by ldap_result yielding 101
ldap_parse_result: 0
ldap_parse_result yielded 0: Success
LDAP search: returning: cn="user4" mail="[email protected]"
EximMailPrimaryAddress="[email protected]"
EximMailAlternateAddress="[email protected],[email protected]"
lookup yielded: cn="user4" mail="[email protected]"
EximMailPrimaryAddress="[email protected]"
EximMailAlternateAddress="[email protected],[email protected]"
expanding: ${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}
   result: cn="user4" mail="[email protected]"
EximMailPrimaryAddress="[email protected]"
EximMailAlternateAddress="[email protected],[email protected]"
expanding: <, ${extract {EximMailAlternateAddress} {${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}}}
   result: <, [email protected],[email protected]
forany: condition evaluated to true
condition: forany {mail:EximMailPrimaryAddress:EximMailAlternateAddress}
{inlisti {[email protected]} {<, ${extract
{EximMailAlternateAddress} {${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}}}}}
   result: true
expanding: ${if forany
{mail:EximMailPrimaryAddress:EximMailAlternateAddress} {inlisti
{[email protected]} {<, ${extract {EximMailAlternateAddress}
{${lookup
ldapm{ldap://localhost/ou=users,dc=example,dc=com?mail,cn?sub?cn=user4}}}}}}}
   result: true
true
>



-- 
Cheers,
  Jeremy

-- 
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim 
details at http://www.exim.org/ ##

Reply via email to