Heiko Schlichting
2008-Aug-13 08:42 UTC
[Dovecot] RfE: use HOSTNAME environment variable in hostpid_init()
Hi, All parts of dovecot except deliver uses the result of hostpid_init() in src/lib/hostpid.c as a hostname which only asks gethostname(). deliver honours environment variable HOSTNAME in src/deliver/deliver.c: getenv("HOSTNAME"); and uses the hostname of hostpid_init() as a fallback. Wouldn't it be consequent to evaluate the environment variable HOSTNAME in hostpid_init() with fallback to gethostname() and remove the special behavior from deliver? The dovecot master process should export $HOSTNAME to all childs in this case. Motivation: Dovecot uses the hostname as part of Maildir file names and gethostname() is not fully qualified on all operating systems (it is on IRIX but not on Linux). But unqualified hostnames are not unique and it is frequent that dovecot hosts are named "mail" oder "imap" as hostname. To distinguish between mail.domain1.com and mail.domain2.net would be easier if dovecot evaluate $HOSTNAME in all case not just deliver as program imap can create Maildir files as well. Heiko Heiko Schlichting Freie Universit?t Berlin heiko at FU-Berlin.DE Zentraleinrichtung f?r Datenverarbeitung (ZEDAT) Telefon +49 30 838-54327 Fabeckstra?e 32 Telefax +49 30 838454327 14195 Berlin
Timo Sirainen
2008-Aug-13 18:48 UTC
[Dovecot] RfE: use HOSTNAME environment variable in hostpid_init()
On Aug 13, 2008, at 4:42 AM, Heiko Schlichting wrote:> All parts of dovecot except deliver uses the result of > hostpid_init() in > src/lib/hostpid.c as a hostname which only asks gethostname(). > > deliver honours environment variable HOSTNAME in src/deliver/ > deliver.c: > > getenv("HOSTNAME"); > > and uses the hostname of hostpid_init() as a fallback.Well, this is actually trying to use the hostname setting from dovecot.conf. The settings just happen to get passed in environment.> Wouldn't it be consequent to evaluate the environment variable > HOSTNAME in > hostpid_init() with fallback to gethostname() and remove the special > behavior from deliver? The dovecot master process should export > $HOSTNAME > to all childs in this case.Another alternative would be to make the hostname setting global in dovecot.conf and have imap processes use that.> Dovecot uses the hostname as part of Maildir file names and > gethostname() > is not fully qualified on all operating systems (it is on IRIX but > not on > Linux). But unqualified hostnames are not unique and it is frequent > that > dovecot hosts are named "mail" oder "imap" as hostname. To distinguish > between mail.domain1.com and mail.domain2.net would be easier if > dovecot > evaluate $HOSTNAME in all case not just deliver as program imap can > create > Maildir files as well.I always thought that hostnames were unique within the installation everywhere even without the domain part, and the domain would just waste disk space in the filenames (and dovecot-uidlist).. -------------- next part -------------- A non-text attachment was scrubbed... Name: PGP.sig Type: application/pgp-signature Size: 194 bytes Desc: This is a digitally signed message part URL: <http://dovecot.org/pipermail/dovecot/attachments/20080813/97541bee/attachment-0002.bin>