* Provide separate filtered and unfiltered LMTP sockets.
authorArt Cancro <ajc@citadel.org>
Sun, 12 Jun 2005 01:15:35 +0000 (01:15 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 12 Jun 2005 01:15:35 +0000 (01:15 +0000)
citadel/ChangeLog
citadel/docs/citadel.html
citadel/serv_smtp.c

index 7d417c34f093506b65a101b5c1b713e28fb2cd46..3c075a6498beaf2fdf2d20d15a0eff90808577d6 100644 (file)
@@ -6764,3 +6764,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index f61182283f30d373b9b9fd0e1a7be436591152ed..a814d71883c402b8b2aab38edf9957002ea730d1 100644 (file)
@@ -1945,8 +1945,17 @@ server, while keeping the existing Unix mailboxes intact.&nbsp;
 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.<span style="font-family: monospace;"><br>
-</span></p>
+LMTP support.<span style="font-family: monospace;"></p>
+<p>There are actually <i>two</i> LMTP sockets.  One is called
+<tt>lmtp.socket</tt> and the other is called <tt>lmtp-unfiltered.socket</tt>
+(both are found in your Citadel directory).  The difference should be
+obvious: messages submitted via <tt>lmtp.socket</tt> are subject to any
+spam filtering you may have configured (such as SpamAssassin), while messages
+submitted via <tt>lmtp-unfiltered.socket</tt> 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.</p>
+<br>
 <p>For outbound mail, you
 can either allow Citadel to perform
 deliveries directly
index 88fd3e684f43a43f80c0ceb100eb2faeab89df23..a1ff19cddcc999c12533618c4c7b67e659a913e4 100644 (file)
@@ -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);