Comment 11 for bug 8980

Revision history for this message
Scott Kitterman (kitterman) wrote :

This problem is still present in Dapper. Among other things it affects the ability of Postfix to operate as configured in Ubuntu:

From Postconf 5:

http://www.postfix.org/postconf.5.html#myhostname

"The default is to use the fully-qualified domain name from gethostname."

So, Postfix is expecting the standard C function gethostname to produce a
FQDN. I decided to test this. First by removing myhostname from main.cf and
then by accessing the C function as directly as I could. Fortunately, Python
gives almost direct access to this function in its socket module:

http://www.python.org/doc/2.4.3/lib/module-socket.html

So, through Python, I call the same function (this is on an Ubuntu server):

mailout00:~$ python
Python 2.4.3 (#2, Apr 27 2006, 14:43:58)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> print socket.gethostname()
mailout00

Just the machine name, not a FQDN.

Here is the same thing on a FreeBSD 4.8-STABLE machine:

raung% python
Python 2.4.1 (#1, Jun 10 2005, 16:38:07)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> print socket.gethostname()
raung.pair.com

Just to make sure, Python also has another function called getfqdn.

Ubuntu:

mailout00:~$ python
Python 2.4.3 (#2, Apr 27 2006, 14:43:58)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> print socket.getfqdn()
mailout00

FreeBSD:

raung% python
Python 2.4.1 (#1, Jun 10 2005, 16:38:07)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> print socket.getfqdn()
raung.pair.com