non-GNU systems: serious bug in SA3 dependency

Julian Field mailscanner at ecs.soton.ac.uk
Sat Sep 4 16:16:29 IST 2004


<x-flowed>
One of the dependencies for SpamAssassin 3 is the Sys::Hostname::Long perl
module.
This module assumes that the "hostname" command on the path is the GNU one!
:-(
Bad luck if you're not running on a GNU system, so all you Solaris etc
users out there, read on...

To find the fully-qualified hostname with the domain attached (ie the
FQDN), it executes the command
        hostname --fqdn

This will, on Solaris systems at least, set the hostname to the name
"--fqdn" which probably isn't what your server is called. If you try this,
change your hostname back *real* fast or all sorts of ugly shit will happen.

This showed up when I first started up MailScanner after upgrading to SA3,
as I got a usage error from "ypmatch". Subsequent attempts to start up
MailScanner appeared to fail. Running with Debug=yes caused it to bin out
with an error in /usr/perl5/site_perl/5.6.1/Sys/Hostname/Long.pm.

There are 2 ways to fix this:
1) Replace /usr/bin/hostname with the GNU version. Bad idea in my book, I
don't like messing with replacing system binaries if I can avoid it.
2) Hack the module to report your long hostname. Also a bad idea, but
easier to maintain as you don't have to remember you did it the next time
you apply a Solaris patch set and everything breaks. The Perl module is so
simple that I doubt you will ever need to upgrade it in the life of the
system anyway.

You are looking for
/usr/perl5/site_perl/5.6.1/Sys/Hostname/Long.pm
At line 75, you will see this:
                         my $tmp = `hostname --fqdn`;
Change this to tack on your domain name instead, like this:
                         my $tmp = `hostname` . '.ecs.soton.ac.uk';
where obviously you should change .ecs.soton.ac.uk to your own domain name
(with a dot on the front). Note the use of back-ticks and apostrophes in
the line above.

There is a little demo script "testall.pl" in the same directory, and you
can now safely run that to prove that you always get the correct hostname
for your server.

Thought you folks might appreciate the warning...
--
Julian Field
www.MailScanner.info
Professional Support Services at www.MailScanner.biz
MailScanner thanks transtec Computers for their support
PGP footprint: EE81 D763 3DB0 0BFD E1DC 7222 11F6 5947 1415 B654

------------------------ MailScanner list ------------------------
To unsubscribe, email jiscmail at jiscmail.ac.uk with the words:
'leave mailscanner' in the body of the email.
Before posting, read the MAQ (http://www.mailscanner.biz/maq/) and
the archives (http://www.jiscmail.ac.uk/lists/mailscanner.html).
</x-flowed>



More information about the MailScanner mailing list