]> code.citadel.org Git - citadel.git/commitdiff
* Added a site-configurable setting to suppress the automatic correction of
authorArt Cancro <ajc@citadel.org>
Mon, 28 Apr 2003 16:56:51 +0000 (16:56 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 28 Apr 2003 16:56:51 +0000 (16:56 +0000)
  forged From: lines from authenticated SMTP users, for those who prefer
  strict RFC compliance instead of common sense.

citadel/ChangeLog
citadel/citadel.h
citadel/control.c
citadel/routines2.c
citadel/serv_smtp.c
citadel/serv_upgrade.c
citadel/techdoc/session.txt

index 9485bc4b7a0f56691824033436f0215b4c28f669..9a740dc9501989dd480d3aa919439890737c177c 100644 (file)
@@ -1,4 +1,9 @@
  $Log$
+ Revision 605.40  2003/04/28 16:56:51  ajc
+ * Added a site-configurable setting to suppress the automatic correction of
+   forged From: lines from authenticated SMTP users, for those who prefer
+   strict RFC compliance instead of common sense.
+
  Revision 605.39  2003/04/26 21:55:15  ajc
  * Anytime a socket connect() fails, CLOSE THE SOCKET before erroring out.
    Not doing so causes a file descriptor leak.
@@ -4650,4 +4655,3 @@ 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 40df051384d2feb19ba0e43a78a39cb5666099c8..7fff11ec189fa915e89be46f63c29d6d27e3d8f1 100644 (file)
@@ -121,7 +121,7 @@ struct config {
        int c_max_workers;              /* Upper limit on number of threads */
        int c_pop3_port;                /* POP3 listener port (usually 110) */
        int c_smtp_port;                /* SMTP listener port (usually 25)  */
-       int c_unused_1;                 /* Nothin' here anymore...          */
+       int c_rfc822_strict_from;       /* 1 = don't correct From: forgeries*/
        int c_aide_zap;                 /* Are Aides allowed to zap rooms?  */
        int c_imap_port;                /* IMAP listener port (usually 143) */
        time_t c_net_freq;              /* how often to run the networker   */
index c7c534139bee6d5f8c57e7e7d356f0ce0b1f7fd7..80b72fd8c5fce260f155476f74bd9f9798dd8f61 100644 (file)
@@ -190,7 +190,7 @@ void cmd_conf(char *argbuf)
                cprintf("%d\n", config.c_max_workers);
                cprintf("%d\n", config.c_pop3_port);
                cprintf("%d\n", config.c_smtp_port);
-               cprintf("0\n"); /* position 25 no longer exists */
+               cprintf("%d\n", config.c_rfc822_strict_from);
                cprintf("%d\n", config.c_aide_zap);
                cprintf("%d\n", config.c_imap_port);
                cprintf("%ld\n", config.c_net_freq);
@@ -306,7 +306,9 @@ void cmd_conf(char *argbuf)
                        case 24:
                                config.c_smtp_port = atoi(buf);
                                break;
-                               /* case 25 no longer exists */
+                       case 25:
+                               config.c_rfc822_strict_from = atoi(buf);
+                               break;
                        case 26:
                                config.c_aide_zap = atoi(buf);
                                if (config.c_aide_zap != 0)
index 111864869a63ac22e01db53c23c6b37aba6a169b..bf81df744ee7b7adc671234548a90a599bff1133 100644 (file)
@@ -694,7 +694,7 @@ void do_system_configuration(CtdlIPC *ipc)
        snprintf(sc[26], sizeof sc[26], "%d", (boolprompt(
              "Allow Aides to Zap (forget) rooms",
                                                     atoi(&sc[26][0]))));
-       snprintf(sc[30], sizeof sc[29], "%d", (boolprompt(
+       snprintf(sc[30], sizeof sc[30], "%d", (boolprompt(
              "Allow system Aides access to user mailboxes",
                                                     atoi(&sc[30][0]))));
 
@@ -722,9 +722,19 @@ void do_system_configuration(CtdlIPC *ipc)
        */
 
        strprompt("How often to run network jobs (in seconds)", &sc[28][0], 5);
-       strprompt("SMTP server port (-1 to disable)", &sc[24][0], 5);
        strprompt("POP3 server port (-1 to disable)", &sc[23][0], 5);
        strprompt("IMAP server port (-1 to disable)", &sc[27][0], 5);
+       strprompt("SMTP server port (-1 to disable)", &sc[24][0], 5);
+
+       /* This logic flips the question around, because it's one of those
+        * situations where 0=yes and 1=no
+        */
+       a = atoi(sc[25]);
+       a = (a ? 0 : 1);
+       a = boolprompt("Correct forged From: lines during authenticated SMTP",
+               a);
+       a = (a ? 0 : 1);
+       snprintf(sc[25], sizeof sc[25], "%d", a);
 
        /* Expiry settings */
        strprompt("Default user purge time (days)", &sc[16][0], 5);
index d5b4106d3a9da2ecccc0baa3052ff14505dfd00c..afb6bc0dc234c38778bd4c6d6f68d5612a44f3ca 100644 (file)
@@ -508,14 +508,15 @@ void smtp_data(void) {
 
        /* If the user is locally authenticated, FORCE the From: header to
         * show up as the real sender.  Yes, this violates the RFC standard,
-        * but IT MAKES SENSE.  Comment it out if you don't like this behavior.
+        * but IT MAKES SENSE.  If you prefer strict RFC adherence over
+        * common sense, you can disable this in the configuration.
         *
         * We also set the "message room name" ('O' field) to MAILROOM
         * (which is Mail> on most systems) to prevent it from getting set
         * to something ugly like "0000058008.Sent Items>" when the message
         * is read with a Citadel client.
         */
-       if (CC->logged_in) {
+       if ( (CC->logged_in) && (config.c_rfc822_strict_from == 0) ) {
                if (msg->cm_fields['A'] != NULL) phree(msg->cm_fields['A']);
                if (msg->cm_fields['N'] != NULL) phree(msg->cm_fields['N']);
                if (msg->cm_fields['H'] != NULL) phree(msg->cm_fields['H']);
index 55840f88a89317c89affa9d8268c53ff89c1f178..5c28f0d27f82784a793449b97f376f95b1427bb5 100644 (file)
@@ -185,6 +185,15 @@ void bump_mailbox_generation_numbers(void) {
 }
 
 
+/*
+ * This field was originally used for something else, so when we upgrade
+ * we have to initialize it to 0 in case there was trash in that space.
+ */
+void initialize_c_rfc822_strict_from(void) {
+       get_config();
+       config.c_rfc822_strict_from = 0;
+       put_config();
+}
 
 
 
@@ -206,6 +215,7 @@ void check_server_upgrades(void) {
 
        if (CitControl.version < 555) do_pre555_usersupp_upgrade();
        if (CitControl.version < 591) bump_mailbox_generation_numbers();
+       if (CitControl.version < 606) initialize_c_rfc822_strict_from();
 
        CitControl.version = REV_LEVEL;
        put_control();
index 361d4b82da61a18b44ed064d9834d75f9633c2e1..4d2daa0a4c509cddd02c6bc95bd45876f7f5a539 100644 (file)
@@ -1750,7 +1750,7 @@ fails for any reason, ERROR is returned.
  23. Maximum number of worker threads
  24. Port number for POP3 service
  25. Port number for SMTP service
- 26. (unused)
+ 26. Flag (0 or 1) - strict RFC822 adherence - don't correct From: forgeries
  27. Flag (0 or 1) - allow Aides to zap (forget) rooms
  28. Port number for IMAP service
  29. How often (in seconds) to run the networker