From cbb34ec7ddd735aec6e55625259b19f869613329 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sun, 12 Jun 2005 01:15:35 +0000 Subject: [PATCH] * Provide separate filtered and unfiltered LMTP sockets. --- citadel/ChangeLog | 1 + citadel/docs/citadel.html | 13 +++++++++++-- citadel/serv_smtp.c | 27 ++++++++++++++++++++++++++- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 7d417c34f..3c075a649 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -6764,3 +6764,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/docs/citadel.html b/citadel/docs/citadel.html index f61182283..a814d7188 100644 --- a/citadel/docs/citadel.html +++ b/citadel/docs/citadel.html @@ -1945,8 +1945,17 @@ server, while keeping the existing Unix mailboxes intact.  However, it is beyond the scope of this document to detail the finer points of the configuration of Postfix or any other mailer, so refer to the documentation to those programs and keep in mind that Citadel has -LMTP support.
-

+LMTP support.

+

There are actually two LMTP sockets. One is called +lmtp.socket and the other is called lmtp-unfiltered.socket +(both are found in your Citadel directory). The difference should be +obvious: messages submitted via lmtp.socket are subject to any +spam filtering you may have configured (such as SpamAssassin), while messages +submitted via lmtp-unfiltered.socket will bypass the filters. You +would use the filtered socket when receiving mail from an external MTA such +as Postfix, but you might want to use the unfiltered socket with utilities +such as fetchmail.

+

For outbound mail, you can either allow Citadel to perform deliveries directly diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 88fd3e684..a1ff19cdd 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -92,6 +92,7 @@ struct citsmtp { /* Information about the current session */ int delivery_mode; int message_originated_locally; int is_lmtp; + int is_unfiltered; int is_msa; }; @@ -168,6 +169,16 @@ void lmtp_greeting(void) { } +/* + * We also have an unfiltered LMTP socket that bypasses spam filters. + */ +void lmtp_unfiltered_greeting(void) { + smtp_greeting(); + SMTP->is_lmtp = 1; + SMTP->is_unfiltered = 1; +} + + /* * Login greeting common to all auth methods */ @@ -454,6 +465,7 @@ void smtp_expn(char *argbuf) { */ void smtp_rset(int do_response) { int is_lmtp; + int is_unfiltered; /* * Our entire SMTP state is discarded when a RSET command is issued, @@ -461,6 +473,7 @@ void smtp_rset(int do_response) { * we save it for later. */ is_lmtp = SMTP->is_lmtp; + is_unfiltered = SMTP->is_unfiltered; memset(SMTP, 0, sizeof(struct citsmtp)); @@ -479,6 +492,7 @@ void smtp_rset(int do_response) { * Reinstate this little piece of information we saved (see above). */ SMTP->is_lmtp = is_lmtp; + SMTP->is_unfiltered = is_unfiltered; if (do_response) { cprintf("250 2.0.0 Zap!\r\n"); @@ -724,7 +738,12 @@ void smtp_data(void) { * submission (such as virus checkers or spam filters), call them now * and give them an opportunity to reject the message. */ - scan_errors = PerformMessageHooks(msg, EVT_SMTPSCAN); + if (SMTP->is_unfiltered) { + scan_errors = 0; + } + else { + scan_errors = PerformMessageHooks(msg, EVT_SMTPSCAN); + } if (scan_errors > 0) { /* We don't want this message! */ @@ -1692,6 +1711,12 @@ char *serv_smtp_init(void) smtp_command_loop, NULL); + CtdlRegisterServiceHook(0, /* local LMTP */ + "lmtp-unfiltered.socket", + lmtp_unfiltered_greeting, + smtp_command_loop, + NULL); + smtp_init_spoolout(); CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER); CtdlRegisterSessionHook(smtp_cleanup_function, EVT_STOP); -- 2.39.2