* Added a config option to check RBL's immediately upon
authorArt Cancro <ajc@citadel.org>
Sun, 4 Feb 2007 00:01:03 +0000 (00:01 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 4 Feb 2007 00:01:03 +0000 (00:01 +0000)
  connection instead of waiting for them to execute a RCPT command.
  (Still need to implement client config option.)
* Bumped the rev level and compatible export file level to 7.04 because
  we amended the config file format.

citadel/citadel.h
citadel/config.h
citadel/serv_smtp.c
citadel/serv_vandelay.c

index 7e6536ce54614882e444741e9cc884f37af40df0..d8025653de6886de15b9f567f052b9ccbcfecbe9 100644 (file)
@@ -47,9 +47,9 @@ extern "C" {
  * usually more strict because you're not really supposed to dump/load and
  * upgrade at the same time.
  */
-#define REV_LEVEL      703             /* This version */
+#define REV_LEVEL      704             /* This version */
 #define REV_MIN                591             /* Oldest compatible database */
-#define EXPORT_REV_MIN 701             /* Oldest compatible export files */
+#define EXPORT_REV_MIN 704             /* Oldest compatible export files */
 
 #define SERVER_TYPE 0  /* zero for stock Citadel; other developers please
                           obtain SERVER_TYPE codes for your implementations */
index 1dd6c8b929e6c3b5119f4fa31ab51a0a9766cdd8..176aaf45fe1513a9055d4c6a82154c9f5fcfc149 100644 (file)
@@ -80,6 +80,7 @@ struct config {
        int c_funambol_port;            /* Funambol port */
        char c_funambol_source[256];    /* Funambol sync source */
        char c_funambol_auth[256];      /* Funambol auth details */
+       char c_rbl_at_greeting;         /* Check RBL's at connect instead of after RCPT */
 };
 
 
index 88907a2605e790ec99cb8365bf41317c58b857f1..cc05b14db57964360aeeaf08112c18d14a8d34bd 100644 (file)
@@ -128,7 +128,9 @@ int run_queue_now = 0;      /* Set to 1 to ignore SMTP send retry times */
 /*
  * Here's where our SMTP session begins its happy day.
  */
-void smtp_greeting(void) {
+void smtp_greeting(void)
+{
+       char message_to_spammer[1024];
 
        strcpy(CC->cs_clientname, "SMTP session");
        CC->internal_pgm = 1;
@@ -140,6 +142,19 @@ void smtp_greeting(void) {
        memset(SMTP_RECPS, 0, SIZ);
        memset(SMTP_ROOMS, 0, SIZ);
 
+       /* If this config option is set, reject connections from problem
+        * addresses immediately instead of after they execute a RCPT
+        */
+       if (config.c_rbl_at_greeting) {
+               if (rbl_check(message_to_spammer)) {
+                       cprintf("550 %s\r\n", message_to_spammer);
+                       CC->kill_me = 1;
+                       /* no need to free(valid), it's not allocated yet */
+                       return;
+               }
+       }
+
+       /* Otherwise we're either clean or we check later. */
        cprintf("220 %s ESMTP Citadel server ready.\r\n", config.c_fqdn);
 }
 
@@ -637,12 +652,14 @@ void smtp_rcpt(char *argbuf) {
        }
 
        /* RBL check */
-       if ( (!CC->logged_in)
-          && (!SMTP->is_lmtp) ) {
-               if (rbl_check(message_to_spammer)) {
-                       cprintf("550 %s\r\n", message_to_spammer);
-                       /* no need to free(valid), it's not allocated yet */
-                       return;
+       if ( (!CC->logged_in)   /* Don't RBL authenticated users */
+          && (!SMTP->is_lmtp) ) {      /* Don't RBL LMTP clients */
+               if (config.c_rbl_at_greeting == 0) {    /* Don't RBL again if we already did it */
+                       if (rbl_check(message_to_spammer)) {
+                               cprintf("550 %s\r\n", message_to_spammer);
+                               /* no need to free(valid), it's not allocated yet */
+                               return;
+                       }
                }
        }
 
index 0ab094f054bd2e82dc7f3f1fa9b0cb8972160328..9152160eaafd2c7e059d6ec68ab6f770ec854be3 100644 (file)
@@ -324,6 +324,7 @@ void artv_do_export(void) {
        cprintf("%d\n", config.c_funambol_port);
        cprintf("%s\n", config.c_funambol_source);
        cprintf("%s\n", config.c_funambol_auth);
+       cprintf("%d\n", config.c_rbl_at_greeting);
 
        /* Export the control file */
        get_control();
@@ -412,6 +413,7 @@ void artv_import_config(void) {
        client_getln(buf, sizeof buf); config.c_funambol_port = atoi(buf);
        client_getln(config.c_funambol_source, sizeof config.c_funambol_source);
        client_getln(config.c_funambol_auth, sizeof config.c_funambol_auth);
+       client_getln(buf, sizeof buf);  config.c_rbl_at_greeting = atoi(buf);
        
        config.c_enable_fulltext = 0;   /* always disable */
        put_config();