Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: exim: users

lookup in and

 

 

exim users RSS feed   Index | Next | Previous | View Threaded


Klaus+exim at Ethgen

Dec 1, 2011, 7:14 AM

Post #1 of 6 (463 views)
Permalink
lookup in and

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hello,

I stumble over the problem that "lookup" is not possible inside of an
"and" construct.

While it seems to be ok to have as much "condition" lines as you wish in
a acl, a router only accept one. That implies to use "and" for all
conditions. But if I need to use a "lookup" inside them I get an error.
However, after some search I found one post in this list that this is
not possible. But there is no way out of the problem. Also I do not find
any about this problem in the original documentation.

It might be a solution to use the sole lookup and put the rest of the
"and" in the first expansion part. But what if the lookup should be only
done if the first condition matches?

At the moment I utilize a embedded perl construct. This is not nice as
all lookups can be done by exim itself. But I find no way else out.
Anybody an idea?

${if and{{={25}{$received_port}}{lookup ldap{...}}}}

Regards
Klaus
- --
Klaus Ethgen http://www.ethgen.ch/
pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen <Klaus [at] Ethgen>
Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQGcBAEBCgAGBQJO15nxAAoJEKZ8CrGAGfasKQUL/jmjJT2Xi6StQe3jYqe7wZcx
IJbGjSqIwXcGWRNH2NoqSa60dWbni8KgMfG/TytzphuZOLfI17/mvUKMIk6Iwh9b
qj/xlpJXQBKK0+hErbmBUEDbAlxY4V7JnDoPIwDAEtZRjy2/BVNcfXrVXg+FwiKt
fQtlWscJx3frnBsty7jkbC3qjAaWUXidN5ue+QbrJOoz1OpCdh8y4AO1B+Qf1CZv
TxRozVjGQ53WbJ5pmuHxg8jIYrSREWG5kpQ5PpTX5OOIvXTdJ1ASG/B7n67+dbJw
/egy1uFu0Gjn4v6B+MsyN4f8jd/T+aDOUskdpIicGalc7vJeS2uwPJVuDqf45rVM
j1IiBTPwo3CF34NKMnuGWRCIUlUh/SPuiTSofhTtq7V/2SweVK08QJZgTQBycwbu
SbMssMw1JFhYZQ1Hvuf+lZdnNfo4dtZzSD4wFlUSQjXK8paQiZHglssdDIWXcZEZ
wmeWaanadHPssRuypENJQf3oXNPqkVZa663zFN5ZQA==
=1fgx
-----END PGP SIGNATURE-----

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


tlyons at ivenue

Dec 1, 2011, 7:36 AM

Post #2 of 6 (453 views)
Permalink
Re: lookup in and [In reply to]

On Thu, Dec 1, 2011 at 7:14 AM, Klaus Ethgen <Klaus+exim [at] ethgen> wrote:
> While it seems to be ok to have as much "condition" lines as you wish in
> a acl, a router only accept one. That implies to use "and" for all
> conditions. But if I need to use a "lookup" inside them I get an error.
> However, after some search I found one post in this list that this is
> not possible. But there is no way out of the problem. Also I do not find
> any about this problem in the original documentation.

You must be running an older version of exim then. From the changelog:
Exim version 4.73
-----------------
PP/15 Bugzilla 816: support multiple condition rules on Routers.

As for mixing the lookup into the and condition, I didn't know that
was a limitation. However, it seems like you could do the lookup
first, stuff it into a variable, and then use that variable.

set acl_m_blah = ${lookup ... }
condition = ${if and{{={25}{$received_port}}{$acl_m_blah}}}

You may need to add some qualifiers to your lookup in order to prevent
unexpected results from being returned.

Regards... Todd
--
If Americans could eliminate sugary beverages, potatoes, white bread,
pasta, white rice and sugary snacks, we would wipe out almost all the
problems we have with weight and diabetes and other metabolic
diseases. -- Dr. Walter Willett, Harvard School of Public Health

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


Klaus+exim at ethgen

Dec 1, 2011, 8:37 AM

