- {
- case '2': /* Accept. Do the same to the source; dump any spoolfiles. */
- /* logging was done in finaldot() */
- if(data_file != NULL)
- {
- sprintf(CS spool_name, "%s/input/%s/%s-D", spool_directory,
- message_subdir, message_id);
- Uunlink(spool_name);
- sprintf(CS spool_name, "%s/input/%s/%s-H", spool_directory,
- message_subdir, message_id);
- Uunlink(spool_name);
- sprintf(CS spool_name, "%s/msglog/%s/%s", spool_directory,
- message_subdir, message_id);
- Uunlink(spool_name);
- }
- break;
-
- default: /* Unknown response, or error. Treat as temp-reject. */
- case '4': /* Temp-reject. If we wrote spoolfiles, keep them and accept. */
- /* If not, temp-reject the source. */
- /*XXX could we mark the spoolfile queue-only or already-tried? */
- log_write(0, LOG_MAIN, "cutthrough target temp-reject: %s", msg);
- if(data_file == NULL)
- smtp_reply= msg; /* Pass on the exact error */
- break;
-
- case '5': /* Perm-reject. Do the same to the source. Dump any spoolfiles */
- log_write(0, LOG_MAIN, "cutthrough target perm-reject: %s", msg);
- smtp_reply= msg; /* Pass on the exact error */
- if(data_file != NULL)
- {
- sprintf(CS spool_name, "%s/input/%s/%s-D", spool_directory,
- message_subdir, message_id);
- Uunlink(spool_name);
- sprintf(CS spool_name, "%s/input/%s/%s-H", spool_directory,
- message_subdir, message_id);
- Uunlink(spool_name);
- sprintf(CS spool_name, "%s/msglog/%s/%s", spool_directory,
- message_subdir, message_id);
- Uunlink(spool_name);
- }
- break;
- }
+ {
+ case '2': /* Accept. Do the same to the source; dump any spoolfiles. */
+ cutthrough_done = 3;
+ break; /* message_id needed for SMTP accept below */
+
+ default: /* Unknown response, or error. Treat as temp-reject. */
+ case '4': /* Temp-reject. Keep spoolfiles and accept. */
+ cutthrough_done = 1; /* Avoid the usual immediate delivery attempt */
+ break; /* message_id needed for SMTP accept below */
+
+ case '5': /* Perm-reject. Do the same to the source. Dump any spoolfiles */
+ smtp_reply= msg; /* Pass on the exact error */
+ cutthrough_done = 2;
+ break;
+ }