From: Art Cancro Date: Wed, 5 Mar 2003 04:55:32 +0000 (+0000) Subject: * serv_smtp.c: when authenticated, do not log out when a RSET command is X-Git-Tag: v7.86~5984 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=55bc9044eedab7ed06544a67cb839dff2cd2dbb6;p=citadel.git * serv_smtp.c: when authenticated, do not log out when a RSET command is issued. This breaks clients which carelessly issue RSET before each message, such as Pine. * serv_smtp.c: when authenticated, ignore envelope FROM: sender name and replace with address of user who authenticated. Also fixes Pine. * serv_smtp.c: when authenticated, not only do we continue our glorious RFC-violating condition of replacing the From: header with the user who is logged in, but we also stamp it with their preferred Internet address for outbound mail (which is kept in CC->cs_inet_email). --- diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 4d4818185..b08e4db12 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,15 @@ $Log$ + Revision 605.8 2003/03/05 04:55:32 ajc + * serv_smtp.c: when authenticated, do not log out when a RSET command is + issued. This breaks clients which carelessly issue RSET before each + message, such as Pine. + * serv_smtp.c: when authenticated, ignore envelope FROM: sender name + and replace with address of user who authenticated. Also fixes Pine. + * serv_smtp.c: when authenticated, not only do we continue our glorious + RFC-violating condition of replacing the From: header with the user who + is logged in, but we also stamp it with their preferred Internet address + for outbound mail (which is kept in CC->cs_inet_email). + Revision 605.7 2003/03/03 04:09:21 ajc * When creating a user, hide the "My Citadel Config>" room of the user being created, not the user currently logged in. @@ -4506,4 +4517,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 2cb0ed4aa..146977c9a 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -314,9 +314,18 @@ void smtp_expn(char *argbuf) { */ void smtp_rset(void) { memset(SMTP, 0, sizeof(struct citsmtp)); - if (CC->logged_in) { - logout(CC); - } + + /* + * It is somewhat ambiguous whether we want to log out when a RSET + * command is issued. Here's the code to do it. It is commented out + * because some clients (such as Pine) issue RSET commands before + * each message, but still expect to be logged in. + * + * if (CC->logged_in) { + * logout(CC); + * } + */ + cprintf("250 Zap!\r\n"); } @@ -341,7 +350,6 @@ void smtp_mail(char *argbuf) { char user[SIZ]; char node[SIZ]; char name[SIZ]; - struct recptypes *valid; if (strlen(SMTP->from) != 0) { cprintf("503 Only one sender permitted\r\n"); @@ -362,26 +370,16 @@ void smtp_mail(char *argbuf) { return; } - /* If this SMTP connection is from a logged-in user, make sure that - * the user only sends email from his/her own address. + /* If this SMTP connection is from a logged-in user, force the 'from' + * to be the user's Internet e-mail address as Citadel knows it. */ if (CC->logged_in) { - valid = validate_recipients(SMTP->from); - if ( (valid->num_local == 1) && - (!strcasecmp(valid->recp_local, CC->usersupp.fullname)) ) { - cprintf("250 Sender ok <%s>\r\n", valid->recp_local); - SMTP->message_originated_locally = 1; - } - else { - cprintf("550 <%s> is not your address.\r\n", - SMTP->from); - strcpy(SMTP->from, ""); - } - phree(valid); + strcpy(SMTP->from, CC->cs_inet_email); + cprintf("250 Sender ok <%s>\r\n", SMTP->from); + SMTP->message_originated_locally = 1; return; } - /* Otherwise, make sure outsiders aren't trying to forge mail from * this system. */ @@ -516,9 +514,11 @@ void smtp_data(void) { 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']); + if (msg->cm_fields['F'] != NULL) phree(msg->cm_fields['F']); msg->cm_fields['A'] = strdoop(CC->usersupp.fullname); msg->cm_fields['N'] = strdoop(config.c_nodename); msg->cm_fields['H'] = strdoop(config.c_humannode); + msg->cm_fields['F'] = strdoop(CC->cs_inet_email); } /* Submit the message into the Citadel system. */ @@ -574,6 +574,8 @@ void smtp_command_loop(void) { lprintf(5, "SMTP: %s\n", cmdbuf); while (strlen(cmdbuf) < 5) strcat(cmdbuf, " "); + lprintf(9, "CC->logged_in = %d\n", CC->logged_in); + if (SMTP->command_state == smtp_user) { smtp_get_user(cmdbuf); }