]> git.ipfire.org Git - people/ms/dma.git/commitdiff
Add NULLCLIENT support
authorBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 12 Feb 2014 23:43:48 +0000 (00:43 +0100)
committerSimon Schubert <2@0x2c.org>
Thu, 13 Feb 2014 16:56:05 +0000 (17:56 +0100)
conf.c
dma.8
dma.c
dma.conf
dma.h

diff --git a/conf.c b/conf.c
index 6e4eb2511b4c26205359e00981bfb3c67c82fd09..919ab7c4d77ebad6c9014ac5392301a2c5bcdd27 100644 (file)
--- 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 50da6fb14159f9a5a83fac4e6dc2fff982d2e380..5d786c6be2caf9b1bc02ce524ea7ca0e8ae205fe 100644 (file)
--- 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 25af9b0569f7bfe4467c7a1ecda53d1f60f2249d..e6462f22544c0e80e5714a67b7bee138743d8cc6 100644 (file)
--- 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);
index 56fa1045e0ba87bb4d95c6ae60fb1d1187e5fc5e..1cc2bf5bc8436a8ddc125948b6b11633a0f999c2 100644 (file)
--- 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 a069ba4dcedd299962b8ab3c334ab7b0a118f3e2..4ce00944a5ee1b22972a0292806bd51e912a003b 100644 (file)
--- 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