From: Baptiste Daroussin Date: Wed, 12 Feb 2014 23:43:48 +0000 (+0100) Subject: Add NULLCLIENT support X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e882bde89cf35e8009164cb4e84545c74b8cea58;p=people%2Fms%2Fdma.git Add NULLCLIENT support --- diff --git a/conf.c b/conf.c index 6e4eb25..919ab7c 100644 --- a/conf.c +++ b/conf.c @@ -229,11 +229,18 @@ parse_conf(const char *config_path) config.features |= INSECURE; else if (strcmp(word, "FULLBOUNCE") == 0 && data == NULL) config.features |= FULLBOUNCE; + else if (strcmp(word, "NULLCLIENT") == 0 && data == NULL) + config.features |= NULLCLIENT; else { errlogx(1, "syntax error in %s:%d", config_path, lineno); /* NOTREACHED */ } } + if ((config.features & NULLCLIENT) && config.smarthost == NULL) { + errlogx(1, "%s: NULLCLIENT requires SMARTHOST", config_path); + /* NOTREACHED */ + } + fclose(conf); } diff --git a/dma.8 b/dma.8 index 50da6fb..5d786c6 100644 --- a/dma.8 +++ b/dma.8 @@ -29,7 +29,7 @@ .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd April 22, 2010 +.Dd February 13, 2014 .Dt DMA 8 .Os .Sh NAME @@ -306,6 +306,15 @@ setting it to will send all mails as .Ql Sm off Va username @percolator . .Sm on +.It Ic NULLCLIENT Xo +.Xc +Bypass aliases and local delivery, and instead forward all mails to +the defined +.Sq SMARTHOST . +.Sq NULLCLIENT +requires +.Sq SMARTHOST +to be set. .El .Ss Environment variables The behavior of diff --git a/dma.c b/dma.c index 25af9b0..e6462f2 100644 --- a/dma.c +++ b/dma.c @@ -202,7 +202,12 @@ add_recp(struct queue *queue, const char *str, int expand) } } LIST_INSERT_HEAD(&queue->queue, it, next); - if (strrchr(it->addr, '@') == NULL) { + + /** + * Do local delivery if there is no @. + * Do not do local delivery when NULLCLIENT is set. + */ + if (strrchr(it->addr, '@') == NULL && (config.features & NULLCLIENT) == 0) { it->remote = 0; if (expand) { aliased = do_alias(queue, it->addr); diff --git a/dma.conf b/dma.conf index 56fa104..1cc2bf5 100644 --- a/dma.conf +++ b/dma.conf @@ -61,3 +61,6 @@ # MASQUERADE john@ on host "hamlet" will send all mails as john@hamlet # MASQUERADE percolator will send mails as $username@percolator, e.g. fish@percolator # MASQUERADE herb@ert will send all mails as herb@ert + +# Directly forward the mail to the SMARTHOST bypassing aliases and local delivery +#NULLCLIENT diff --git a/dma.h b/dma.h index a069ba4..4ce0094 100644 --- a/dma.h +++ b/dma.h @@ -66,6 +66,7 @@ #define INSECURE 0x020 /* Allow plain login w/o encryption */ #define FULLBOUNCE 0x040 /* Bounce the full message */ #define TLS_OPP 0x080 /* Opportunistic STARTTLS */ +#define NULLCLIENT 0x100 /* Nullclient support */ #ifndef CONF_PATH #error Please define CONF_PATH