Re: Running on different port with ASMTP

Andreas Metzler <[email protected]> Mon, 24 Jan 2005 08:59:44 +0100
Newsgroups gmane.mail.exim.exiscan.user
Message-ID <[email protected]>
On 2005-01-24 Matt <[email protected]> wrote:
[...]
> So is this the way it works?

> plain:
>    driver = plaintext
>    public_name = PLAIN
>    {add this?} server_advertise_condition = {if eq {$interface_port} 
> {}{2500}}
>    server_condition = "${perl{smtpauth}}"
>    server_set_id = $2

> I am still digging on google for an example but cannot find a good one. 
> Closest I found is this.  Is this(above) anywhere near right?

> >>server_advertise_condition = ${if eq{$tls_cipher}{}{0}{1}}
[...]

It is the right direction but not correct. Lets do some testing.
You can easily test expansions with exim:
----
/usr/sbin/exim -be '{if eq {$interface_port}{}{2500}}'
{if eq {-1}{}{2500}}
----
Hmm. We get a literal if? Compare your try with the example you found:
yours:   {if eq {$interface_port}{}{2500}}
example: ${if eq{$tls_cipher}{}{0}{1}}
Now it is obvious, we are missing the starting $.
/usr/sbin/exim -be '${if eq {$interface_port}{}{2500}}'

Empty string, looks like the syntax is correct, now lets try to
understand what it does. String expansions are explained in great
detail in
http://www.exim.org/exim-html-4.40/doc/html/spec_11.html#CHAP11

The basic syntax of "if" is:
${if <condition>{replacementonsuccess}{replacementonfailure}}
Apply this to your try:
<condition>   <--->  eq {$interface_port}{}
replacementonsuccess  <--->  empty string
replacementonfailure  <--->  2500

So you have got a expansion that checks whether $interface_port is
empty and returns the empty string if this correct and 2500 otherwise.

Do you want that? Recheck the documentation of server_advertise_condition:
| If it yields the empty string, `0', `no', or `false', the mechanism
| is not advertised.

Obviously not. You want a expansion that returns something which is
"`0', `no', or `false'" if $interface_port is 25 and success (1, yes
or true) if $interface_port 2500. As you are running exim only on
these two ports you can choose to return true for port 2500 and false
for anything else.
              cu andreas
-- 
"See, I told you they'd listen to Reason," [SPOILER] Svfurlr fnlf,
fuhggvat qbja gur juveyvat tha.
Neal Stephenson in "Snow Crash"
                                           http://downhill.aus.cc/