Package: nullmailer
Version: 1:2.2-3+b1
Severity: normal

Hi,

I began using a revision tracking system for some configfiles. This involved 
replacing /etc/nullmailer with a symlink to a directory within the local 
working copy.

I noticed that locally generated mail was suddenly referencing literal 
"defaulthost".

I tried to create /etc/nullmailer/me with the correct hostname in it, but this 
didn't help. I attached strace to cron in an attempt to see what was going on 
and found this:

openat(AT_FDCWD, "/etc/nullmailer/me", O_RDONLY) = 
3</path-to-working-copy/<...>/etc/nullmailer/me>
read(3</path-to-working-copy/<...>/etc/nullmailer/me>, 
"my-correct-hostname-here\n", 4096) = 27
close(3</path-to-working-copy/<...>/etc/nullmailer/me>) = 0  
write(2</dev/console<char 5:1>>, "Warning: On Debian systems, nullmailer's 'me' 
is disregarded; please use '/etc/mailname' instead.\n", 98) = 98
getuid()                                = 0
geteuid()                               = 0
openat(AT_FDCWD, "/etc/nullmailer/../mailname", O_RDONLY) = -1 ENOENT (No such 
file or directory)

So, while nullmailer prints a message instructing me to fill /etc/mailname, it 
doesn't actually use /etc/mailname but /etc/nullmailer/../mailname, which 
doesn't necessarily exist and isn't necessarily the correct file if 
/etc/nullmailer is a symlink.

Also, printing messages to /dev/console isn't terribly useful in the case of 
remote headless servers.

I suggest the following changes:

1. in order to avoid violating the principle of least surprise, don't disregard 
/etc/nullmailer/me. If it's there, the admin put it there for a reason.

2. if /etc/nullmailer/me doesn't exist, default to "/etc/mailname", not 
"/etc/nullmailer/../mailname".

3. if these two changes are made, the message becomes unnecessary and can be a 
simple README.Debian item.

4. if you must print a message, log it to syslog instead of (or, if you insist, 
in addition to) writing it to /dev/console. However, can't writing to 
/dev/console block e.g. due to flow control on the terminal device? If so, I'd 
leave /dev/console alone.

Best regards,

AndrĂ¡s

-- 
     Mishearing the voices in his head, our hero wonders how he's supposed
                              to kill the mall.

Reply via email to