Post #3 of 6 (445 views)
Permalink
Re: lookup in and [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi,

Am Do den 1. Dez 2011 um 16:36 schrieb Todd Lyons:
> You must be running an older version of exim then. From the changelog:
> Exim version 4.73
> -----------------
> PP/15 Bugzilla 816: support multiple condition rules on Routers.

Ah, yes, thanks. Indeed I have version 4.71 running. (From ubuntu.)

> As for mixing the lookup into the and condition, I didn't know that
> was a limitation. However, it seems like you could do the lookup
> first, stuff it into a variable, and then use that variable.

Well, wanted to omit the lookup if the first condition fails. However, I
completely changed the implementation and did everything in a ACL.

Regards
Klaus
- --
Klaus Ethgen http://www.ethgen.ch/
pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen <Klaus [at] Ethgen>
Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQGcBAEBCgAGBQJO161UAAoJEKZ8CrGAGfasM10L/icQLl3uvIIv0sc+axIql1yL
v8ChnwkAu1MX3J3lbl/Wn2FIHA0qrh6xjI7iYkXxMh4p70QP7X3AwqBhqLf5deCq
DEU8YSe+h4DkLwiscmdts9ElfmXLAwZ7e6lYXGI9pG7P67ixll6luCW4HLQBkaGo
6X7JAdz2mn/PXbC2KQ97mu5CA+Z3AuLav9y0wHnjfD6DC1pNmJIRLxhpsHbfWOyk
+Z16WljzREcRQ4kxzZ3OeY+lUNZfNE2StIF52KPsaESD9jAuiz0bpoWnz6ldz9I5
+YbcEAZ6kYdxOXe806QbSh9ipIh7ZwdrH27sOWIrBq7euejDW4d9xnq3PDqxJdio
i95Dnt272jY6eVEAH75BizxjNvFDFhbubBgQJFRL612IGxXQwPZSCyUjvOlfqZs8
7RmOmsIEd49oRgQ2k9V03Y2Hy2h9dDrO0+IkapVhtxrF9BAZV3HodW5JN6GgTRzT
2j1Nryb6p579I4ZPt4g5jxXbLc9HTwVF2GRFxyZf2A==
=1MmP
-----END PGP SIGNATURE-----

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


jh at plonk

Dec 1, 2011, 9:40 AM

Post #4 of 6 (451 views)
Permalink
Re: lookup in and [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Klaus Ethgen, 2011-12-01 16:14:

> I stumble over the problem that "lookup" is not possible inside of
> an "and" construct.
...
> ${if and{{={25}{$received_port}}{lookup ldap{...}}}}

That's because "and" requires conditions, and a lookup is not a
condition. What does your lookup return, anyway? You can of course
check the result of your lookup:

${if and {{={25}{$received_port}} {ne{}{${lookup ldap{...}}}}}}

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO17wBAAoJEANsCm3lNaE742gIAKn6hpoNShn5UPT3zzApInR9
Tja5zfcsE1tbAobqoOdKglCGQCSRrvEinPbMmH/FOoz9MtG9SEGNjPGSG/wJRtiX
QVSO0KZqUoPPyrmwpa/GisOckMNl14UpWp9HAxeuO0fui1sFrrV/I+mZqlvGqBg2
qzyFdzmQOXzZb34+xhsjYttCEKo7m9woc81eQxVLgRKrVZpltMu4wI9fVju2pUuP
4scKxguRmSn0VthqjAt3C/Rfx9472UGhirvkvB1d/SfmenCPix4W1ZUlKBSLZDo5
H2fTuOAr13KuRqC3l/g5ObMjUG0j/6zl6IgC4kKzqsLEjDKi+ANT74SgamHVgp8=
=2DGf
-----END PGP SIGNATURE-----

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


Klaus+exim at Ethgen

Dec 1, 2011, 4:09 PM

Post #5 of 6 (444 views)
Permalink
Re: lookup in and [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Am Do den 1. Dez 2011 um 18:40 schrieb Jakob Hirsch:
> > ${if and{{={25}{$received_port}}{lookup ldap{...}}}}
>
> That's because "and" requires conditions, and a lookup is not a
> condition.

lookup ldap{...}{yes}{no} and voila, it is boolean but do not work
either.

> What does your lookup return, anyway?

anything that exists for this account.

But however, as I posted before I found another way.

Regards
Klaus
- --
Klaus Ethgen http://www.ethgen.ch/
pub 4096R/4E20AF1C 2011-05-16 Klaus Ethgen <Klaus [at] Ethgen>
Fingerprint: 85D4 CA42 952C 949B 1753 62B3 79D0 B06F 4E20 AF1C
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQGcBAEBCgAGBQJO2Bc9AAoJEKZ8CrGAGfasJAML/R+ZCXmM34UtkuU3kDIpzpe7
Kvw5b379OoKzFGr62SJHDlJAiqytqdXkKNeBduxkTBoibWuvLRh1r8loZ4A5YQvl
VD5tU0wdnLGmGaAr+0xjOO+meQAfEe+RSnuyPJEPQMj4IF1XT6eRp5FJNpQywJXw
G/OFdO9jhi0qR2ix24dYSMsOOULup7/jFA5UWQP2IqcUPj9QnldhLipowkF9NIVw
kPIAnp/pz5b8tklaTyp2cBBNgZ/jZVVQAdof8HQt2D80dkRUX9I1ml35F5xwfq79
wa4LNGhOjQuJnXo7NBj+bBOYjL9KjSzrG7vvDganpfWo9uELY1dLNAhFZp4DaT88
VEqBPAMiSCrE0qWW4Vb4eMLhCMmtl+NSSgq4/ugGAlGjHsdPFQPXcHETtBIUJzYa
3yyKx4Eb9Xz67ZkSbmmXG/D6boLpwu2taZwL6NbWhsK7g503iFpwFj4OXXWGbe8z
r8VGKev8T+X6l/Gx9PVq96Vh4RS72SzQ80uiE+wgpg==
=c3vC
-----END PGP SIGNATURE-----

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


jh at plonk

Dec 4, 2011, 2:53 AM

Post #6 of 6 (412 views)
Permalink
Re: lookup in and [In reply to]

On 02.12.2011 01:09, Klaus Ethgen wrote:

>>> ${if and{{={25}{$received_port}}{lookup ldap{...}}}}
>> That's because "and" requires conditions, and a lookup is not a
>> condition.
> lookup ldap{...}{yes}{no} and voila, it is boolean

It may be boolean to you, but for Exim it's still only a string.
What may have confused is that Exim has different requirements for
"condition" depending on the contet. Conditions in ACLs and routers
require a string, conditions in string expansions require a expansion
condition as listed in
http://exim.org/exim-html-current/doc/html/spec_html/ch11.html#SECTexpcond
(or the combination conditions or{} and and{}, but obviously you were
able to find that by yourself).

>> What does your lookup return, anyway?
> anything that exists for this account.

So you want the condition to be true if something is returned? Then
all you need to do is turn the result string into a string expansion
condition, in this case by comparing it to the empty string. Like I
already wrote: and { {...} {ne{}{${lookup ldap{...

> But however, as I posted before I found another way.

Well then, good for you. :)

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

exim users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.