1N/A * Copyright (c) 1998-2003, 2006 Sendmail, Inc. and its suppliers. 1N/A * All rights reserved. 1N/A * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. 1N/A * Copyright (c) 1988, 1993 1N/A * The Regents of the University of California. All rights reserved. 1N/A * By using this file, you agree to the terms and conditions set 1N/A * forth in the LICENSE file which can be found at the top level of 1N/A * the sendmail distribution. 1N/A** CLRSESSENVELOPE -- clear session oriented data in an envelope 1N/A** e -- the envelope to clear. 1N/A#
endif /* _FFR_TLS_1 */ 1N/A#
endif /* STARTTLS */ 1N/A** NEWENVELOPE -- fill in a new envelope 1N/A** Supports inheritance. 1N/A** e -- the new envelope to fill in. 1N/A** parent -- the envelope to be the parent of e. 1N/A** rpool -- either NULL, or a pointer to a resource pool 1N/A** from which envelope memory is allocated, and 1N/A** to which envelope resources are attached. 1N/A ** This code used to read: 1N/A ** if (e == parent && e->e_parent != NULL) 1N/A ** parent = e->e_parent; 1N/A ** So if e == parent && e->e_parent == NULL then we would 1N/A ** set e->e_parent = e, which creates a loop in the e_parent chain. 1N/A ** This meant macvalue() could go into an infinite loop. 1N/A#
endif /* _FFR_SESSID */ 1N/A#
endif /* _FFR_SESSID */ 1N/A/* values for msg_timeout, see also IS_* below for usage (bit layout) */ 1N/A/* immediate return */ 1N/A** DROPENVELOPE -- deallocate an envelope. 1N/A** e -- the envelope to deallocate. 1N/A** fulldrop -- if set, do return receipts. 1N/A** split -- if true, split by recipient if message is queued up 1N/A** EX_* status (currently: 0: success, EX_IOERR on panic) 1N/A** housekeeping necessary to dispose of an envelope. 1N/A** Unlocks this queue file. 1N/A "dropenvelope, e_flags=0x%lx, OpMode=%c, pid=%d",
1N/A /* we must have an id to remove disk files */ 1N/A /* if verify-only mode, we can skip most of this */ 1N/A sm_dprintf(
"dropenvelope: e_id=%s, EF_LOGSENDER=%d, LogLevel=%d\n",
1N/A /* post statistics */ 1N/A ** Extract state information from dregs of send list. 1N/A /* see if a notification is needed */ 1N/A ** See if the message timed out. 1N/A /* nothing to do */ ;
1N/A "delivery time expired %lds",
1N/A "Cannot send message for %s",
1N/A /* don't free, allocated from e_rpool */ 1N/A "Delivery time (%lds) expired\n",
1N/A "Message could not be delivered for %s\n",
1N/A "Message will be deleted from queue\n");
1N/A#
endif /* _FFR_NODELAYDSN_ON_HOLD */ 1N/A "Warning: Delivery time (%lds) exceeded",
1N/A "Warning: could not send message for past %s",
1N/A /* don't free, allocated from e_rpool */ 1N/A "Warning: Delivery time (%lds) exceeded\n",
1N/A "Warning: message still undelivered after %s\n",
1N/A "Will keep trying until message is %s old\n",
1N/A sm_dprintf(
"failure_return=%d delay_return=%d success_return=%d queueit=%d\n",
1N/A ** If we had some fatal error, but no addresses are marked as 1N/A ** bad, mark them _all_ as bad. 1N/A ** Send back return receipts as requested. 1N/A ** Arrange to send error messages if there are fatal errors. 1N/A ** Arrange to send warning messages to postmaster as requested. 1N/A ** Instantiate or deinstantiate the queue. 1N/A sm_dprintf(
"\n===== Dropping queue files for %s... queueit=%d, e_flags=",
1N/A ** leave the Qf file behind as 1N/A ** the delivery attempt failed. 1N/A /* add to available space in filesystem */ 1N/A ** Save old sibling and set it to NULL to avoid 1N/A ** queueing up the same envelopes again. 1N/A ** This requires that envelopes in that list have 1N/A ** been take care of before (or at some other place). 1N/A syserr(
"!dropenvelope(%s): cannot commit data file %s, uid=%d",
1N/A /* now unlock the job */ 1N/A /* this envelope is marked unused */ 1N/A /* now unlock the job */ 1N/A /* make sure that this envelope is marked unused */ 1N/A** CLEARENVELOPE -- clear an envelope without unlocking 1N/A** This is normally used by a child process to get a clean 1N/A** envelope without disturbing the parent. 1N/A** e -- the envelope to clear. 1N/A** fullclear - if set, the current envelope is total 1N/A** garbage and should be ignored; otherwise, 1N/A** release any resources it may indicate. 1N/A** rpool -- either NULL, or a pointer to a resource pool 1N/A** from which envelope memory is allocated, and 1N/A** to which envelope resources are attached. 1N/A** Closes files associated with the envelope. 1N/A** Marks the envelope as unallocated. 1N/A /* clear out any file information */ 1N/A ** Copy BlankEnvelope into *e. 1N/A ** It is not safe to simply copy pointers to strings; 1N/A ** the strings themselves must be copied (or set to NULL). 1N/A ** The problem is that when we assign a new string value to 1N/A ** a member of BlankEnvelope, we free the old string. 1N/A ** We did not need to do this copying in sendmail 8.11 :-( 1N/A ** and it is a potential performance hit. Reference counted 1N/A ** strings are one way out. 1N/A ** Copy the macro table. 1N/A ** We might be able to avoid this by zeroing the macro table 1N/A ** and always searching BlankEnvelope.e_macro after e->e_macro 1N/A ** XXX There are many strings in the envelope structure 1N/A ** XXX that we are not attempting to copy here. 1N/A ** XXX Investigate this further. 1N/A#
endif /* _FFR_MILTER_ENHSC */ 1N/A** INITSYS -- initialize instantiation of system 1N/A** In Daemon mode, this is done in the child. 1N/A** e -- the envelope to use. 1N/A** Initializes the system macros, some global variables, 1N/A** etc. In particular, the current time in various 1N/A static char ybuf[
60];
/* holds tty id */ 1N/A ** Give this envelope a reality. 1N/A ** I.e., an id, a transcript, and a creation time. 1N/A ** We don't select the queue until all of the recipients are known. 1N/A ** Set OutChannel to something useful if stdout isn't it. 1N/A ** This arranges that any extra stuff the mailer produces 1N/A ** gets sent back to the user on error (because it is 1N/A ** tucked away in the transcript). 1N/A ** Set up some basic system macros. 1N/A /* time as integer, unix time, arpa time */ 1N/A** SETTIME -- set the current time. 1N/A** e -- the envelope in which the macros should be set. 1N/A** Sets the various time macros -- $a, $b, $d, $t. 1N/A** OPENXSCRIPT -- Open transcript file 1N/A** Creates a transcript file for possible eventual mailing or 1N/A** e -- the envelope to create the transcript in/for. 1N/A** Creates the transcript file. 1N/A#
endif /* ! O_APPEND */ 1N/A syserr(
"Can't create transcript file %s", p);
1N/A** CLOSEXSCRIPT -- close the transcript file. 1N/A** e -- the envelope containing the transcript to close. 1N/A** SETSENDER -- set the person who this message is from 1N/A** Under certain circumstances allow the user to say who 1N/A** s/he is (using -f or -r). These are: 1N/A** 1. The user's uid is zero (root). 1N/A** 2. The user's login name is in an approved list (typically 1N/A** from a network server). 1N/A** 3. The address the user is trying to claim has a 1N/A** "!" character in it (since #2 doesn't do it for 1N/A** us if we are dialing out for UUCP). 1N/A** A better check to replace #3 would be if the 1N/A** effective uid is "UUCP" -- this would require me 1N/A** to rewrite getpwent to "grab" uucp as it went by, 1N/A** make getname more nasty, do another passwd file 1N/A** scan, or compile the UID of "UUCP" into the code, 1N/A** all of which are reprehensible. 1N/A** Assuming all of these fail, we figure out something 1N/A** from -- the person we would like to believe this message 1N/A** is from, as specified on the command line. 1N/A** e -- the envelope in which we would like the sender set. 1N/A** delimptr -- if non-NULL, set to the location of the 1N/A** trailing delimiter. 1N/A** delimchar -- the character that will delimit the sender 1N/A** internal -- set if this address is coming from an internal 1N/A** source such as an owner alias. 1N/A** sets sendmail's notion of who the from person is. 1N/A /* may be set from earlier calls */ 1N/A ** Figure out the real user executing us. 1N/A ** Username can return errno != 0 on non-errors. 1N/A /* preset state for then clause in case from == NULL */ 1N/A /* log garbage addresses for traceback */ 1N/A "setsender: %s: invalid or unparsable, received from %s",
1N/A /* it was a bogus mailer in the from addr */ 1N/A "553 Invalid sender address");
1N/A syserr(
"553 5.3.0 setsender: can't even parse postmaster!");
1N/A /* if the user already given fullname don't redefine */ 1N/A ** Process passwd file entry. 1N/A /* extract home directory */ 1N/A /* extract user and group id */ 1N/A /* extract full name from passwd file */ 1N/A ** Rewrite the from person to dispose of possible implicit 1N/A ** links in the net. 1N/A /* don't need to give error -- prescan did that already */ 1N/A "cannot prescan from (%s)",
1N/A /* heuristic: route-addr: add angle brackets */ 1N/A /* save the domain spec if this mailer wants it */ 1N/A /* get rid of any pesky angle brackets */ 1N/A /* strip off to the last "@" sign */ 1N/A** PRINTENVFLAGS -- print envelope flags for debugging 1N/A** e -- the envelope with the flags to be printed.