From bb488b28382671f06f163719fd55da18fc2ec4d9 Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Tue, 3 Mar 2026 10:37:27 +0000 Subject: [PATCH 1/2] Support relaying to an LMTP endpoint This adds support for speaking LMTP to the relay. It's useful to bypass MTAs in case an LMTP-aware service, e.g., Dovecot, is running locally-ish. --- conf.c | 7 +++++++ dma.h | 1 + net.c | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf.c b/conf.c index 84b574b..857ba1d 100644 --- a/conf.c +++ b/conf.c @@ -198,6 +198,8 @@ parse_conf(const char *config_path) config.authpath= data; else if (strcmp(word, "CERTFILE") == 0 && data != NULL) config.certfile = data; + else if (strcmp(word, "LMTP") == 0 && data == NULL) + config.features |= LMTP; else if (strcmp(word, "MAILNAME") == 0 && data != NULL) config.mailname = data; else if (strcmp(word, "MASQUERADE") == 0 && data != NULL) { @@ -259,5 +261,10 @@ parse_conf(const char *config_path) /* NOTREACHED */ } + if ((config.features & LMTP) && (config.features & (TLS_OPP | STARTTLS | SECURETRANSFER))) { + errlogx(EX_CONFIG, "%s: LMTP does not support TLS", config_path); + /* NOTREACHED */ + } + fclose(conf); } diff --git a/dma.h b/dma.h index 41588eb..7849a99 100644 --- a/dma.h +++ b/dma.h @@ -71,6 +71,7 @@ #define TLS_OPP 0x080 /* Opportunistic STARTTLS */ #define NULLCLIENT 0x100 /* Nullclient support */ #define VERIFYCERT 0x200 /* Verify remote host's certificate against CA */ +#define LMTP 0x300 /* Use LMTP instead of SMTP with the relay */ #ifndef CONF_PATH #error Please define CONF_PATH diff --git a/net.c b/net.c index 81b304b..7b2c2d2 100644 --- a/net.c +++ b/net.c @@ -390,7 +390,7 @@ int perform_server_greeting(int fd, struct smtp_features* features) { Send EHLO XXX allow HELO fallback */ - send_remote_command(fd, "EHLO %s", hostname()); + send_remote_command(fd, "%s %s", config.features & LMTP ? "LHLO" : "EHLO", hostname()); char buffer[EHLO_RESPONSE_SIZE]; memset(buffer, 0, sizeof(buffer)); From e1ab243f9067800380a048594eeac6ca3121a230 Mon Sep 17 00:00:00 2001 From: Pietro Cerutti Date: Tue, 3 Mar 2026 12:54:22 +0000 Subject: [PATCH 2/2] Fix LMTP flag --- dma.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dma.h b/dma.h index 7849a99..ad7191c 100644 --- a/dma.h +++ b/dma.h @@ -71,7 +71,7 @@ #define TLS_OPP 0x080 /* Opportunistic STARTTLS */ #define NULLCLIENT 0x100 /* Nullclient support */ #define VERIFYCERT 0x200 /* Verify remote host's certificate against CA */ -#define LMTP 0x300 /* Use LMTP instead of SMTP with the relay */ +#define LMTP 0x400 /* Use LMTP instead of SMTP with the relay */ #ifndef CONF_PATH #error Please define CONF_PATH