* Removal of individual "remote" lines from message delivery instruction sets
authorArt Cancro <ajc@citadel.org>
Sat, 26 Apr 2003 04:22:51 +0000 (04:22 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 26 Apr 2003 04:22:51 +0000 (04:22 +0000)
  was corrupting the end of the set, rendering the "bounceto" line unusable
  and preventing bounces from being delivered.  Fixed this by explicitly
  adding a trailing newline when remove_token() strips it.

citadel/ChangeLog
citadel/serv_smtp.c

index d27c6052ac3813e481379c0db98f524b022973a2..f2edb0be7c1ecc56f1fb9d723bbb086614ef25c6 100644 (file)
@@ -1,4 +1,10 @@
  $Log$
+ Revision 605.38  2003/04/26 04:22:51  ajc
+ * Removal of individual "remote" lines from message delivery instruction sets
+   was corrupting the end of the set, rendering the "bounceto" line unusable
+   and preventing bounces from being delivered.  Fixed this by explicitly
+   adding a trailing newline when remove_token() strips it.
+
  Revision 605.37  2003/04/25 18:28:47  ajc
  * When rejecting spam, use SMTP error code 550, not 552
 
@@ -4640,4 +4646,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 f19b37671648684fb2f9aeb2b3d0a33879b8c6f9..992ed676f1132523615d349739579bd207b14b0e 100644 (file)
@@ -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);