Lines Matching refs:e
29 clrsessenvelope(e)
30 ENVELOPE *e;
33 macdefine(&e->e_macro, A_PERM, macid("{auth_type}"), "");
34 macdefine(&e->e_macro, A_PERM, macid("{auth_authen}"), "");
35 macdefine(&e->e_macro, A_PERM, macid("{auth_author}"), "");
36 macdefine(&e->e_macro, A_PERM, macid("{auth_ssf}"), "");
39 macdefine(&e->e_macro, A_PERM, macid("{cert_issuer}"), "");
40 macdefine(&e->e_macro, A_PERM, macid("{cert_subject}"), "");
41 macdefine(&e->e_macro, A_PERM, macid("{cipher_bits}"), "");
42 macdefine(&e->e_macro, A_PERM, macid("{cipher}"), "");
43 macdefine(&e->e_macro, A_PERM, macid("{tls_version}"), "");
44 macdefine(&e->e_macro, A_PERM, macid("{verify}"), "");
45 macdefine(&e->e_macro, A_PERM, macid("{alg_bits}"), "");
46 macdefine(&e->e_macro, A_PERM, macid("{cn_issuer}"), "");
47 macdefine(&e->e_macro, A_PERM, macid("{cn_subject}"), "");
71 newenvelope(e, parent, rpool) in newenvelope() argument
72 register ENVELOPE *e; in newenvelope()
92 if (e == parent)
93 parent = e->e_parent;
94 clearenvelope(e, true, rpool);
95 if (e == CurEnv)
96 memmove((char *) &e->e_from,
98 sizeof(e->e_from));
100 memmove((char *) &e->e_from,
102 sizeof(e->e_from));
103 e->e_parent = parent;
104 assign_queueid(e);
105 e->e_ctime = curtime();
107 e->e_sessid = e->e_id;
111 e->e_msgpriority = parent->e_msgsize;
114 e->e_sessid = sm_rpool_strdup_x(rpool,
120 e->e_quarmsg = NULL;
121 macdefine(&e->e_macro, A_PERM,
126 e->e_quarmsg = sm_rpool_strdup_x(rpool,
128 macdefine(&e->e_macro, A_PERM,
129 macid("{quarantine}"), e->e_quarmsg);
132 e->e_puthdr = putheader;
133 e->e_putbody = putbody;
137 set_delivery_mode(sendmode, e);
139 return e;
172 dropenvelope(e, fulldrop, split) in dropenvelope() argument
173 register ENVELOPE *e; in dropenvelope()
183 bool pmnotify = bitset(EF_PM_NOTIFY, e->e_flags);
186 char *id = e->e_id;
192 sm_dprintf("dropenvelope %p: id=", e);
193 xputs(sm_debug_file(), e->e_id);
195 printenvflags(e);
199 printaddr(sm_debug_file(), e->e_sendqueue, true);
206 e->e_flags, OpMode, (int) CurrentPid);
218 e->e_id, bitset(EF_LOGSENDER, e->e_flags), LogLevel);
219 if (LogLevel > 4 && bitset(EF_LOGSENDER, e->e_flags))
220 logsender(e, NULL);
221 e->e_flags &= ~EF_LOGSENDER;
231 if (now >= e->e_ctime + TimeOuts.to_q_return[e->e_timeoutclass])
233 if (IS_DLVR_RETURN(e) && e->e_deliver_by > 0 &&
234 now >= e->e_ctime + e->e_deliver_by &&
235 !bitset(EF_RESPONSE, e->e_flags))
238 e->e_flags |= EF_FATALERRS|EF_CLRQUEUE;
240 else if (TimeOuts.to_q_return[e->e_timeoutclass] == NOW &&
241 !bitset(EF_RESPONSE, e->e_flags))
244 e->e_flags |= EF_FATALERRS|EF_CLRQUEUE;
250 q = e->e_sendqueue;
252 e->e_sendmode, e, e->e_sibling, e->e_nrcpts, q,
258 e->e_flags &= ~EF_QUEUERUN;
259 for (q = e->e_sendqueue; q != NULL; q = q->q_next)
265 if (queueit && e->e_sendmode == SM_PROXY)
278 !emptyaddr(&e->e_from))
280 (void) sendtolist(e->e_from.q_paddr, NULLADDR,
281 &e->e_errorqueue, 0, e);
296 if (e->e_class < 0)
297 e->e_flags |= EF_NO_BODY_RETN;
314 e->e_deliver_by);
320 pintvl(TimeOuts.to_q_return[e->e_timeoutclass],
325 e->e_message = sm_rpool_strdup_x(e->e_rpool, buf);
327 e->e_flags |= EF_CLRQUEUE;
331 (void) sm_io_fprintf(e->e_xfp, SM_TIME_DEFAULT,
333 e->e_deliver_by);
336 (void) sm_io_fprintf(e->e_xfp, SM_TIME_DEFAULT,
338 pintvl(TimeOuts.to_q_return[e->e_timeoutclass],
340 (void) sm_io_fprintf(e->e_xfp, SM_TIME_DEFAULT,
342 for (q = e->e_sendqueue; q != NULL; q = q->q_next)
356 if (TimeOuts.to_q_warning[e->e_timeoutclass] > 0 &&
357 now >= e->e_ctime +
358 TimeOuts.to_q_warning[e->e_timeoutclass])
360 else if (IS_DLVR_NOTIFY(e) &&
361 e->e_deliver_by > 0 &&
362 now >= e->e_ctime + e->e_deliver_by)
367 if (!bitset(EF_WARNING|EF_RESPONSE, e->e_flags) &&
368 e->e_class >= 0 &&
369 e->e_from.q_paddr != NULL &&
370 strcmp(e->e_from.q_paddr, "<>") != 0 &&
371 sm_strncasecmp(e->e_from.q_paddr, "owner-", 6) != 0 &&
372 (strlen(e->e_from.q_paddr) <= 8 ||
373 sm_strcasecmp(&e->e_from.q_paddr[strlen(e->e_from.q_paddr) - 8],
376 for (q = e->e_sendqueue; q != NULL;
412 e->e_deliver_by);
417 pintvl(TimeOuts.to_q_warning[e->e_timeoutclass],
421 e->e_message = sm_rpool_strdup_x(e->e_rpool,
424 e->e_flags |= EF_WARNING;
428 (void) sm_io_fprintf(e->e_xfp, SM_TIME_DEFAULT,
430 e->e_deliver_by);
433 (void) sm_io_fprintf(e->e_xfp, SM_TIME_DEFAULT,
435 pintvl(TimeOuts.to_q_warning[e->e_timeoutclass],
437 (void) sm_io_fprintf(e->e_xfp, SM_TIME_DEFAULT,
439 pintvl(TimeOuts.to_q_return[e->e_timeoutclass],
453 if (bitset(EF_FATALERRS, e->e_flags) && !failure_return)
455 for (q = e->e_sendqueue; q != NULL; q = q->q_next)
473 strcmp(e->e_from.q_paddr, "<>") != 0)
480 e->e_flags |= EF_SENDRECEIPT;
481 (void) sendtolist(e->e_from.q_paddr, NULLADDR, &rlist, 0, e);
482 (void) returntosender("Return receipt", rlist, RTSF_NO_BODY, e);
484 e->e_flags &= ~EF_SENDRECEIPT;
490 if ((failure_return || delay_return) && e->e_errormode != EM_QUIET)
494 panic = savemail(e, !bitset(EF_NO_BODY_RETN, e->e_flags));
503 !bitset(EF_RESPONSE, e->e_flags) &&
504 e->e_class >= 0)
511 expand(PostMasterCopy, pcopy, sizeof(pcopy), e);
516 (void) sendtolist(pcopy, NULLADDR, &rlist, 0, e);
520 &rlist, 0, e);
521 (void) returntosender(e->e_message, rlist,
522 RTSF_PM_BOUNCE|RTSF_NO_BODY, e);
533 if (!queueit || bitset(EF_CLRQUEUE, e->e_flags))
538 e->e_id, queueit);
539 printenvflags(e);
543 if (e->e_dfp != NULL)
545 (void) sm_io_close(e->e_dfp, SM_TIME_DEFAULT);
546 e->e_dfp = NULL;
548 (void) xunlink(queuename(e, DATAFL_LETTER));
560 if (xunlink(queuename(e, ANYQFL_LETTER)) == 0)
563 updfs(e, -1, panic ? 0 : -1, "dropenvelope");
566 if (e->e_ntries > 0 && LogLevel > 9)
568 pintvl(curtime() - e->e_ctime, true),
569 e->e_ntries);
571 else if (queueit || !bitset(EF_INQUEUE, e->e_flags))
574 queueup(e, false, true);
587 oldsib = e->e_sibling;
588 e->e_sibling = NULL;
589 if (!split_by_recipient(e) &&
590 bitset(EF_FATALERRS, e->e_flags))
593 e->e_id, queuename(e, DATAFL_LETTER),
596 for (ee = e->e_sibling; ee != NULL; ee = ee->e_sibling)
598 queueup(e, false, true);
601 for (ee = e->e_sibling; ee != NULL; ee = ee->e_sibling)
620 e->e_sibling = oldsib;
627 closexscript(e);
628 unlockqueue(e);
631 if (e->e_dfp != NULL)
633 (void) sm_io_close(e->e_dfp, SM_TIME_DEFAULT);
634 e->e_dfp = NULL;
636 e->e_id = NULL;
637 e->e_flags &= ~EF_HAS_DF;
667 clearenvelope(e, fullclear, rpool) in clearenvelope() argument
668 register ENVELOPE *e; in clearenvelope()
680 if (e->e_xfp != NULL)
681 (void) sm_io_close(e->e_xfp, SM_TIME_DEFAULT);
682 if (e->e_dfp != NULL)
683 (void) sm_io_close(e->e_dfp, SM_TIME_DEFAULT);
684 e->e_xfp = e->e_dfp = NULL;
698 *e = BlankEnvelope;
699 e->e_message = NULL;
700 e->e_qfletter = '\0';
701 e->e_quarmsg = NULL;
702 macdefine(&e->e_macro, A_PERM, macid("{quarantine}"), "");
711 for (p = &e->e_macro.mac_table[0];
712 p <= &e->e_macro.mac_table[MAXMACROID];
725 e->e_rpool = rpool;
726 e->e_macro.mac_rpool = rpool;
728 set_delivery_mode(SM_DELIVER, e);
730 nhp = &e->e_header;
739 e->e_enhsc[0] = '\0';
760 initsys(e) in initsys() argument
761 register ENVELOPE *e; in initsys()
776 openxscript(e);
777 e->e_ctime = curtime();
778 e->e_qfletter = '\0';
787 if (OpMode == MD_DAEMON && bitset(EF_QUEUERUN, e->e_flags) &&
788 e->e_xfp != NULL)
789 OutChannel = e->e_xfp;
797 macdefine(&e->e_macro, A_TEMP, 'p', buf);
800 (void) sm_snprintf(buf, sizeof(buf), "%d", e->e_hopcount);
801 macdefine(&e->e_macro, A_TEMP, 'c', buf);
804 settime(e);
811 if (macvalue('y', e) == NULL)
819 macdefine(&e->e_macro, A_PERM, 'y', ybuf);
838 settime(e) in settime() argument
839 register ENVELOPE *e; in settime()
848 macdefine(&e->e_macro, A_TEMP, macid("{time}"), buf);
853 macdefine(&e->e_macro, A_TEMP, 't', buf);
858 macdefine(&e->e_macro, A_TEMP, 'd', buf);
859 macdefine(&e->e_macro, A_TEMP, 'b', arpadate(buf));
860 if (macvalue('a', e) == NULL)
861 macdefine(&e->e_macro, A_PERM, 'a', macvalue('b', e));
884 openxscript(e) in openxscript() argument
885 register ENVELOPE *e; in openxscript()
889 if (e->e_xfp != NULL)
893 if (e->e_lockfp == NULL && bitset(EF_INQUEUE, e->e_flags))
897 p = queuename(e, XSCRPT_LETTER);
898 e->e_xfp = bfopen(p, FileMode, XscriptFileBufferSize,
901 if (e->e_xfp == NULL)
904 e->e_xfp = sm_io_open(SmFtStdio, SM_TIME_DEFAULT,
906 if (e->e_xfp == NULL)
909 (void) sm_io_setvbuf(e->e_xfp, SM_TIME_DEFAULT, NULL, SM_IO_LBF, 0);
913 dumpfd(sm_io_getinfo(e->e_xfp, SM_IO_WHAT_FD, NULL), true,
931 closexscript(e) in closexscript() argument
932 register ENVELOPE *e; in closexscript()
934 if (e->e_xfp == NULL)
937 if (e->e_lockfp == NULL)
940 (void) sm_io_close(e->e_xfp, SM_TIME_DEFAULT);
941 e->e_xfp = NULL;
983 setsender(from, e, delimptr, delimchar, internal) in setsender() argument
985 register ENVELOPE *e;
1001 macdefine(&e->e_macro, A_PERM, 'x', "");
1008 if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP ||
1017 macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), "e s");
1020 e->e_from.q_state = QS_BADADDR;
1021 e->e_from.q_flags = 0;
1023 parseaddr(from, &e->e_from, RF_COPYALL|RF_SENDERADDR,
1024 delimchar, delimptr, e, false) == NULL ||
1025 QS_IS_BADADDR(e->e_from.q_state) ||
1026 e->e_from.q_mailer == ProgMailer ||
1027 e->e_from.q_mailer == FileMailer ||
1028 e->e_from.q_mailer == InclMailer)
1036 p = macvalue('_', e);
1048 sm_syslog(LOG_NOTICE, e->e_id,
1054 if (!QS_IS_BADADDR(e->e_from.q_state))
1057 e->e_status = "5.1.7";
1058 usrerrenh(e->e_status,
1065 &e->e_from, RF_COPYALL|RF_SENDERADDR, ' ',
1066 NULL, e, false) == NULL)
1071 expand("\201n", nbuf, sizeof(nbuf), e);
1072 from = sm_rpool_strdup_x(e->e_rpool, nbuf);
1073 if (parseaddr(from, &e->e_from, RF_COPYALL, ' ',
1074 NULL, e, false) == NULL &&
1075 parseaddr(from = "postmaster", &e->e_from,
1076 RF_COPYALL, ' ', NULL, e, false) == NULL)
1082 e->e_from.q_state = QS_SENDER;
1086 printaddr(sm_debug_file(), &e->e_from, false);
1091 if (bitnset(M_CHECKUDB, e->e_from.q_mailer->m_flags))
1095 p = udbsender(e->e_from.q_user, e->e_rpool);
1101 if (bitnset(M_HASPWENT, e->e_from.q_mailer->m_flags))
1109 FullName = macvalue('x', e);
1119 if (e->e_from.q_user[0] != '\0' &&
1120 sm_mbdb_lookup(e->e_from.q_user, &user) == EX_OK)
1128 e->e_from.q_home = NULL;
1130 e->e_from.q_home = "";
1132 e->e_from.q_home = sm_rpool_strdup_x(e->e_rpool,
1134 macdefine(&e->e_macro, A_PERM, 'z', e->e_from.q_home);
1139 e->e_from.q_uid = user.mbdb_uid;
1140 e->e_from.q_gid = user.mbdb_gid;
1141 e->e_from.q_flags |= QGOODUID;
1147 strcmp(user.mbdb_name, e->e_from.q_user) == 0)
1154 e->e_from.q_home = NULL;
1157 macdefine(&e->e_macro, A_TEMP, 'x', FullName);
1161 if (e->e_from.q_home == NULL)
1163 e->e_from.q_home = getenv("HOME");
1164 if (e->e_from.q_home != NULL)
1166 if (*e->e_from.q_home == '\0')
1167 e->e_from.q_home = NULL;
1168 else if (strcmp(e->e_from.q_home, "/") == 0)
1169 e->e_from.q_home++;
1172 e->e_from.q_uid = RealUid;
1173 e->e_from.q_gid = RealGid;
1174 e->e_from.q_flags |= QGOODUID;
1188 sm_syslog(LOG_NOTICE, e->e_id,
1193 (void) REWRITE(pvp, 3, e);
1194 (void) REWRITE(pvp, 1, e);
1195 (void) REWRITE(pvp, 4, e);
1196 macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), NULL);
1199 if (*bp == '@' && !bitnset(M_NOBRACKET, e->e_from.q_mailer->m_flags))
1205 e->e_sender = sm_rpool_strdup_x(e->e_rpool, bp);
1206 macdefine(&e->e_macro, A_PERM, 'f', e->e_sender);
1209 if (e->e_from.q_mailer != NULL &&
1210 bitnset(M_CANONICAL, e->e_from.q_mailer->m_flags))
1215 macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), "e s");
1216 (void) REWRITE(pvp, 3, e);
1217 (void) REWRITE(pvp, 1, e);
1218 (void) REWRITE(pvp, 4, e);
1219 macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), NULL);
1229 e->e_fromdomain = copyplist(lastat, true, e->e_rpool);
1233 printav(sm_debug_file(), e->e_fromdomain);
1288 printenvflags(e) in printenvflags() argument
1289 register ENVELOPE *e; in printenvflags()
1294 sm_dprintf("%lx", e->e_flags);
1297 if (!bitset(ef->ef_bit, e->e_flags))