* serv_smtp.c: when authenticated, do not log out when a RSET command is
authorArt Cancro <ajc@citadel.org>
Wed, 5 Mar 2003 04:55:32 +0000 (04:55 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 5 Mar 2003 04:55:32 +0000 (04:55 +0000)
  issued.  This breaks clients which carelessly issue RSET before each
  message, such as Pine.
* serv_smtp.c: when authenticated, ignore envelope FROM:<xxx> 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).

citadel/ChangeLog
citadel/serv_smtp.c

index 4d4818185a8d013d57407221afe3dc4ed7a09ce0..b08e4db1213b38df0eb43f4f4928339e39644d17 100644 (file)
@@ -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:<xxx> 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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index 2cb0ed4aa7fbb3869b29ac950e41b1cce31c6546..146977c9a9a3db789d0a090b2270de57dec052c6 100644 (file)
@@ -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);
        }