From 3b01a3bd79ac483ce247a81d0f47325af94792a7 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 28 Apr 2003 16:56:51 +0000 Subject: [PATCH] * 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. --- citadel/ChangeLog | 6 +++++- citadel/citadel.h | 2 +- citadel/control.c | 6 ++++-- citadel/routines2.c | 14 ++++++++++++-- citadel/serv_smtp.c | 5 +++-- citadel/serv_upgrade.c | 10 ++++++++++ citadel/techdoc/session.txt | 2 +- 7 files changed, 36 insertions(+), 9 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 9485bc4b7..9a740dc95 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/citadel.h b/citadel/citadel.h index 40df05138..7fff11ec1 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -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 */ diff --git a/citadel/control.c b/citadel/control.c index c7c534139..80b72fd8c 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -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) diff --git a/citadel/routines2.c b/citadel/routines2.c index 111864869..bf81df744 100644 --- a/citadel/routines2.c +++ b/citadel/routines2.c @@ -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); diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index d5b4106d3..afb6bc0dc 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -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']); diff --git a/citadel/serv_upgrade.c b/citadel/serv_upgrade.c index 55840f88a..5c28f0d27 100644 --- a/citadel/serv_upgrade.c +++ b/citadel/serv_upgrade.c @@ -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(); diff --git a/citadel/techdoc/session.txt b/citadel/techdoc/session.txt index 361d4b82d..4d2daa0a4 100644 --- a/citadel/techdoc/session.txt +++ b/citadel/techdoc/session.txt @@ -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 -- 2.39.2