On Tue, 29 Jul 2003, Matej Cepl wrote:
> ~$ uname -a
> Linux komensky 2.4.20 #2 Ne kvì 18 18:08:31 EDT 2003 i586 unknown
> ~$ hostname -f
> komensky.volny.cz
> ~$
OK, that probably explains things. Exim finds the name "komensky" from
uname(), and then does a DNS lookup to find the fully qualified name.
> And no, I have not set primary_hostname, because this is notebook and it
> is often connected to the Internet with different ISP provider and thus
> it is in different domain.
Running an MTA on a mobile host does have its problems.
> Do I have to set the variable?
It has to get set somehow. Exim calls gethostbyname() when it finds a
single-component name, and then uses the canonical name it is given.
> If the worst
> comes to worst I can do something like
>
> primary_hostname=${lookup{domain}lsearch{/etc/exim/domainlist}{$value}}
Won't work. primary_hostname is not an expanded string.
> Or is it possible to parse /etc/hosts with exim? I have this as a first
> line of the file, is it possible somehow to parse it?
>
> 127.0.0.1 komensky.volny.cz komensky localhost
Hmm. That should already work via gethostbyname() if it is configured to
look at /etc/hosts. Does your system have something like
/etc/nsswitch.conf? Does it contain this line?
hosts: files dns
That says "try /etc/hosts, then try dns".
> primary_hostname=${sg${lookup{127.0.0.1}lsearch{/etc/hosts}{$value}}\
> {^(\S+)\s*(\S+)\s*(\S+)\s*\$}{$1}}
>
> (unfortunately, this one doesn't work; why?)
primary_hostname is not expanded.
> It would be nice to maintain only one file. Or if I can get output of
> 'hostname -f' into that variable (but it is not possible to do it in v.
> 3, is it?).
In Exim 4 you could use a .include file in the configuration.
In Exim 3 you would have to write a script that ran 'hostname -f', found
the right value, and concatenated it on the front of the configuration
file. Such a script could run at boot or at MTA start up.
--
Philip Hazel University of Cambridge Computing Service,
ph10@??? Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book: http://www.uit.co.uk/exim-book