summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Guenter <bruce@untroubled.org>2007-10-09 12:13:22 -0600
committerBruce Guenter <bruce@untroubled.org>2007-10-09 12:13:22 -0600
commitc04e92eb8bcd99f16a908e48e8bee1673488ccf8 (patch)
treee2aca3729c76d1930550d06fa59aa880e76cb960
parent5038832d2067dbf30903bc2273b8673904fab11b (diff)
Do not canonicalize *@localhost addresses.
-rw-r--r--NEWS3
-rw-r--r--doc/nullmailer-inject.14
-rw-r--r--lib/canonicalize.cc4
-rw-r--r--test/tests/inject/from4
-rw-r--r--test/tests/inject/sender4
5 files changed, 16 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index f5c9027..9f379b0 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ This file lists all the major user-visible changes to nullmailer.
-------------------------------------------------------------------------------
Changes in version 1.04
+- Fixed rewriting mail to @localhost if defaultdomain is set by not
+ appending .defaultdomain to *@localhost.
+
- Added support for reporting the sender and recipients in mailq.
- Added a send timeout in nullmailer-send, to kill sending messages that
diff --git a/doc/nullmailer-inject.1 b/doc/nullmailer-inject.1
index f990d43..58c7fcd 100644
--- a/doc/nullmailer-inject.1
+++ b/doc/nullmailer-inject.1
@@ -220,7 +220,9 @@ of all leading and trailing whitespace characters.
.TP
.B defaultdomain
The content of this file is appended to any host name that does not
-contain a period, including
+contain a period (except
+.IR localhost ),
+including
.BR defaulthost
and
.BR idhost .
diff --git a/lib/canonicalize.cc b/lib/canonicalize.cc
index c70509b..b8f0e91 100644
--- a/lib/canonicalize.cc
+++ b/lib/canonicalize.cc
@@ -1,5 +1,5 @@
// nullmailer -- a simple relay-only MTA
-// Copyright (C) 1999-2003 Bruce Guenter <bruce@untroubled.org>
+// Copyright (C) 2007 Bruce Guenter <bruce@untroubled.org>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ void canonicalize(mystring& domain)
{
if(!domain)
domain = defaulthost;
- if(domain.find_first('.') < 0) {
+ if(domain != "localhost" && domain.find_first('.') < 0) {
if(!!defaultdomain) {
if (!!domain) domain += ".";
domain += defaultdomain;
diff --git a/test/tests/inject/from b/test/tests/inject/from
index fac0a7f..001b185 100644
--- a/test/tests/inject/from
+++ b/test/tests/inject/from
@@ -35,6 +35,10 @@ echo test >$SYSCONFDIR/defaulthost
echo domain.org >$SYSCONFDIR/defaultdomain
inj | grep -q '@test.domain.org>$'
+echo "Checking that inject ignores config/defaultdomain for localhost"
+echo localhost >$SYSCONFDIR/defaulthost
+inj | grep -q '@localhost>$'
+
testvar HOSTNAME test1.org '@test1.org>$'
testvar MAILHOST test2.org '@test2.org>$'
diff --git a/test/tests/inject/sender b/test/tests/inject/sender
index 20325d9..07da970 100644
--- a/test/tests/inject/sender
+++ b/test/tests/inject/sender
@@ -34,6 +34,10 @@ echo test >$SYSCONFDIR/defaulthost
echo domain.org >$SYSCONFDIR/defaultdomain
inj | grep -q '@test.domain.org$'
+echo "Checking that inject ignores config/defaultdomain for localhost"
+echo localhost >$SYSCONFDIR/defaulthost
+inj | grep -q '@localhost$'
+
testvar HOSTNAME test1.org '@test1.org$'
testcanon HOSTNAME test1 '@test1.domain.org$'