Lines 17-21
Link Here
|
17 |
static void errbody __P((MCI *, ENVELOPE *, char *)); |
17 |
static bool errbody __P((MCI *, ENVELOPE *, char *)); |
18 |
static bool pruneroute __P((char *)); |
18 |
static bool pruneroute __P((char *)); |
19 |
/* |
19 |
/* |
Lines 432-443
Link Here
|
432 |
p = macvalue('g', e); |
432 |
p = macvalue('g', e); |
433 |
macdefine(&e->e_macro, A_PERM, 'g', e->e_sender); |
433 |
macdefine(&e->e_macro, A_PERM, 'g', e->e_sender); |
434 |
putfromline(&mcibuf, e); |
434 |
if (!putfromline(&mcibuf, e) || |
435 |
(*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER); |
435 |
!(*e->e_puthdr)(&mcibuf, e->e_header, e, |
436 |
(*e->e_putbody)(&mcibuf, e, NULL); |
436 |
M87F_OUTER) || |
437 |
putline("\n", &mcibuf); /* XXX EOL from FileMailer? */ |
437 |
!(*e->e_putbody)(&mcibuf, e, NULL) || |
438 |
(void) sm_io_flush(fp, SM_TIME_DEFAULT); |
438 |
!putline("\n", &mcibuf) || |
439 |
if (sm_io_error(fp) || |
439 |
sm_io_flush(fp, SM_TIME_DEFAULT) == SM_IO_EOF || |
|
|
440 |
sm_io_error(fp) || |
440 |
sm_io_close(fp, SM_TIME_DEFAULT) < 0) |
441 |
sm_io_close(fp, SM_TIME_DEFAULT) < 0) |
441 |
state = ESM_PANIC; |
442 |
state = ESM_PANIC; |
442 |
else |
443 |
else |
Lines 732-745
Link Here
|
732 |
** separator -- any possible MIME separator (unused). |
733 |
** separator -- any possible MIME separator (unused). |
733 |
** |
734 |
** |
734 |
** Returns: |
735 |
** Returns: |
735 |
** none |
736 |
** success |
736 |
** |
737 |
** |
737 |
** Side Effects: |
738 |
** Side Effects: |
738 |
** Outputs the body of an error message. |
739 |
** Outputs the body of an error message. |
739 |
*/ |
740 |
*/ |
740 |
/* ARGSUSED2 */ |
741 |
/* ARGSUSED2 */ |
741 |
static void |
742 |
static bool |
742 |
errbody(mci, e, separator) |
743 |
errbody(mci, e, separator) |
743 |
register MCI *mci; |
744 |
register MCI *mci; |
744 |
register ENVELOPE *e; |
745 |
register ENVELOPE *e; |
Lines 757-770
Link Here
|
757 |
if (bitset(MCIF_INHEADER, mci->mci_flags)) |
758 |
if (bitset(MCIF_INHEADER, mci->mci_flags)) |
758 |
{ |
759 |
{ |
759 |
putline("", mci); |
760 |
if (!putline("", mci)) |
|
|
761 |
goto writeerr; |
760 |
mci->mci_flags &= ~MCIF_INHEADER; |
762 |
mci->mci_flags &= ~MCIF_INHEADER; |
761 |
} |
763 |
} |
762 |
if (e->e_parent == NULL) |
764 |
if (e->e_parent == NULL) |
763 |
{ |
765 |
{ |
764 |
syserr("errbody: null parent"); |
766 |
syserr("errbody: null parent"); |
765 |
putline(" ----- Original message lost -----\n", mci); |
767 |
if (!putline(" ----- Original message lost -----\n", mci)) |
766 |
return; |
768 |
goto writeerr; |
|
|
769 |
return true; |
767 |
} |
770 |
} |
768 |
/* |
771 |
/* |
Lines 773-783
Link Here
|
773 |
if (e->e_msgboundary != NULL) |
776 |
if (e->e_msgboundary != NULL) |
774 |
{ |
777 |
{ |
775 |
putline("This is a MIME-encapsulated message", mci); |
|
|
776 |
putline("", mci); |
777 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); |
778 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); |
778 |
putline(buf, mci); |
779 |
if (!putline("This is a MIME-encapsulated message", mci) || |
779 |
putline("", mci); |
780 |
!putline("", mci) || |
|
|
781 |
!putline(buf, mci) || |
782 |
!putline("", mci)) |
783 |
goto writeerr; |
780 |
} |
784 |
} |
781 |
/* |
785 |
/* |
Lines 799-829
Link Here
|
799 |
if (!pm_notify && q == NULL && |
803 |
if (!pm_notify && q == NULL && |
800 |
!bitset(EF_FATALERRS|EF_SENDRECEIPT, e->e_parent->e_flags)) |
804 |
!bitset(EF_FATALERRS|EF_SENDRECEIPT, e->e_parent->e_flags)) |
801 |
{ |
805 |
{ |
802 |
putline(" **********************************************", |
806 |
if (!putline(" **********************************************", |
803 |
mci); |
807 |
mci) || |
804 |
putline(" ** THIS IS A WARNING MESSAGE ONLY **", |
808 |
!putline(" ** THIS IS A WARNING MESSAGE ONLY **", |
805 |
mci); |
809 |
mci) || |
806 |
putline(" ** YOU DO NOT NEED TO RESEND YOUR MESSAGE **", |
810 |
!putline(" ** YOU DO NOT NEED TO RESEND YOUR MESSAGE **", |
807 |
mci); |
811 |
mci) || |
808 |
putline(" **********************************************", |
812 |
!putline(" **********************************************", |
809 |
mci); |
813 |
mci) || |
810 |
putline("", mci); |
814 |
!putline("", mci)) |
|
|
815 |
goto writeerr; |
811 |
} |
816 |
} |
812 |
(void) sm_snprintf(buf, sizeof buf, |
817 |
(void) sm_snprintf(buf, sizeof buf, |
813 |
"The original message was received at %s", |
818 |
"The original message was received at %s", |
814 |
arpadate(ctime(&e->e_parent->e_ctime))); |
819 |
arpadate(ctime(&e->e_parent->e_ctime))); |
815 |
putline(buf, mci); |
820 |
if (!putline(buf, mci)) |
|
|
821 |
goto writeerr; |
816 |
expand("from \201_", buf, sizeof buf, e->e_parent); |
822 |
expand("from \201_", buf, sizeof buf, e->e_parent); |
817 |
putline(buf, mci); |
823 |
if (!putline(buf, mci)) |
|
|
824 |
goto writeerr; |
818 |
/* include id in postmaster copies */ |
825 |
/* include id in postmaster copies */ |
819 |
if (pm_notify && e->e_parent->e_id != NULL) |
826 |
if (pm_notify && e->e_parent->e_id != NULL) |
820 |
{ |
827 |
{ |
821 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "with id ", |
828 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "with id ", |
822 |
e->e_parent->e_id); |
829 |
e->e_parent->e_id); |
823 |
putline(buf, mci); |
830 |
if (!putline(buf, mci)) |
|
|
831 |
goto writeerr; |
824 |
} |
832 |
} |
825 |
putline("", mci); |
833 |
if (!putline("", mci)) |
|
|
834 |
goto writeerr; |
826 |
/* |
835 |
/* |
827 |
** Output error message header (if specified and available). |
836 |
** Output error message header (if specified and available). |
Lines 849-865
Link Here
|
849 |
{ |
858 |
{ |
850 |
translate_dollars(buf); |
859 |
translate_dollars(buf); |
851 |
expand(buf, buf, sizeof buf, e); |
860 |
expand(buf, buf, sizeof buf, e); |
852 |
putline(buf, mci); |
861 |
if (!putline(buf, mci)) |
|
|
862 |
goto writeerr; |
853 |
} |
863 |
} |
854 |
(void) sm_io_close(xfile, SM_TIME_DEFAULT); |
864 |
(void) sm_io_close(xfile, SM_TIME_DEFAULT); |
855 |
putline("\n", mci); |
865 |
if (!putline("\n", mci)) |
|
|
866 |
goto writeerr; |
856 |
} |
867 |
} |
857 |
} |
868 |
} |
858 |
else |
869 |
else |
859 |
{ |
870 |
{ |
860 |
expand(ErrMsgFile, buf, sizeof buf, e); |
871 |
expand(ErrMsgFile, buf, sizeof buf, e); |
861 |
putline(buf, mci); |
872 |
if (!putline(buf, mci) || !putline("", mci)) |
862 |
putline("", mci); |
873 |
goto writeerr; |
863 |
} |
874 |
} |
864 |
} |
875 |
} |
Lines 877-897
Link Here
|
877 |
if (printheader) |
888 |
if (printheader) |
878 |
{ |
889 |
{ |
879 |
putline(" ----- The following addresses had permanent fatal errors -----", |
890 |
if (!putline(" ----- The following addresses had permanent fatal errors -----", |
880 |
mci); |
891 |
mci)) |
|
|
892 |
goto writeerr; |
881 |
printheader = false; |
893 |
printheader = false; |
882 |
} |
894 |
} |
883 |
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR), |
895 |
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR), |
884 |
sizeof buf); |
896 |
sizeof buf); |
885 |
putline(buf, mci); |
897 |
if (!putline(buf, mci)) |
|
|
898 |
goto writeerr; |
886 |
if (q->q_rstatus != NULL) |
899 |
if (q->q_rstatus != NULL) |
887 |
{ |
900 |
{ |
888 |
(void) sm_snprintf(buf, sizeof buf, |
901 |
(void) sm_snprintf(buf, sizeof buf, |
889 |
" (reason: %s)", |
902 |
" (reason: %s)", |
890 |
shortenstring(exitstat(q->q_rstatus), |
903 |
shortenstring(exitstat(q->q_rstatus), |
891 |
MAXSHORTSTR)); |
904 |
MAXSHORTSTR)); |
892 |
putline(buf, mci); |
905 |
if (!putline(buf, mci)) |
|
|
906 |
goto writeerr; |
893 |
} |
907 |
} |
894 |
if (q->q_alias != NULL) |
908 |
if (q->q_alias != NULL) |
895 |
{ |
909 |
{ |
Lines 899-909
Link Here
|
899 |
" (expanded from: %s)", |
913 |
" (expanded from: %s)", |
900 |
shortenstring(q->q_alias->q_paddr, |
914 |
shortenstring(q->q_alias->q_paddr, |
901 |
MAXSHORTSTR)); |
915 |
MAXSHORTSTR)); |
902 |
putline(buf, mci); |
916 |
if (!putline(buf, mci)) |
|
|
917 |
goto writeerr; |
903 |
} |
918 |
} |
904 |
} |
919 |
} |
905 |
if (!printheader) |
920 |
if (!printheader && !putline("", mci)) |
906 |
putline("", mci); |
921 |
goto writeerr; |
907 |
/* transient non-fatal errors */ |
922 |
/* transient non-fatal errors */ |
908 |
printheader = true; |
923 |
printheader = true; |
Lines 917-941
Link Here
|
917 |
if (printheader) |
932 |
if (printheader) |
918 |
{ |
933 |
{ |
919 |
putline(" ----- The following addresses had transient non-fatal errors -----", |
934 |
if (!putline(" ----- The following addresses had transient non-fatal errors -----", |
920 |
mci); |
935 |
mci)) |
|
|
936 |
goto writeerr; |
921 |
printheader = false; |
937 |
printheader = false; |
922 |
} |
938 |
} |
923 |
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR), |
939 |
(void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR), |
924 |
sizeof buf); |
940 |
sizeof buf); |
925 |
putline(buf, mci); |
941 |
if (!putline(buf, mci)) |
|
|
942 |
goto writeerr; |
926 |
if (q->q_alias != NULL) |
943 |
if (q->q_alias != NULL) |
927 |
{ |
944 |
{ |
928 |
(void) sm_snprintf(buf, sizeof buf, |
945 |
(void) sm_snprintf(buf, sizeof buf, |
929 |
" (expanded from: %s)", |
946 |
" (expanded from: %s)", |
930 |
shortenstring(q->q_alias->q_paddr, |
947 |
shortenstring(q->q_alias->q_paddr, |
931 |
MAXSHORTSTR)); |
948 |
MAXSHORTSTR)); |
932 |
putline(buf, mci); |
949 |
if (!putline(buf, mci)) |
|
|
950 |
goto writeerr; |
933 |
} |
951 |
} |
934 |
} |
952 |
} |
935 |
if (!printheader) |
953 |
if (!printheader && !putline("", mci)) |
936 |
putline("", mci); |
954 |
goto writeerr; |
937 |
/* successful delivery notifications */ |
955 |
/* successful delivery notifications */ |
938 |
printheader = true; |
956 |
printheader = true; |
Lines 968-992
Link Here
|
968 |
if (printheader) |
986 |
if (printheader) |
969 |
{ |
987 |
{ |
970 |
putline(" ----- The following addresses had successful delivery notifications -----", |
988 |
if (!putline(" ----- The following addresses had successful delivery notifications -----", |
971 |
mci); |
989 |
mci)) |
|
|
990 |
goto writeerr; |
972 |
printheader = false; |
991 |
printheader = false; |
973 |
} |
992 |
} |
974 |
(void) sm_snprintf(buf, sizeof buf, "%s (%s)", |
993 |
(void) sm_snprintf(buf, sizeof buf, "%s (%s)", |
975 |
shortenstring(q->q_paddr, MAXSHORTSTR), p); |
994 |
shortenstring(q->q_paddr, MAXSHORTSTR), p); |
976 |
putline(buf, mci); |
995 |
if (!putline(buf, mci)) |
|
|
996 |
goto writeerr; |
977 |
if (q->q_alias != NULL) |
997 |
if (q->q_alias != NULL) |
978 |
{ |
998 |
{ |
979 |
(void) sm_snprintf(buf, sizeof buf, |
999 |
(void) sm_snprintf(buf, sizeof buf, |
980 |
" (expanded from: %s)", |
1000 |
" (expanded from: %s)", |
981 |
shortenstring(q->q_alias->q_paddr, |
1001 |
shortenstring(q->q_alias->q_paddr, |
982 |
MAXSHORTSTR)); |
1002 |
MAXSHORTSTR)); |
983 |
putline(buf, mci); |
1003 |
if (!putline(buf, mci)) |
|
|
1004 |
goto writeerr; |
984 |
} |
1005 |
} |
985 |
} |
1006 |
} |
986 |
if (!printheader) |
1007 |
if (!printheader && !putline("", mci)) |
987 |
putline("", mci); |
1008 |
goto writeerr; |
988 |
/* |
1009 |
/* |
989 |
** Output transcript of errors |
1010 |
** Output transcript of errors |
Lines 995-1002
Link Here
|
995 |
(void) sm_io_flush(smioout, SM_TIME_DEFAULT); |
1016 |
(void) sm_io_flush(smioout, SM_TIME_DEFAULT); |
996 |
if (e->e_parent->e_xfp == NULL) |
1017 |
if (e->e_parent->e_xfp == NULL) |
997 |
{ |
1018 |
{ |
998 |
putline(" ----- Transcript of session is unavailable -----\n", |
1019 |
if (!putline(" ----- Transcript of session is unavailable -----\n", |
999 |
mci); |
1020 |
mci)) |
|
|
1021 |
goto writeerr; |
1000 |
} |
1022 |
} |
1001 |
else |
1023 |
else |
1002 |
{ |
1024 |
{ |
Lines 1007-1017
Link Here
|
1007 |
while (sm_io_fgets(e->e_parent->e_xfp, SM_TIME_DEFAULT, buf, |
1029 |
while (sm_io_fgets(e->e_parent->e_xfp, SM_TIME_DEFAULT, buf, |
1008 |
sizeof buf) != NULL) |
1030 |
sizeof buf) != NULL) |
1009 |
{ |
1031 |
{ |
1010 |
if (printheader) |
1032 |
if (printheader && !putline(" ----- Transcript of session follows -----\n", |
1011 |
putline(" ----- Transcript of session follows -----\n", |
1033 |
mci)) |
1012 |
mci); |
1034 |
goto writeerr; |
1013 |
printheader = false; |
1035 |
printheader = false; |
1014 |
putline(buf, mci); |
1036 |
if (!putline(buf, mci)) |
|
|
1037 |
goto writeerr; |
1015 |
} |
1038 |
} |
1016 |
} |
1039 |
} |
1017 |
errno = 0; |
1040 |
errno = 0; |
Lines 1023-1033
Link Here
|
1023 |
if (e->e_msgboundary != NULL) |
1046 |
if (e->e_msgboundary != NULL) |
1024 |
{ |
1047 |
{ |
1025 |
putline("", mci); |
|
|
1026 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); |
1048 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); |
1027 |
putline(buf, mci); |
1049 |
if (!putline("", mci) || |
1028 |
putline("Content-Type: message/delivery-status", mci); |
1050 |
!putline(buf, mci) || |
1029 |
putline("", mci); |
1051 |
!putline("Content-Type: message/delivery-status", mci) || |
|
|
1052 |
!putline("", mci)) |
1053 |
goto writeerr; |
1030 |
/* |
1054 |
/* |
1031 |
** Output per-message information. |
1055 |
** Output per-message information. |
Lines 1039-1051
Link Here
|
1039 |
(void) sm_snprintf(buf, sizeof buf, |
1063 |
(void) sm_snprintf(buf, sizeof buf, |
1040 |
"Original-Envelope-Id: %.800s", |
1064 |
"Original-Envelope-Id: %.800s", |
1041 |
xuntextify(e->e_parent->e_envid)); |
1065 |
xuntextify(e->e_parent->e_envid)); |
1042 |
putline(buf, mci); |
1066 |
if (!putline(buf, mci)) |
|
|
1067 |
goto writeerr; |
1043 |
} |
1068 |
} |
1044 |
/* Reporting-MTA: is us (required) */ |
1069 |
/* Reporting-MTA: is us (required) */ |
1045 |
(void) sm_snprintf(buf, sizeof buf, |
1070 |
(void) sm_snprintf(buf, sizeof buf, |
1046 |
"Reporting-MTA: dns; %.800s", MyHostName); |
1071 |
"Reporting-MTA: dns; %.800s", MyHostName); |
1047 |
putline(buf, mci); |
1072 |
if (!putline(buf, mci)) |
|
|
1073 |
goto writeerr; |
1048 |
/* DSN-Gateway: not relevant since we are not translating */ |
1074 |
/* DSN-Gateway: not relevant since we are not translating */ |
Lines 1059-1071
Link Here
|
1059 |
(void) sm_snprintf(buf, sizeof buf, |
1085 |
(void) sm_snprintf(buf, sizeof buf, |
1060 |
"Received-From-MTA: %s; %.800s", |
1086 |
"Received-From-MTA: %s; %.800s", |
1061 |
p, RealHostName); |
1087 |
p, RealHostName); |
1062 |
putline(buf, mci); |
1088 |
if (!putline(buf, mci)) |
|
|
1089 |
goto writeerr; |
1063 |
} |
1090 |
} |
1064 |
/* Arrival-Date: -- when it arrived here */ |
1091 |
/* Arrival-Date: -- when it arrived here */ |
1065 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "Arrival-Date: ", |
1092 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "Arrival-Date: ", |
1066 |
arpadate(ctime(&e->e_parent->e_ctime))); |
1093 |
arpadate(ctime(&e->e_parent->e_ctime))); |
1067 |
putline(buf, mci); |
1094 |
if (!putline(buf, mci)) |
|
|
1095 |
goto writeerr; |
1068 |
/* Deliver-By-Date: -- when it should have been delivered */ |
1096 |
/* Deliver-By-Date: -- when it should have been delivered */ |
1069 |
if (IS_DLVR_BY(e->e_parent)) |
1097 |
if (IS_DLVR_BY(e->e_parent)) |
Lines 1076-1082
Link Here
|
1076 |
(void) sm_strlcpyn(buf, sizeof buf, 2, |
1104 |
(void) sm_strlcpyn(buf, sizeof buf, 2, |
1077 |
"Deliver-By-Date: ", |
1105 |
"Deliver-By-Date: ", |
1078 |
arpadate(ctime(&dbyd))); |
1106 |
arpadate(ctime(&dbyd))); |
1079 |
putline(buf, mci); |
1107 |
if (!putline(buf, mci)) |
|
|
1108 |
goto writeerr; |
1080 |
} |
1109 |
} |
1081 |
/* |
1110 |
/* |
Lines 1119-1125
Link Here
|
1119 |
else |
1148 |
else |
1120 |
continue; |
1149 |
continue; |
1121 |
putline("", mci); |
1150 |
if (!putline("", mci)) |
|
|
1151 |
goto writeerr; |
1122 |
/* Original-Recipient: -- passed from on high */ |
1152 |
/* Original-Recipient: -- passed from on high */ |
1123 |
if (q->q_orcpt != NULL) |
1153 |
if (q->q_orcpt != NULL) |
Lines 1127-1133
Link Here
|
1127 |
(void) sm_snprintf(buf, sizeof buf, |
1157 |
(void) sm_snprintf(buf, sizeof buf, |
1128 |
"Original-Recipient: %.800s", |
1158 |
"Original-Recipient: %.800s", |
1129 |
q->q_orcpt); |
1159 |
q->q_orcpt); |
1130 |
putline(buf, mci); |
1160 |
if (!putline(buf, mci)) |
|
|
1161 |
goto writeerr; |
1131 |
} |
1162 |
} |
1132 |
/* Figure out actual recipient */ |
1163 |
/* Figure out actual recipient */ |
Lines 1176-1182
Link Here
|
1176 |
(void) sm_snprintf(buf, sizeof buf, |
1207 |
(void) sm_snprintf(buf, sizeof buf, |
1177 |
"Final-Recipient: %s", |
1208 |
"Final-Recipient: %s", |
1178 |
q->q_finalrcpt); |
1209 |
q->q_finalrcpt); |
1179 |
putline(buf, mci); |
1210 |
if (!putline(buf, mci)) |
|
|
1211 |
goto writeerr; |
1180 |
} |
1212 |
} |
1181 |
/* X-Actual-Recipient: -- the real problem address */ |
1213 |
/* X-Actual-Recipient: -- the real problem address */ |
Lines 1190-1202
Link Here
|
1190 |
(void) sm_snprintf(buf, sizeof buf, |
1222 |
(void) sm_snprintf(buf, sizeof buf, |
1191 |
"X-Actual-Recipient: %s", |
1223 |
"X-Actual-Recipient: %s", |
1192 |
actual); |
1224 |
actual); |
1193 |
putline(buf, mci); |
1225 |
if (!putline(buf, mci)) |
|
|
1226 |
goto writeerr; |
1194 |
} |
1227 |
} |
1195 |
/* Action: -- what happened? */ |
1228 |
/* Action: -- what happened? */ |
1196 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "Action: ", |
1229 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "Action: ", |
1197 |
action); |
1230 |
action); |
1198 |
putline(buf, mci); |
1231 |
if (!putline(buf, mci)) |
|
|
1232 |
goto writeerr; |
1199 |
/* Status: -- what _really_ happened? */ |
1233 |
/* Status: -- what _really_ happened? */ |
1200 |
if (q->q_status != NULL) |
1234 |
if (q->q_status != NULL) |
Lines 1208-1214
Link Here
|
1208 |
else |
1242 |
else |
1209 |
p = "2.0.0"; |
1243 |
p = "2.0.0"; |
1210 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "Status: ", p); |
1244 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "Status: ", p); |
1211 |
putline(buf, mci); |
1245 |
if (!putline(buf, mci)) |
|
|
1246 |
goto writeerr; |
1212 |
/* Remote-MTA: -- who was I talking to? */ |
1247 |
/* Remote-MTA: -- who was I talking to? */ |
1213 |
if (q->q_statmta != NULL) |
1248 |
if (q->q_statmta != NULL) |
Lines 1222-1228
Link Here
|
1222 |
p = &buf[strlen(buf) - 1]; |
1257 |
p = &buf[strlen(buf) - 1]; |
1223 |
if (*p == '.') |
1258 |
if (*p == '.') |
1224 |
*p = '\0'; |
1259 |
*p = '\0'; |
1225 |
putline(buf, mci); |
1260 |
if (!putline(buf, mci)) |
|
|
1261 |
goto writeerr; |
1226 |
} |
1262 |
} |
1227 |
/* Diagnostic-Code: -- actual result from other end */ |
1263 |
/* Diagnostic-Code: -- actual result from other end */ |
Lines 1234-1240
Link Here
|
1234 |
(void) sm_snprintf(buf, sizeof buf, |
1270 |
(void) sm_snprintf(buf, sizeof buf, |
1235 |
"Diagnostic-Code: %s; %.800s", |
1271 |
"Diagnostic-Code: %s; %.800s", |
1236 |
p, q->q_rstatus); |
1272 |
p, q->q_rstatus); |
1237 |
putline(buf, mci); |
1273 |
if (!putline(buf, mci)) |
|
|
1274 |
goto writeerr; |
1238 |
} |
1275 |
} |
1239 |
/* Last-Attempt-Date: -- fine granularity */ |
1276 |
/* Last-Attempt-Date: -- fine granularity */ |
Lines 1243-1249
Link Here
|
1243 |
(void) sm_strlcpyn(buf, sizeof buf, 2, |
1280 |
(void) sm_strlcpyn(buf, sizeof buf, 2, |
1244 |
"Last-Attempt-Date: ", |
1281 |
"Last-Attempt-Date: ", |
1245 |
arpadate(ctime(&q->q_statdate))); |
1282 |
arpadate(ctime(&q->q_statdate))); |
1246 |
putline(buf, mci); |
1283 |
if (!putline(buf, mci)) |
|
|
1284 |
goto writeerr; |
1247 |
/* Will-Retry-Until: -- for delayed messages only */ |
1285 |
/* Will-Retry-Until: -- for delayed messages only */ |
1248 |
if (QS_IS_QUEUEUP(q->q_state)) |
1286 |
if (QS_IS_QUEUEUP(q->q_state)) |
Lines 1255-1261
Link Here
|
1255 |
(void) sm_strlcpyn(buf, sizeof buf, 2, |
1293 |
(void) sm_strlcpyn(buf, sizeof buf, 2, |
1256 |
"Will-Retry-Until: ", |
1294 |
"Will-Retry-Until: ", |
1257 |
arpadate(ctime(&xdate))); |
1295 |
arpadate(ctime(&xdate))); |
1258 |
putline(buf, mci); |
1296 |
if (!putline(buf, mci)) |
|
|
1297 |
goto writeerr; |
1259 |
} |
1298 |
} |
1260 |
} |
1299 |
} |
1261 |
} |
1300 |
} |
Lines 1265-1271
Link Here
|
1265 |
** Output text of original message |
1304 |
** Output text of original message |
1266 |
*/ |
1305 |
*/ |
1267 |
putline("", mci); |
1306 |
if (!putline("", mci)) |
|
|
1307 |
goto writeerr; |
1268 |
if (bitset(EF_HAS_DF, e->e_parent->e_flags)) |
1308 |
if (bitset(EF_HAS_DF, e->e_parent->e_flags)) |
1269 |
{ |
1309 |
{ |
1270 |
sendbody = !bitset(EF_NO_BODY_RETN, e->e_parent->e_flags) && |
1310 |
sendbody = !bitset(EF_NO_BODY_RETN, e->e_parent->e_flags) && |
Lines 1273-1293
Link Here
|
1273 |
if (e->e_msgboundary == NULL) |
1313 |
if (e->e_msgboundary == NULL) |
1274 |
{ |
1314 |
{ |
1275 |
if (sendbody) |
1315 |
if (!putline( |
1276 |
putline(" ----- Original message follows -----\n", mci); |
1316 |
sendbody |
1277 |
else |
1317 |
? " ----- Original message follows -----\n" |
1278 |
putline(" ----- Message header follows -----\n", mci); |
1318 |
: " ----- Message header follows -----\n", |
|
|
1319 |
mci)) |
1320 |
{ |
1321 |
goto writeerr; |
1322 |
} |
1279 |
} |
1323 |
} |
1280 |
else |
1324 |
else |
1281 |
{ |
1325 |
{ |
1282 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", |
1326 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "--", |
1283 |
e->e_msgboundary); |
1327 |
e->e_msgboundary); |
1284 |
putline(buf, mci); |
1328 |
if (!putline(buf, mci)) |
|
|
1329 |
goto writeerr; |
1285 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "Content-Type: ", |
1330 |
(void) sm_strlcpyn(buf, sizeof buf, 2, "Content-Type: ", |
1286 |
sendbody ? "message/rfc822" |
1331 |
sendbody ? "message/rfc822" |
1287 |
: "text/rfc822-headers"); |
1332 |
: "text/rfc822-headers"); |
1288 |
putline(buf, mci); |
1333 |
if (!putline(buf, mci)) |
|
|
1334 |
goto writeerr; |
1289 |
p = hvalue("Content-Transfer-Encoding", |
1335 |
p = hvalue("Content-Transfer-Encoding", |
1290 |
e->e_parent->e_header); |
1336 |
e->e_parent->e_header); |
Lines 1301-1343
Link Here
|
1301 |
(void) sm_snprintf(buf, sizeof buf, |
1347 |
(void) sm_snprintf(buf, sizeof buf, |
1302 |
"Content-Transfer-Encoding: %s", |
1348 |
"Content-Transfer-Encoding: %s", |
1303 |
p); |
1349 |
p); |
1304 |
putline(buf, mci); |
1350 |
if (!putline(buf, mci)) |
|
|
1351 |
goto writeerr; |
1305 |
} |
1352 |
} |
1306 |
} |
1353 |
} |
1307 |
putline("", mci); |
1354 |
if (!putline("", mci)) |
|
|
1355 |
goto writeerr; |
1308 |
save_errno = errno; |
1356 |
save_errno = errno; |
1309 |
putheader(mci, e->e_parent->e_header, e->e_parent, M87F_OUTER); |
1357 |
if (!putheader(mci, e->e_parent->e_header, e->e_parent, |
|
|
1358 |
M87F_OUTER)) |
1359 |
goto writeerr; |
1310 |
errno = save_errno; |
1360 |
errno = save_errno; |
1311 |
if (sendbody) |
1361 |
if (sendbody) |
1312 |
putbody(mci, e->e_parent, e->e_msgboundary); |
1362 |
{ |
|
|
1363 |
if (!putbody(mci, e->e_parent, e->e_msgboundary)) |
1364 |
goto writeerr; |
1365 |
} |
1313 |
else if (e->e_msgboundary == NULL) |
1366 |
else if (e->e_msgboundary == NULL) |
1314 |
{ |
1367 |
{ |
1315 |
putline("", mci); |
1368 |
if (!putline("", mci) || |
1316 |
putline(" ----- Message body suppressed -----", mci); |
1369 |
!putline(" ----- Message body suppressed -----", |
|
|
1370 |
mci)) |
1371 |
{ |
1372 |
goto writeerr; |
1373 |
} |
1317 |
} |
1374 |
} |
1318 |
} |
1375 |
} |
1319 |
else if (e->e_msgboundary == NULL) |
1376 |
else if (e->e_msgboundary == NULL) |
1320 |
{ |
1377 |
{ |
1321 |
putline(" ----- No message was collected -----\n", mci); |
1378 |
if (!putline(" ----- No message was collected -----\n", mci)) |
|
|
1379 |
goto writeerr; |
1322 |
} |
1380 |
} |
1323 |
if (e->e_msgboundary != NULL) |
1381 |
if (e->e_msgboundary != NULL) |
1324 |
{ |
1382 |
{ |
1325 |
putline("", mci); |
|
|
1326 |
(void) sm_strlcpyn(buf, sizeof buf, 3, "--", e->e_msgboundary, |
1383 |
(void) sm_strlcpyn(buf, sizeof buf, 3, "--", e->e_msgboundary, |
1327 |
"--"); |
1384 |
"--"); |
1328 |
putline(buf, mci); |
1385 |
if (!putline("", mci) || !putline(buf, mci)) |
|
|
1386 |
goto writeerr; |
1329 |
} |
1387 |
} |
1330 |
putline("", mci); |
1388 |
if (!putline("", mci) || |
1331 |
(void) sm_io_flush(mci->mci_out, SM_TIME_DEFAULT); |
1389 |
sm_io_flush(mci->mci_out, SM_TIME_DEFAULT) == SM_IO_EOF) |
|
|
1390 |
goto writeerr; |
1332 |
/* |
1391 |
/* |
1333 |
** Cleanup and exit |
1392 |
** Cleanup and exit |
1334 |
*/ |
1393 |
*/ |
1335 |
if (errno != 0) |
1394 |
if (errno != 0) |
|
|
1395 |
{ |
1396 |
writeerr: |
1336 |
syserr("errbody: I/O error"); |
1397 |
syserr("errbody: I/O error"); |
|
|
1398 |
return false; |
1399 |
} |
1400 |
return true; |
1337 |
} |
1401 |
} |
|
|
1402 |
|
1338 |
/* |
1403 |
/* |
1339 |
** SMTPTODSN -- convert SMTP to DSN status code |
1404 |
** SMTPTODSN -- convert SMTP to DSN status code |
1340 |
** |
1405 |
** |