Subject: Bug#4418: cern-httpd reads incorrect FQDN at boot

From: [email-masked] (Ian Maclaine-cross)
Date: Fri, 6 Sep 1996 12:12:43 +1000 (EST)

Package: cern-httpd
Version: 3.0-6

My hostname is 'ilm' and my FQDN is 'ilm.mech.unsw.edu.au'.

'hostname' on my machine works as described in the man page as
shown in the following interactive bash transcript:

# hostname -s
ilm
# hostname -f
ilm.mech.unsw.edu.au
# hostname ilm
ilm
# hostname
ilm
# hostname ilm.mech.unsw.edu.au
ilm.mech.unsw.edu.au
# hostname
ilm.mech.unsw.edu.au

When 'cern-httpd' starts it executes 'hostname' to find the FQDN
instead of 'hostname -f'. 

My debian configuration had 'hostname' set to return 'ilm' when
'/etc/init.d/cern-httpd' was executed at boot time to start
'cern-httpd'. 'cern-httpd' then thought that my FQDN was 'ilm'.

When http clients requested a directory listing, the html 'cern-httpd'
sent to the clients had icon URLs with 'ilm' as my FQDN. The clients
received no icons. Some clients complained and substituted a default
icon, e.g. X Mosaic 2.7b5, but others, e.g. Netscape, failed to list the
directory completely.

As a temporary fix I replaced '/etc/init.d/cern-httpd' with:

#!/bin/sh
# start or stop the http daemon
test -f /usr/sbin/cern-httpd || exit 0
case "$1" in
start)	
  # Save old hostname and set 'hostname' to give FQDN for cern-httpd. 
  oldhostname=`hostname`;
  hostname `hostname -f`;
  start-stop-daemon --start --verbose --exec /usr/sbin/cern-httpd;
  # Reset hostname to give $oldhostname. 
  hostname $oldhostname;;
stop)	start-stop-daemon --stop  --verbose --exec /usr/sbin/cern-httpd ;;
*)	echo "Usage: /etc/init.d/cern-httpd start|stop"; exit 1 ;
esac
exit 0

If 'hostname -f' reliably gives the FQDN under debian then the
'cern-httpd' source should be patched to use it.    

My debian version is 1.1.7, kernel version 2.0.7 and libc 5.2.18.  

-- 
Regards,
Ian Maclaine-cross ([email-masked])