]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_smtp.c
* Added a site-configurable setting to suppress the automatic correction of
[citadel.git] / citadel / serv_smtp.c
index f19b37671648684fb2f9aeb2b3d0a33879b8c6f9..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']);
@@ -761,7 +762,6 @@ void smtp_try(const char *key, const char *addr, int *status,
                snprintf(dsn, SIZ, "Could not connect: %s", strerror(errno));
                if (sock >= 0) lprintf(9, "Connected!\n");
                if (sock < 0) snprintf(dsn, SIZ, "%s", strerror(errno));
-               if (sock >= 0) break;
        }
 
        if (sock < 0) {
@@ -1006,7 +1006,6 @@ void smtp_do_bounce(char *instr) {
        /*
         * Now go through the instructions checking for stuff.
         */
-
        for (i=0; i<lines; ++i) {
                extract_token(buf, instr, i, '\n');
                extract(key, buf, 0);
@@ -1236,7 +1235,16 @@ void smtp_do_procmsg(long msgnum, void *userdata) {
                extract(dsn, buf, 3);
                if ( (!strcasecmp(key, "remote"))
                   && ((status==0)||(status==3)||(status==4)) ) {
+
+                       /* Remove this "remote" instruction from the set,
+                        * but replace the set's final newline if
+                        * remove_token() stripped it.  It has to be there.
+                        */
                        remove_token(instr, i, '\n');
+                       if (instr[strlen(instr)-1] != '\n') {
+                               strcat(instr, "\n");
+                       }
+
                        --i;
                        --lines;
                        lprintf(9, "SMTP: Trying <%s>\n", addr);