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=", (void *)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)
469 && WILL_BE_QUEUED(e->e_sendmode)
470 && bitset(EF_INQUEUE, e->e_flags)
486 strcmp(e->e_from.q_paddr, "<>") != 0)
493 e->e_flags |= EF_SENDRECEIPT;
494 (void) sendtolist(e->e_from.q_paddr, NULLADDR, &rlist, 0, e);
495 (void) returntosender("Return receipt", rlist, RTSF_NO_BODY, e);
497 e->e_flags &= ~EF_SENDRECEIPT;
503 if ((failure_return || delay_return) && e->e_errormode != EM_QUIET)
507 panic = savemail(e, !bitset(EF_NO_BODY_RETN, e->e_flags));
516 !bitset(EF_RESPONSE, e->e_flags) &&
517 e->e_class >= 0)
524 expand(PostMasterCopy, pcopy, sizeof(pcopy), e);
529 (void) sendtolist(pcopy, NULLADDR, &rlist, 0, e);
533 &rlist, 0, e);
534 (void) returntosender(e->e_message, rlist,
535 RTSF_PM_BOUNCE|RTSF_NO_BODY, e);
546 if (!queueit || bitset(EF_CLRQUEUE, e->e_flags))
551 e->e_id, queueit);
552 printenvflags(e);
556 if (e->e_dfp != NULL)
558 (void) sm_io_close(e->e_dfp, SM_TIME_DEFAULT);
559 e->e_dfp = NULL;
561 (void) xunlink(queuename(e, DATAFL_LETTER));
573 if (xunlink(queuename(e, ANYQFL_LETTER)) == 0)
576 updfs(e, -1, panic ? 0 : -1, "dropenvelope");
579 if (e->e_ntries > 0 && LogLevel > 9)
581 pintvl(curtime() - e->e_ctime, true),
582 e->e_ntries);
584 else if (queueit || !bitset(EF_INQUEUE, e->e_flags))
587 queueup(e, false, true);
600 oldsib = e->e_sibling;
601 e->e_sibling = NULL;
602 if (!split_by_recipient(e) &&
603 bitset(EF_FATALERRS, e->e_flags))
606 e->e_id, queuename(e, DATAFL_LETTER),
609 for (ee = e->e_sibling; ee != NULL; ee = ee->e_sibling)
611 queueup(e, false, true);
614 for (ee = e->e_sibling; ee != NULL; ee = ee->e_sibling)
633 e->e_sibling = oldsib;
640 closexscript(e);
641 unlockqueue(e);
644 if (e->e_dfp != NULL)
646 (void) sm_io_close(e->e_dfp, SM_TIME_DEFAULT);
647 e->e_dfp = NULL;
649 e->e_id = NULL;
650 e->e_flags &= ~EF_HAS_DF;
680 clearenvelope(e, fullclear, rpool) in clearenvelope() argument
681 register ENVELOPE *e; in clearenvelope()
693 if (e->e_xfp != NULL)
694 (void) sm_io_close(e->e_xfp, SM_TIME_DEFAULT);
695 if (e->e_dfp != NULL)
696 (void) sm_io_close(e->e_dfp, SM_TIME_DEFAULT);
697 e->e_xfp = e->e_dfp = NULL;
711 *e = BlankEnvelope;
712 e->e_message = NULL;
713 e->e_qfletter = '\0';
714 e->e_quarmsg = NULL;
715 macdefine(&e->e_macro, A_PERM, macid("{quarantine}"), "");
724 for (p = &e->e_macro.mac_table[0];
725 p <= &e->e_macro.mac_table[MAXMACROID];
738 e->e_rpool = rpool;
739 e->e_macro.mac_rpool = rpool;
741 set_delivery_mode(SM_DELIVER, e);
743 nhp = &e->e_header;
752 e->e_enhsc[0] = '\0';
773 initsys(e) in initsys() argument
774 register ENVELOPE *e; in initsys()
789 openxscript(e);
790 e->e_ctime = curtime();
791 e->e_qfletter = '\0';
800 if (OpMode == MD_DAEMON && bitset(EF_QUEUERUN, e->e_flags) &&
801 e->e_xfp != NULL)
802 OutChannel = e->e_xfp;
810 macdefine(&e->e_macro, A_TEMP, 'p', buf);
813 (void) sm_snprintf(buf, sizeof(buf), "%d", e->e_hopcount);
814 macdefine(&e->e_macro, A_TEMP, 'c', buf);
817 settime(e);
824 if (macvalue('y', e) == NULL)
832 macdefine(&e->e_macro, A_PERM, 'y', ybuf);
851 settime(e) in settime() argument
852 register ENVELOPE *e; in settime()
861 macdefine(&e->e_macro, A_TEMP, macid("{time}"), buf);
866 macdefine(&e->e_macro, A_TEMP, 't', buf);
871 macdefine(&e->e_macro, A_TEMP, 'd', buf);
872 macdefine(&e->e_macro, A_TEMP, 'b', arpadate(buf));
873 if (macvalue('a', e) == NULL)
874 macdefine(&e->e_macro, A_PERM, 'a', macvalue('b', e));
897 openxscript(e) in openxscript() argument
898 register ENVELOPE *e; in openxscript()
902 if (e->e_xfp != NULL)
906 if (e->e_lockfp == NULL && bitset(EF_INQUEUE, e->e_flags))
910 p = queuename(e, XSCRPT_LETTER);
911 e->e_xfp = bfopen(p, FileMode, XscriptFileBufferSize,
914 if (e->e_xfp == NULL)
917 e->e_xfp = sm_io_open(SmFtStdio, SM_TIME_DEFAULT,
919 if (e->e_xfp == NULL)
922 (void) sm_io_setvbuf(e->e_xfp, SM_TIME_DEFAULT, NULL, SM_IO_LBF, 0);
926 dumpfd(sm_io_getinfo(e->e_xfp, SM_IO_WHAT_FD, NULL), true,
944 closexscript(e) in closexscript() argument
945 register ENVELOPE *e; in closexscript()
947 if (e->e_xfp == NULL)
950 if (e->e_lockfp == NULL)
953 (void) sm_io_close(e->e_xfp, SM_TIME_DEFAULT);
954 e->e_xfp = NULL;
996 setsender(from, e, delimptr, delimchar, internal) in setsender() argument
998 register ENVELOPE *e;
1014 macdefine(&e->e_macro, A_PERM, 'x', "");
1021 if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP ||
1030 macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), "e s");
1033 e->e_from.q_state = QS_BADADDR;
1034 e->e_from.q_flags = 0;
1036 parseaddr(from, &e->e_from, RF_COPYALL|RF_SENDERADDR,
1037 delimchar, delimptr, e, false) == NULL ||
1038 QS_IS_BADADDR(e->e_from.q_state) ||
1039 e->e_from.q_mailer == ProgMailer ||
1040 e->e_from.q_mailer == FileMailer ||
1041 e->e_from.q_mailer == InclMailer)
1049 p = macvalue('_', e);
1061 sm_syslog(LOG_NOTICE, e->e_id,
1067 if (!QS_IS_BADADDR(e->e_from.q_state))
1070 e->e_status = "5.1.7";
1071 usrerrenh(e->e_status,
1078 &e->e_from, RF_COPYALL|RF_SENDERADDR, ' ',
1079 NULL, e, false) == NULL)
1084 expand("\201n", nbuf, sizeof(nbuf), e);
1085 from = sm_rpool_strdup_x(e->e_rpool, nbuf);
1086 if (parseaddr(from, &e->e_from, RF_COPYALL, ' ',
1087 NULL, e, false) == NULL &&
1088 parseaddr(from = "postmaster", &e->e_from,
1089 RF_COPYALL, ' ', NULL, e, false) == NULL)
1095 e->e_from.q_state = QS_SENDER;
1099 printaddr(sm_debug_file(), &e->e_from, false);
1104 if (bitnset(M_CHECKUDB, e->e_from.q_mailer->m_flags))
1108 p = udbsender(e->e_from.q_user, e->e_rpool);
1114 if (bitnset(M_HASPWENT, e->e_from.q_mailer->m_flags))
1122 FullName = macvalue('x', e);
1132 if (e->e_from.q_user[0] != '\0' &&
1133 sm_mbdb_lookup(e->e_from.q_user, &user) == EX_OK)
1141 e->e_from.q_home = NULL;
1143 e->e_from.q_home = "";
1145 e->e_from.q_home = sm_rpool_strdup_x(e->e_rpool,
1147 macdefine(&e->e_macro, A_PERM, 'z', e->e_from.q_home);
1152 e->e_from.q_uid = user.mbdb_uid;
1153 e->e_from.q_gid = user.mbdb_gid;
1154 e->e_from.q_flags |= QGOODUID;
1160 strcmp(user.mbdb_name, e->e_from.q_user) == 0)
1167 e->e_from.q_home = NULL;
1170 macdefine(&e->e_macro, A_TEMP, 'x', FullName);
1174 if (e->e_from.q_home == NULL)
1176 e->e_from.q_home = getenv("HOME");
1177 if (e->e_from.q_home != NULL)
1179 if (*e->e_from.q_home == '\0')
1180 e->e_from.q_home = NULL;
1181 else if (strcmp(e->e_from.q_home, "/") == 0)
1182 e->e_from.q_home++;
1185 e->e_from.q_uid = RealUid;
1186 e->e_from.q_gid = RealGid;
1187 e->e_from.q_flags |= QGOODUID;
1201 sm_syslog(LOG_NOTICE, e->e_id,
1206 (void) REWRITE(pvp, 3, e);
1207 (void) REWRITE(pvp, 1, e);
1208 (void) REWRITE(pvp, 4, e);
1209 macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), NULL);
1212 if (*bp == '@' && !bitnset(M_NOBRACKET, e->e_from.q_mailer->m_flags))
1218 e->e_sender = sm_rpool_strdup_x(e->e_rpool, bp);
1219 macdefine(&e->e_macro, A_PERM, 'f', e->e_sender);
1222 if (e->e_from.q_mailer != NULL &&
1223 bitnset(M_CANONICAL, e->e_from.q_mailer->m_flags))
1228 macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), "e s");
1229 (void) REWRITE(pvp, 3, e);
1230 (void) REWRITE(pvp, 1, e);
1231 (void) REWRITE(pvp, 4, e);
1232 macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), NULL);
1242 e->e_fromdomain = copyplist(lastat, true, e->e_rpool);
1246 printav(sm_debug_file(), e->e_fromdomain);
1301 printenvflags(e) in printenvflags() argument
1302 register ENVELOPE *e; in printenvflags()
1307 sm_dprintf("%lx", e->e_flags);
1310 if (!bitset(ef->ef_bit, e->e_flags))