diff options
author | 2018-12-20 19:45:17 +0000 | |
---|---|---|
committer | 2018-12-20 19:45:17 +0000 | |
commit | 491034f33f90ba5fac1a23e757eaf9e4d616c1f3 (patch) | |
tree | 700df09194c4be119a4b43bab38cfd0333e1d0c9 | |
parent | change the format of ssl_to_text() to match that of io's, this only affect (diff) | |
download | wireguard-openbsd-491034f33f90ba5fac1a23e757eaf9e4d616c1f3.tar.xz wireguard-openbsd-491034f33f90ba5fac1a23e757eaf9e4d616c1f3.zip |
use the machine hostname, not localhost, in mail.maildir.c
spotted and ok tedu@
-rw-r--r-- | usr.sbin/smtpd/mail.maildir.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/mail.maildir.c b/usr.sbin/smtpd/mail.maildir.c index 7612a7343f2..6352aa745ef 100644 --- a/usr.sbin/smtpd/mail.maildir.c +++ b/usr.sbin/smtpd/mail.maildir.c @@ -20,6 +20,7 @@ #include <sys/types.h> #include <sys/stat.h> +#include <sys/param.h> #include <ctype.h> #include <err.h> @@ -114,6 +115,7 @@ maildir_engine(const char *dirname, int junk) char extpath[PATH_MAX]; char subdir[PATH_MAX]; char filename[PATH_MAX]; + char hostname[MAXHOSTNAMELEN]; char tmp[PATH_MAX]; char new[PATH_MAX]; @@ -165,10 +167,13 @@ maildir_engine(const char *dirname, int junk) } } + if (gethostname(hostname, sizeof hostname) != 0) + (void)strlcpy(hostname, "localhost", sizeof hostname); + (void)snprintf(filename, sizeof filename, "%lld.%08x.%s", (long long int) time(NULL), arc4random(), - "localhost"); + hostname); (void)snprintf(tmp, sizeof tmp, "%s/tmp/%s", dirname, filename); |