diff options
| author | glass <glass@NetBSD.org> | 1994-03-16 02:11:31 +0000 |
|---|---|---|
| committer | glass <glass@NetBSD.org> | 1994-03-16 02:11:31 +0000 |
| commit | 3fb497653d34cde8706b0e446e52182df5bc4ae7 (patch) | |
| tree | 378207336652cf6132b6412b0e6c3f105621d985 /usr.sbin | |
| parent | c0ae496079e5f8f6af13afb704a68b285f4d14b4 (diff) | |
sendmail 8.6.7. fixes recently discovered security hole
Diffstat (limited to 'usr.sbin')
50 files changed, 1863 insertions, 694 deletions
diff --git a/usr.sbin/sendmail/CHANGES-R5-R8 b/usr.sbin/sendmail/CHANGES-R5-R8 index a3fdb53064b..722dcc7b5a4 100644 --- a/usr.sbin/sendmail/CHANGES-R5-R8 +++ b/usr.sbin/sendmail/CHANGES-R5-R8 @@ -1,4 +1,5 @@ SUMMARY OF CHANGES BETWEEN SENDMAIL V5 and V8 + @(#)CHANGES-R5-R8 8.1 (Berkeley) 2/26/94 The following is a summary of the changes between the last commonly available version of sendmail from Berkeley (5.67) and the latest diff --git a/usr.sbin/sendmail/FAQ b/usr.sbin/sendmail/FAQ index 43e02f6e1e1..dac98534741 100644 --- a/usr.sbin/sendmail/FAQ +++ b/usr.sbin/sendmail/FAQ @@ -1,6 +1,6 @@ Sendmail Version 8 Frequently Asked Questions - Last Update: January 12, 1994 + Version 8.2 of 2/28/94 This FAQ is specific to Version 8 of sendmail. @@ -70,15 +70,6 @@ This FAQ is specific to Version 8 of sendmail. Avolio & Vixie, _Sendmail Theory and Practice_. Digital Press (release date unknown). ---------------------------------------------------------------------- - * Why does the Costales book have a bat on the cover? - - Do you want the real answer or the fun answer? The real - answer is that Bryan Costales was presented with a choice - of three pictures, and he picked the bat because it appealed - to him the most. The fun answer is that, although sendmail - has a reputation for being scary, like a bat, it is really - a rather friendly and intelligent beast. ----------------------------------------------------------------------- * How do I make all my addresses appear to be from a single host? Using the V8 configuration macros, use: @@ -302,21 +293,41 @@ This FAQ is specific to Version 8 of sendmail. uucp-dom somehost!wolf somehost!wolf@grasp.insa-lyon.fr uucp-uudom somehost!wolf grasp.insa-lyon.fr!somehost!wolf ---------------------------------------------------------------------- -+ * I'm trying to to get my mail to go into queue only mode, and it -+ delivers the mail interactively anyway. (Or, I'm trying to use -+ the "don't deliver to expensive mailer" flag, and it doesn't -+ delivers the mail interactively anyway.) I can see it does it: -+ here's the output of "sendmail -v foo@somehost" (or Mail -v or -+ equivalent). -+ -+ The -v flag to sendmail (which is implied by the -v flag to -+ Mail and other programs in that family) tells sendmail to -+ watch the transaction. Since you have explicitly asked to -+ see what's going on, it assumes that you do not want to to -+ auto-queue, and turns that feature off. Remove the -v flag -+ and use a "tail -f" of the log instead to see what's going on. -+ -+ If you are trying to use the "don't deliver to expensive mailer" -+ flag (mailer flag "e"), be sure you also turn on global option -+ "c" -- otherwise it ignores the mailer flag. + * I'm trying to to get my mail to go into queue only mode, and it + delivers the mail interactively anyway. (Or, I'm trying to use + the "don't deliver to expensive mailer" flag, and it doesn't + delivers the mail interactively anyway.) I can see it does it: + here's the output of "sendmail -v foo@somehost" (or Mail -v or + equivalent). + + The -v flag to sendmail (which is implied by the -v flag to + Mail and other programs in that family) tells sendmail to + watch the transaction. Since you have explicitly asked to + see what's going on, it assumes that you do not want to to + auto-queue, and turns that feature off. Remove the -v flag + and use a "tail -f" of the log instead to see what's going on. + + If you are trying to use the "don't deliver to expensive mailer" + flag (mailer flag "e"), be sure you also turn on global option + "c" -- otherwise it ignores the mailer flag. +---------------------------------------------------------------------- + * I'm getting "Local configuration error" messages, such as: + + 553 relay.domain.net config error: mail loops back to myself + 554 <user@domain.net>... Local configuration error + + How can I solve this problem? + + You have asked mail to the domain (e.g., domain.net) to be + forwarded to a specific host (in this case, relay.domain.net) + by using an MX record, but the relay machine doesn't recognize + itself as domain.net. Add domain.net to /etc/sendmail.cw + (if you are using FEATURE(use_cw_file)) or add "Cw domain.net" + to your configuration file. +---------------------------------------------------------------------- + * I want to run Sendmail version 8 on my DEC system, but you don't + have MAIL11V3 support in sendmail. How do I handle this? + + Get Paul Vixie's reimplementation of the mail11 protocol + from gatekeeper.dec.com in /pub/DEC/gwtools. ---------------------------------------------------------------------- diff --git a/usr.sbin/sendmail/KNOWNBUGS b/usr.sbin/sendmail/KNOWNBUGS index 1894e012bc8..f34c6b738c1 100644 --- a/usr.sbin/sendmail/KNOWNBUGS +++ b/usr.sbin/sendmail/KNOWNBUGS @@ -1,23 +1,17 @@ K N O W N B U G S I N S E N D M A I L - (for 8.6.5) + (for 8.6.7) The following are bugs or deficiencies in sendmail that I am aware of but which have not been fixed in the current release. You probably want to get the most up to date version of this from FTP.CS.Berkeley.EDU -in /ucb/sendmail/KNOWNBUGS. +in /ucb/sendmail/KNOWNBUGS. For descriptions of bugs that have been +fixed, see the file RELEASE_NOTES (in the root directory of the sendmail +distribution). -This list is not guaranteed to be complete, especially for fixed bugs. -Many bugs are reported and fixed without ever making it as far as this -file. See the file RELEASE_NOTES (in the root directory of the sendmail -distribution) for more details. - - -+----------------------------------------------+ -| THE FOLLOWING PROBLEMS ARE STILL OUTSTANDING | -+----------------------------------------------+ +This list is not guaranteed to be complete. * Null bytes are not handled properly. @@ -125,47 +119,13 @@ distribution) for more details. You can eliminate this by adding commas at the end of each line of the :include: file. +* Excessive mailing list nesting can run out of file descriptors. -+-------------------------------------------+ -| THE FOLLOWING PROBLEMS ARE FIXED IN 8.6.5 | -+-------------------------------------------+ - -* Route-addrs missing angle brackets. - - There are cases where route-addrs do not get angle brackets around them, - such as in the "-r" flag on mailers or in the From_ line created when - mailing to files. - -* No "exposed users" in "nullrelay" configuration. - - The "nullrelay" configuration hides all addresses behind the mail - hub name. Some sites might prefer to expose some names such as - root. This information is always available in Received: lines. - -* owner-* alias that uses :include: broken. - - If you have aliases set up as: - - owner-listname: :include:/some/file - - sendmail will break because it considers this a "sender address", - which is not permitted to use the :include: syntax. The easiest - workaround is to change this to: - - owner-listname: :include:/some/file, - - (note the trailing comma); a somewhat cleaner solution is to use: - - owner-listname: listname-request - listname-request: :include:/some/file - -* "SYSERR: openmailer(local): fd 1 not open" message - - File descriptor 1 (standard output) should not be closed during normal - processing. This is checked periodically, and sometimes this condition - is found and this message is produced. Sendmail repairs the problem, - and the mail is still delivered, but I still don't know why it happens. - (There was a bug that was fixed in 8.6.beta.13 that might be related, - but I think this bug still exists.) + If you have a mailing list that includes lots of other mailing + lists, each of which has a separate owner, you can run out of + file descriptors. Each mailing list with a separate owner uses + one open file descriptor (prior to 8.6.6 it was three open + file descriptors per list). This is particularly egregious if + you have your connection cache set to be large. -(Version 8.15, last updated 1/12/94) +(Version 8.18, last updated 3/14/94) diff --git a/usr.sbin/sendmail/Makefile b/usr.sbin/sendmail/Makefile index 39123a11951..6a027e46206 100644 --- a/usr.sbin/sendmail/Makefile +++ b/usr.sbin/sendmail/Makefile @@ -1,22 +1,24 @@ -# @(#)Makefile 8.2 (Berkeley) 9/25/93 +# @(#)Makefile 8.3 (Berkeley) 2/27/94 SUBDIR= src mailstats makemap praliases cf/cf +FTPDIR= barad-dur:/disks/barad-dur/ftp/sendmail/. VER= XX tar: Files.base Files.cf Files.misc Files.xdoc (cd src; ${MAKE}) (cd doc; PRINTER=ps ${MAKE}) + (cd doc; chmod 444 op/op.ps intro/intro.ps usenix/usenix.ps) (cd cf/cf; ${MAKE}) - pax -w -x tar -L -f sendmail.${VER}.base.tar `cat Files.base` + pax -w -x tar -L -f sendmail.${VER}.base.tar `grep -v ^# Files.base` compress sendmail.${VER}.base.tar - pax -w -x tar -L -f sendmail.${VER}.cf.tar `cat Files.cf` + pax -w -x tar -L -f sendmail.${VER}.cf.tar `grep -v ^# Files.cf` compress sendmail.${VER}.cf.tar - pax -w -x tar -L -f sendmail.${VER}.misc.tar `cat Files.misc` + pax -w -x tar -L -f sendmail.${VER}.misc.tar `grep -v ^# Files.misc` compress sendmail.${VER}.misc.tar - pax -w -x tar -L -f sendmail.${VER}.xdoc.tar `cat Files.xdoc` + pax -w -x tar -L -f sendmail.${VER}.xdoc.tar `grep -v ^# Files.xdoc` compress sendmail.${VER}.xdoc.tar ftp: sendmail.${VER}.base.tar.Z sendmail.${VER}.cf.tar.Z sendmail.${VER}.misc.tar.Z sendmail.${VER}.xdoc.tar.Z - rcp sendmail.${VER}.*.tar.Z RELEASE_NOTES barad-dur:/disks/barad-dur/ftp/sendmail/. + rcp sendmail.${VER}.*.tar.Z RELEASE_NOTES FAQ KNOWNBUGS ${FTPDIR} .include <bsd.subdir.mk> diff --git a/usr.sbin/sendmail/READ_ME b/usr.sbin/sendmail/READ_ME index d91a54dad35..52d39896098 100644 --- a/usr.sbin/sendmail/READ_ME +++ b/usr.sbin/sendmail/READ_ME @@ -1,5 +1,5 @@ /*- - * @(#)READ_ME 8.8 (Berkeley) 1/4/94 + * @(#)READ_ME 8.9 (Berkeley) 1/26/94 */ SENDMAIL RELEASE 8 @@ -113,11 +113,9 @@ relevant to sendmail) are: RFC987 Mapping between RFC822 and X.400 RFC1049 Content-Type header field (extension to RFC822) -Unfortunately, for a variety of reasons the Makefiles are for the new -Berkeley "make" and will not work on the old, traditional make. I urge -you to get this make from Net2 (available on many public FTP archives). -Failing that, some directories have a "Makefile.dist" that will work on -older versions of make (but don't have the niceties included). +Warning to AIX users: this version of sendmail does not implement +MB, MR, or MG DNS resource records, as defined as experiments in +RFC883. +-------------------+ @@ -134,6 +132,10 @@ faster, and the interface is nicer to animals and plants. You will also probably find that you have to add -I/where/you/put/db/include to the sendmail makefile to get db.h to work properly. +Be sure you remove ndbm.h and ndbm.o from the db distribution. These +will cause problems with sendmail because sendmail already understands +about NEWDB and NDBM coexisting. + +-------------+ | USE WITH MH | @@ -163,7 +165,13 @@ in toto: BINDIR?= /usr/sbin The other directories should all have Makefile.dist files that work -on the old make. For more details, see src/READ_ME. +on the old make, albeit without all the niceties included. + +You can also get a new Berkeley make from the Net2 release (available +on many public FTP archives). This version should also interpret old +Makefiles, so you could drop it in as your default make. + +For more details, see src/READ_ME. +---------------------+ diff --git a/usr.sbin/sendmail/RELEASE_NOTES b/usr.sbin/sendmail/RELEASE_NOTES index 7bbd6845111..ff3d145e46f 100644 --- a/usr.sbin/sendmail/RELEASE_NOTES +++ b/usr.sbin/sendmail/RELEASE_NOTES @@ -1,3 +1,248 @@ + SENDMAIL RELEASE NOTES + @(#)RELEASE_NOTES 8.6.7.1 (Berkeley) 3/14/94 + +This listing shows the version of the sendmail binary, the version +of the sendmail configuration files, the date of release, and a +summary of the changes in that release. + +8.6.7/8.6.6 94/03/14 + SECURITY: it was possible to get root access by using wierd + values to the -d flag. Thanks to Alain Durand of + INRIA for forwarding me the notice from the bugtraq + list. + +8.6.6/8.6.6 94/03/13 + SECURITY: the ability to give files away on System V-based + systems proved dangerous -- don't run as the owner + of a :include: file on a system that allows giveaways. + Unfortunately, this also applies to determining a + valid shell. + IMPORTANT: Previous versions weren't expiring old connections + in the connection cache for a long time under some + circumstances. This could result in resource exhaustion, + both at your end and at the other end. This checks the + connections for timeouts much more frequently. From + Doug Anderson of NCSC. + Fix a glitch that snuck in that caused programs to be run as + the sender instead of the recipient if the mail was + from a local user to another local user. From + Motonori Nakamura of Kyoto University. + Fix "wildcard" on /etc/shell matching -- instead of looking + for "*", look for "/SENDMAIL/ANY/SHELL/". From + Bryan Costales of ICSI. + Change the method used to declare the "statfs" availability; + instead of HASSTATFS and/or HASUSTAT with a ton of + tweaking in conf.c, there is a single #define called + SFS_TYPE which takes on one of six values (SFS_NONE + for no statfs availability, SFS_USTAT for the ustat(2) + syscall, SFS_4ARGS for a four argument statfs(2) call, + and SFS_VFS, SFS_MOUNT, or SFS_STATFS for a two argument + statfs(2) call with the declarations in <sys/vfs.h>, + <sys/mount.h>, or <sys/statfs.h> respectively). + Fix glitch in NetInfo support that could return garbage if + there was no "/locations/sendmail" property. From + David Meyer of the University of Virginia. + Change HASFLOCK from defined/not-defined to a 0/1 definition + to allow Linux to turn it off even though it is a + BSD-like system. + Allow setting of "ident" timeout to zero to turn off the ident + protocol entirely. + Make 7-bit stripping local to a connection (instead of to a + mailer); this allows you to specify that SMTP is a + 7-bit channel, but revert to 8-bit should it advertise + that it supports 8BITMIME. You still have to specify + mailer flag 7 to get this stripping at all. + Improve makesendmail script so it handles more cases automatically. + Tighten up restrictions on taking ownership of :include: files + to avoid problems on systems that allow you to give away + files. + Fix a problem that made it impossible to rebuild the alias + file if it was on a read-only file system. From + Harry Edmon of the University of Washington. + Improve MX randomization function. From John Gardiner Myers + of CMU. + Fix a minor glitch causing a bogus message to be printed (used + %s instead of %d in a printf string for the line number) + when a bad queue file was read. From Harry Edmon. + Allow $s to remain NULL on locally generated mail. I'm not + sure this is necessary, but a lot of people have complained + about it, and there is a legitimate question as to whether + "localhost" is legal as an 822-style domain. + Fix a problem with very short line lengths (mailer L= flag) in + headers. This causes a leading space to be added onto + continuation lines (including in the body!), and also + tries to wrap headers containing addresses (From:, To:, + etc) intelligently at the shorter line lengths. Problem + Reported by Lars-Johan Liman of SUNET Operations Center. + Log the real user name when logging syserrs, since these can have + security implications. Suggested by several people. + Fix address logging of cached connections -- it used to always + log the numeric address as zero. This is a somewhat + bogus implementation in that it does an extra system + call, but it should be an inexpensive one. Fix from + Motonori Nakamura. + Tighten up handling of short syslog buffers even more -- there + were cases where the outgoing relay= name was too long + to share a line with delay= and mailer= logging. + Limit the overhead on split envelopes to one open file descriptor + per envelope -- previously the overhead was three + descriptors. This was in response to a problem reported + by P{r (Pell) Emanuelsson. + Fixes to better handle the case of unexpected connection closes; + this redirects the output to the transcript so the info + is not lost. From Eric Wassenaar. + Fix potential string overrun if you macro evaluate a string that + has a naked $ at the end. Problem noted by James Matheson + <jmrm@eng.cam.ac.uk>. + Make default error number on $#error messages 553 (``Requested + action not taken: mailbox name not allowed'') instead of + 501 (``Syntax error in parameters or arguments'') to + avoid bogus "protocol error" messages. + Strip off any existing trailing dot on names during $[ ... $] + lookup. This prevents it from ending up with two dots + on the end of dot terminated names. From Wesley Craig + of the University of Michigan and Bryan Costales of ICSI. + Clean up file class reading so that the debugging information is + more informative. It hadn't been using setclass, so you + didn't see the class items being added. + Avoid core dump if you are running a version of sendmail where + NIS is compiled in, and you specify an NIS map, but + NIS is not running. Fix from John Oleynick of + Rutgers. + Diagnose bizarre case where res_search returns a failure value, + but sets h_errno to a success value. + Make sure that "too many hops" messages are considered important + enough to send an error to the Postmaster (that is, the + address specified in the P option). This fix should + help problems that cause the df file to be left around + sometimes -- unfortunately, I can't seem to reproduce + the problem myself. + Avoid core dump (null pointer reference) on EXPN command; this + only occurred if your log level was set to 10 or higher + and the target account was an alias or had a .forward file. + Problem noted by Janne Himanka. + Avoid "denial of service" attacks by someone who is flooding your + SMTP port with bad commands by shutting the connection + after 25 bad commands are issued. From Kyle Jones of + UUNET. + Fix core dump on error messages with very long "to" buffers; + fmtmsg overflows the message buffer. Fixed by trimming + the to address to 203 characters. Problem reported by + John Oleynick. + Fix configuration for HASFLOCK -- there were some spots where + a #ifndef was incorrectly #ifdef. Pointed out by + George Baltz of the University of Maryland. + Fix a typo in savemail() that could cause the error message To: + lists to be incorrect in some places. From Motonori + Nakamura. + Fix a glitch that can cause duplicate error messages on split + envelopes where an address on one of the lists has a + name server failure. Fix from Voradesh Yenbut of the + University of Washington. + Fix possible bogus pointer reference on ESMTP parameters that + don't have an ``=value'' part. + CNAME loops caused an error message to be generated, but also + re-queued the message. Changed to just re-queue the + message (it's really hard to just bounce it because + of the wierd way the name server works in the presence + of CNAME loops). Problem noted by James M.R.Matheson + of Cambridge University. + Avoid giving ``warning: foo owned process doing -bs'' messages + if they use ``MAIL FROM:<foo>'' where foo is their true + user name. Suggested by Andreas Stolcke of ICSI. + Change the NAMED_BIND compile flag to be a 0/1 flag so you can + override it easily in the Makefile -- that is, you can + turn it off using -DNAMED_BIND=0. + If a gethostbyname(...) of an address with a trailing dot fails, + try it without the trailing dot. This is because if + you have a version of gethostbyname() that falls back + to NIS or the /etc/hosts file it will fail to find + perfectly reasonable names that just don't happen to + be dot terminated in the hosts file. You don't want to + strip the dot first though because we're trying to ensure + that country names that match one of your subdomains get + a chance. + PRALIASES: fix bogus output on non-null-terminated strings. + From Bill Gianopoulos of Raytheon. + CONFIG: Avoid rewriting anything that matches $w to be $j. + This was in code intended to only catch the self-literal + address (that is, [1.2.3.4], where 1.2.3.4 is your + IP address), but the code was broken. However, it will + still do this if $M is defined; this is necessary to + get client configurations to work (sigh). Note that this + means that $M overrides :mailname entries in the user + database! Problem noted by Paul Southworth. + CONFIG: Fix definition of Solaris help file location. From + Steve Cliffe <steve@gorgon.cs.uow.edu.au>. + CONFIG: Fix bug that broke news.group.USENET mappings. + CONFIG: Allow declaration of SMTP_MAILER_MAX, FAX_MAILER_MAX, + and USENET_MAILER_MAX to tweak the maximum message + size for various mailers. + CONFIG: Change definition of USENET_MAILER_ARGS to include argv[0] + instead of assuming that it is "inews" for consistency + with other mailers. From Michael Corrigan of UC San Diego. + CONFIG: When mail is forwarded to a LOCAL_RELAY or a MAIL_HUB, + qualify the address in the SMTP envelope as user@{relay|hub} + instead of user@$j. From Bill Wisner of The Well. + CONFIG: Fix route-addr syntax in nullrelay configuration set. + CONFIG: Don't turn off case mapping of user names in the local + mailer for IRIX. This was different than most every other + system. + CONFIG: Avoid infinite loops on certainly list:; syntaxes in + envelope. Noted by Thierry Besancon + <besancon@excalibur.ens.fr>. + CONFIG: Don't include -z by default on uux line -- most systems + don't want it set by default. Pointed out by Philippe + Michel of Thomson CSF. + CONFIG: Fix some bugs with mailertables -- for example, if your + host name was foo.bar.ray.com and you matched against + ".ray.com", the old implementation bound %1 to "bar" + instead of "foo.bar". Also, allow "." in the mailertable + to match anything -- essentially, take over SMART_HOST. + This also moves matching of explicit local host names + before the mailertable so they don't have to be special + cased in the mailertable data. Reported by Bill + Gianopoulos of Raytheon; the fix for the %1 binding + problem was contributed by Nicholas Comanos of the + University of Sydney. + CONFIG: Don't include "root" in class $=L (users to deliver + locally, even if a hub or relay exists) by default. + This is because of the known bug where definition of + both a LOCAL_RELAY and a MAIL_HUB causes $=L to ignore + both and deliver into the local mailbox. + CONFIG: Move up bitdomain and uudomain handling so that they + are done before .UUCP class matching; uudomain was + reported as ineffective before. This also frees up + diversion 8 for future use. Problem reported by Kimmo + Suominen. + CONFIG: Don't try to convert dotted IP address (e.g., [1.2.3.4]) + into host names. As pointed out by Jonathan Kamens, + these are often used because either the forward or reverse + mapping is broken; this translation makes it broken again. + DOC: Clarify $@ and $: in the Install & Op Guide. From Kimmo + Suominen. + Portability fixes: + Unicos from David L. Kensiski of Sterling Sofware. + DomainOS from Don Lewis of Silicon Systems. + GNU m4 1.0.3 from Karst Koymans of Utrecht University. + Convex from Kimmo Suominen <kim@tac.nyc.ny.us>. + NetBSD from Adam Glass <glass@sun-lamp.cs.berkeley.edu>. + BSD/386 from Tony Sanders of BSDI. + Apollo from Eric Wassenaar. + DGUX from Doug Anderson. + Sequent DYNIX/ptx 2.0 from Tim Wright of Sequent. + NEW FILES: + src/Makefile.DomainOS + src/Makefile.PTX + src/Makefile.SunOS.5.1 + src/Makefile.SunOS.5.2 + src/Makefile.SunOS.5.x + src/mailq.1 + cf/ostype/domainos.m4 + doc/op/Makefile + doc/intro/Makefile + doc/usenix/Makefile + 8.6.5/8.6.5 94/01/13 Security fix: /.forward could be owned by anyone (the test to allow root to own any file was backwards). From @@ -185,6 +430,8 @@ new arguments. For example, if you used ``sendmail -C config -v -q'' it would choke on the -q because the -C would stop looking for old-format arguments. + Fix the code that was intended to allow two users to forward their + mail to the same program and have them appear unique. Portability fixes for: SCO UNIX from Murray Kucherawy. SCO Open Server 3.2v4 from Philippe Brand. diff --git a/usr.sbin/sendmail/cf/README b/usr.sbin/sendmail/cf/README index b604d2453f5..189db52d1c0 100644 --- a/usr.sbin/sendmail/cf/README +++ b/usr.sbin/sendmail/cf/README @@ -4,7 +4,7 @@ Eric Allman <eric@CS.Berkeley.EDU> - @(#)README 8.21 (Berkeley) 1/12/94 + @(#)README 8.27 (Berkeley) 3/12/94 This document describes the sendmail configuration files being used @@ -13,7 +13,7 @@ there is an ``OLDSENDMAIL'' mode, they haven't really been tested on old versions of sendmail and cannot be expected to work well. These configuration files are probably not as general as previous -versions, and don't handle as many of the wierd cases automagically. +versions, and don't handle as many of the weird cases automagically. I was able to simplify by them for two reasons. First, the network has become more consistent -- for example, at this point, everyone on the internet is supposed to be running a name server, so hacks to @@ -23,8 +23,8 @@ a long-haul protocol. I realize that this is not universal, but it does describe the vast majority of sites with which I am familiar, including those outside the US. -Of course, the downside of this is that if you do live in a wierd -world, things are going to get wierder for you. I'm sorry about that, +Of course, the downside of this is that if you do live in a weird +world, things are going to get weirder for you. I'm sorry about that, but at the time we at Berkeley had a problem, and it seemed like the right thing to do. @@ -163,8 +163,12 @@ USENET_MAILER_PATH [/usr/lib/news/inews] The name of the program USENET_MAILER_FLAGS [rlsDFMmn] The mailer flags for the usenet mailer. USENET_MAILER_ARGS [-m -h -n] The command line arguments for the usenet mailer. +USENET_MAILER_MAX [100000] The maximum size of messages that will + be accepted by the usenet mailer. SMTP_MAILER_FLAGS [undefined] Flags added to SMTP mailer. Default flags are `mDFMUX' (and `a' for esmtp mailer). +SMTP_MAILER_MAX [undefined] The maximum size of messages that will + be transported using the smtp or esmtp mailers. UUCP_MAILER_FLAGS [undefined] Flags added to UUCP mailer. Default flags are `DFMhuU' (and `m' for suucp mailer, minus `U' for uucp-dom mailer). @@ -172,11 +176,10 @@ UUCP_MAILER_ARGS [uux - -r -z -a$f -gC $h!rmail ($u)] The arguments passed to the UUCP mailer. UUCP_MAX_SIZE [100000] The maximum size message accepted for transmission by the UUCP mailers. -HOSTMAP_SPEC [dbm -o /etc/hostmap] The value for the builtin - hostmap key definition. You can redefine this - to change the class, flags, and filename of - the hostmap. The default flag (-o) makes this - map optional. +FAX_MAILER_PATH [/usr/local/lib/fax/mailfax] The program used to + submit FAX messages. +FAX_MAILER_MAX [100000] The maximum size message accepted for + transmission by FAX. +---------+ | DOMAINS | @@ -410,6 +413,20 @@ Complex sites will need more local configuration information, such as lists of UUCP hosts they speak with directly. This can get a bit more tricky. For an example of a "complex" site, see cf/ucbvax.mc. +If your host is known by several different names, you need to augment +the $=w class. This is a list of names by which you are known, and +anything sent to an address using a host name in this list will be +treated as local mail. You can do this in two ways: either create +the file /etc/sendmail.cw containing a list of your aliases (one per +line), and use ``FEATURE(use_cw_file)'' in the .mc file, or add the +line: + + Cw alias.host.name + +at the end of that file. See the ``vangogh.mc'' file for an example. +Be sure you use the fully-qualified name of the host, rather than a +short name. + The SITECONFIG macro allows you to indirectly reference site-dependent configuration information stored in the siteconfig subdirectory. For example, the line @@ -418,18 +435,26 @@ example, the line reads the file uucp.ucbvax for local connection information. The second parameter is the local name (in this case just "ucbvax" since -it is locally connected, and hence a UUCP hostname) and the name of -the class in which to store the host information. Another SITECONFIG -line reads +it is locally connected, and hence a UUCP hostname). The third +parameter is the name of both a macro to store the local name (in +this case, $U) and the name of the class (e.g., $=U) in which to store +the host information read from the file. Another SITECONFIG line reads SITECONFIG(uucp.ucbarpa, ucbarpa.Berkeley.EDU, W) This says that the file uucp.ucbarpa contains the list of UUCP sites connected to ucbarpa.Berkeley.EDU. The $=W class will be used to -store this list. [The machine ucbarpa is gone now, but I've left +store this list, and $W is defined to be ucbarpa.Berkeley.EDU, that +is, the name of the relay to which the hosts listed in uucp.ucbarpa +are connected. [The machine ucbarpa is gone now, but I've left this out-of-date configuration file around to demonstrate how you might do this.] +Note that the case of SITECONFIG with a third parameter of ``U'' is +special; the second parameter is assumed to be the UUCP name of the +local site, rather than the name of a remote site, and the UUCP name +is entered into $=w (the list of local hostnames) as $U.UUCP. + The siteconfig file (e.g., siteconfig/uucp.ucbvax.m4) contains nothing more than a sequence of SITE macros describing connectivity. For example: @@ -547,7 +572,7 @@ will cause addresses of the form "decvax!user" and "research!user" to be converted to "user@decvax.dec.com" and "user@research.att.com" respectively. -This could also be used to look hosts in a database map: +This could also be used to look up hosts in a database map: LOCAL_RULE_3 R$* < @ $+ > $* $: $1 < @ $(hostmap $2 $) > $3 @@ -559,7 +584,7 @@ For example, new rules are needed to parse hostnames that you accept via MX records. For example, you might have: LOCAL_RULE_0 - R$+ < @ cnmat.Berkeley.EDU > $#uucp $@ cnmat $: $1 + R$+ <@ host.dom.ain.> $#uucp $@ cnmat $: $1 < @ host.dom.ain.> You would use this if you had installed an MX record for cnmat.Berkeley.EDU pointing at this host; this rule catches the message and forwards it on @@ -585,9 +610,9 @@ You can have your host masquerade as another using MASQUERADE_AS(host.domain) -This causes outgoing SMTP mail to be labelled as coming from the +This causes outgoing SMTP mail to be labeled as coming from the indicated domain, rather than $j. One normally masquerades as one -of your own subdomains (for example, it's unlikely that I would +of one's own subdomains (for example, it's unlikely that I would choose to masquerade as an MIT site). The masquerade name is not normally canonified, so it is important @@ -628,9 +653,11 @@ shared /var/spool/mail scheme, use define(`MAIL_HUB', mailer:hostname) Again, ``mailer:'' defaults to "smtp". If you define both LOCAL_RELAY -and MAIL_HUB, unqualified names and names in class L will be sent to -the LOCAL_RELAY and other local names will be sent to MAIL_HUB. For -example, if are on machine mastodon.CS.Berkeley.EDU, the following +and MAIL_HUB, unqualified names will be sent to the LOCAL_RELAY and +other local names will be sent to MAIL_HUB. Names in $=L will be +delivered locally, so you MUST have aliases or .forward files for them. + +For example, if are on machine mastodon.CS.Berkeley.EDU, the following combinations of settings will have the indicated effects: email sent to.... eric eric@mastodon.CS.Berkeley.EDU @@ -786,7 +813,7 @@ Sam Leffler's FlexFAX software is still in beta test -- but he expects a public version out "later this week" [as of 3/1/93]. The following blurb is direct from Sam: - $Header: /cvsroot/src/usr.sbin/sendmail/cf/Attic/README,v 1.7 1994/01/31 02:38:21 glass Exp $ + $Header: /cvsroot/src/usr.sbin/sendmail/cf/Attic/README,v 1.8 1994/03/16 02:11:48 glass Exp $ How To Obtain This Software (in case all you get is this file) -------------------------------------------------------------- @@ -1081,7 +1108,7 @@ feature These hold special orthogonal features that you might hack Local hacks. These can be referenced using the HACK macro. They shouldn't be of more than voyeuristic interest outside the .Berkeley.EDU domain, but who knows? - We've all got our own peccadilloes. + We've all got our own peccadillos. siteconfig Site configuration -- e.g., tables of locally connected UUCP sites. @@ -1197,5 +1224,5 @@ M4 DIVERSIONS 5 locally interpreted names (overrides $R) 6 local configuration (at top of file) 7 mailer definitions - 8 special local name recognition (late in ruleset 3) + 8 9 special local rulesets (1 and 2) diff --git a/usr.sbin/sendmail/cf/domain/Berkeley.m4 b/usr.sbin/sendmail/cf/domain/Berkeley.m4 index c3320e00f0a..4f572d6436a 100644 --- a/usr.sbin/sendmail/cf/domain/Berkeley.m4 +++ b/usr.sbin/sendmail/cf/domain/Berkeley.m4 @@ -33,9 +33,9 @@ divert(-1) # SUCH DAMAGE. # divert(0) -VERSIONID(`@(#)Berkeley.m4 8.4 (Berkeley) 12/20/93') +VERSIONID(`@(#)Berkeley.m4 8.5 (Berkeley) 2/18/94') define(`UUCP_RELAY', `ucbvax.Berkeley.EDU')dnl -define(`BITNET_RELAY', `jade.Berkeley.EDU')dnl +define(`BITNET_RELAY', `CMSA.Berkeley.EDU')dnl define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward')dnl define(`confCW_FILE', `-o /etc/sendmail.cw')dnl FEATURE(redirect)dnl diff --git a/usr.sbin/sendmail/cf/feature/bitdomain.m4 b/usr.sbin/sendmail/cf/feature/bitdomain.m4 index d90bb106346..85c8cf0017f 100644 --- a/usr.sbin/sendmail/cf/feature/bitdomain.m4 +++ b/usr.sbin/sendmail/cf/feature/bitdomain.m4 @@ -34,7 +34,7 @@ divert(-1) # divert(0) -VERSIONID(`@(#)bitdomain.m4 8.4 (Berkeley) 11/30/93') +VERSIONID(`@(#)bitdomain.m4 8.6 (Berkeley) 2/19/94') divert(-1) @@ -43,7 +43,7 @@ Kbitdomain ifelse(_ARG_, `', `hash -o /etc/bitdomain', `_ARG_') POPDIVERT -PUSHDIVERT(8) +PUSHDIVERT(2) # handle BITNET mapping -R$* < @ $+ .BITNET. > $* $: $1 < @ $(bitdomain $2 $: $2.BITNET. $) > $3 +R$* < @ $+ .BITNET > $* $: $1 < @ $(bitdomain $2 $: $2.BITNET $) > $3 POPDIVERT diff --git a/usr.sbin/sendmail/cf/feature/uucpdomain.m4 b/usr.sbin/sendmail/cf/feature/uucpdomain.m4 index 931a3150444..77cc97bbe4a 100644 --- a/usr.sbin/sendmail/cf/feature/uucpdomain.m4 +++ b/usr.sbin/sendmail/cf/feature/uucpdomain.m4 @@ -34,7 +34,7 @@ divert(-1) # divert(0) -VERSIONID(`@(#)uucpdomain.m4 8.4 (Berkeley) 11/30/93') +VERSIONID(`@(#)uucpdomain.m4 8.6 (Berkeley) 2/19/94') divert(-1) @@ -43,7 +43,7 @@ Kuudomain ifelse(_ARG_, `', `hash -o /etc/uudomain', `_ARG_') POPDIVERT -PUSHDIVERT(8) +PUSHDIVERT(2) # handle UUCP mapping -R$* < @ $+ .UUCP. > $* $: $1 < @ $(uudomain $2 $: $2.UUCP. $) > $3 +R$* < @ $+ .UUCP > $* $: $1 < @ $(uudomain $2 $: $2.UUCP $) > $3 POPDIVERT diff --git a/usr.sbin/sendmail/cf/m4/proto.m4 b/usr.sbin/sendmail/cf/m4/proto.m4 index 410e32b7031..284572988f9 100644 --- a/usr.sbin/sendmail/cf/m4/proto.m4 +++ b/usr.sbin/sendmail/cf/m4/proto.m4 @@ -34,7 +34,7 @@ divert(-1) # divert(0) -VERSIONID(`@(#)proto.m4 8.30 (Berkeley) 1/12/94') +VERSIONID(`@(#)proto.m4 8.45 (Berkeley) 3/4/94') MAILER(local)dnl @@ -118,12 +118,12 @@ DR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY) # who gets all local email traffic ($R has precedence for unqualified names) DH`'ifdef(`MAIL_HUB', MAIL_HUB) -# who I masquerade as (can be $j) -DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j) +# who I masquerade as (null for no masquerading) +DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME) # class L: names that should be delivered locally, even if we have a relay # class E: names that should be exposed as from this host, even if we masquerade -CLroot +#CLroot CEroot undivert(5)dnl @@ -171,7 +171,7 @@ O7`'confSEVEN_BIT_INPUT Oa`'confALIAS_WAIT # location of alias file -OA`'ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases) +OA`'ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases) # minimum number of free blocks on filesystem Ob`'confMIN_FREE_BLOCKS @@ -360,7 +360,7 @@ Tuucp ######################### H?P?Return-Path: $g -HReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b +HReceived: $?sfrom $s $.$?_($?s$|from $.$_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b H?D?Resent-Date: $a H?D?Date: $a H?F?Resent-From: $q @@ -443,9 +443,9 @@ R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain ifdef(`_NO_UUCP_', `dnl', `R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain') -R$* < @ [ $+ ] > $* $: $1 < @ [[ $2 ]] > $3 catch [a.b.c.d] -R$* < @ [ $=w ] > $* $: $1 < @ $j . > $3 self-literal -R$* < @ [[ $+ ]] > $* $: $1 < @ [ $2 ] > $3 strip dbl [[]] +R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d] +R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal +R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr ifdef(`DOMAIN_TABLE', ` # look up unqualified domains in the domain table R$* < @ $- > $* $: $1 < @ $(domaintable $2 $) > $3', @@ -483,8 +483,6 @@ R$* < @ $=w > $* $: $1 < @ $2 . > $3 R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4 R$* < @ $* . . > $* $1 < @ $2 . > $3 -undivert(8)dnl - # if this is the local hostname, make sure we treat is as canonical R$* < @ $j > $* $: $1 < @ $j . > $2 @@ -496,9 +494,6 @@ S4 R$*<@> $@ $1 handle <> and list:; -# resolve numeric addresses to name if possible -R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 lookup numeric internet addr - # strip trailing dot off possibly canonical name R$* < @ $+ . > $* $1 < @ $2 > $3 @@ -533,13 +528,12 @@ R$* $@ $>0 $1 S0 R<@> $#_LOCAL_ $: <> special case error msgs -R$*:;<@> $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" +R$* : $* ; $#error $@ USAGE $: "list:; syntax illegal for recipient addresses" R<@ $+> $#error $@ USAGE $: "user address required" +R<$* : $* > $#error $@ USAGE $: "colon illegal in host name part" ifdef(`_MAILER_smtp_', `# handle numeric address spec -ifdef(`_NO_CANONIFY_', `dnl', -`R$* < @ [ $+ ] > $* $: $1 < @ $[ [$2] $] > $3 numeric internet addr') R$* < @ [ $+ ] > $* $: $>_SET_98_ $1 < @ [ $2 ] > $3 numeric internet spec R$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 still numeric: send', `dnl') @@ -551,15 +545,6 @@ R$* $=O $* < @ $=w . > $@ $>_SET_97_ $1 $2 $3 ...@here -> ... # handle local hacks R$* $: $>_SET_98_ $1 -ifdef(`MAILER_TABLE', -` -# try mailer table lookup -R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name -R< $+ . > $* $: < $1 > $2 strip trailing dot -R< $+ > $* $: < $(mailertable $1 $) > $2 lookup -R< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? -R< $+ > $* $: $>90 <$1> $2 try domain', -`dnl') # short circuit local delivery so forwarded email works ifdef(`_LOCAL_NOT_STICKY_', @@ -572,6 +557,15 @@ R$+ < $+ @ $+ > $#relay $@ $3 $: $1 < $2 > yep .... R$+ < $+ @ > $#_LOCAL_ $: $1 nope, local address', `R$+ < $+ @ $+ > $#_LOCAL_ $: $1 yep .... R$+ < $+ @ > $#_LOCAL_ $: @ $1 nope, local address')') +ifdef(`MAILER_TABLE', +` +# not local -- try mailer table lookup +R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name +R< $+ . > $* $: < $1 > $2 strip trailing dot +R< $+ > $* $: < $(mailertable $1 $) > $2 lookup +R< $- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? +R< $+ > $* $: $>90 <$1> $2 try domain', +`dnl') undivert(4)dnl ifdef(`_NO_UUCP_', `dnl', @@ -608,7 +602,7 @@ R$* < @ $+ .UUCP. > $* $#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP', `dnl')') ifdef(`_MAILER_usenet_', ` # addresses sent to net.group.USENET will get forwarded to a newsgroup -R$+ . USENET. $#usenet $: $1', +R$+ . USENET $#usenet $: $1', `dnl') ifdef(`_LOCAL_RULES_', @@ -646,8 +640,11 @@ R$+ $#_LOCAL_ $: $1 regular local names S5 # see if we have a relay or a hub -R$+ $: $>_SET_95_ < $R > $1 try relay -R$+ $: $>_SET_95_ < $H > $1 try hub') +R$+ $: < $R > $1 try relay +R< > $+ $: < $H > $1 try hub +R< > $+ $@ $1 nope, give up +R< $- : $+ > $+ $: $>_SET_95_ < $1 : $2 > $3 < @ $2 > +R< $+ > $+ $@ $>_SET_95_ < $1 > $2 < @ $1 >') ifdef(`MAILER_TABLE', ` @@ -657,10 +654,12 @@ ifdef(`MAILER_TABLE', ################################################################### S90 -R<$- . $+ > $* $: < $(mailertable .$2 $@ $1 $) > $3 lookup -R<$- : $+ > $* $# $1 $@ $2 $: $3 check -- resolved? -R< . $+ > $* $@ $>90 <$1> $2 no -- strip & try again -R<$*> $* $@ $2 no match', +R$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4 +R$* <$- : $+ > $* $# $2 $@ $3 $: $4 check -- resolved? +R$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again +R$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "." +R<$- : $+ > $* $# $1 $@ $2 $: $3 "." found? +R< $* > $* $@ $2 no mailertable match', `dnl') ################################################################### diff --git a/usr.sbin/sendmail/cf/m4/version.m4 b/usr.sbin/sendmail/cf/m4/version.m4 index d92f73f9dfd..d71e816810f 100644 --- a/usr.sbin/sendmail/cf/m4/version.m4 +++ b/usr.sbin/sendmail/cf/m4/version.m4 @@ -32,8 +32,8 @@ divert(-1) # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -VERSIONID(`@(#)version.m4 8.6.1.5 (Berkeley) 1/13/94') +VERSIONID(`@(#)version.m4 8.6.6.1 (Berkeley) 3/13/94') # divert(0) # Configuration version number -DZ8.6.5 +DZ8.6.6 diff --git a/usr.sbin/sendmail/cf/mailer/smtp.m4 b/usr.sbin/sendmail/cf/mailer/smtp.m4 index 9b28f63e298..45efbd68a81 100644 --- a/usr.sbin/sendmail/cf/mailer/smtp.m4 +++ b/usr.sbin/sendmail/cf/mailer/smtp.m4 @@ -40,12 +40,12 @@ POPDIVERT ### SMTP Mailer specification ### ##################################### -VERSIONID(`@(#)smtp.m4 8.13 (Berkeley) 12/27/93') +VERSIONID(`@(#)smtp.m4 8.15 (Berkeley) 2/14/94') Msmtp, P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n, - ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h + ifdef(`_OLD_SENDMAIL_',, `L=990, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')A=IPC $h Mesmtp, P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n, - ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h + ifdef(`_OLD_SENDMAIL_',, `L=990, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')A=IPC $h Mrelay, P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=61, E=\r\n, ifdef(`_OLD_SENDMAIL_',, `L=2040, ')A=IPC $h @@ -82,8 +82,9 @@ R$* :; <@> $@ $1 :; list:; special case R$* <@> $* $@ $1 <@> $2 pass null host through R< @ $* > $* $@ < @ $1 > $2 pass route-addr through R$=E < @ $=w . > $@ $1 < @ $2 > exposed user as is -R$* < @ $=w . > $: $1 < @ $M > masquerade as domain -R$* < @ > $: $1 < @ $j > in case $M undefined +R$* < @ $=w . > $: $1 < @ $2 @ $M > masquerade as domain +R$* < @ $+ @ > $@ $1 < @ $2 > in case $M undefined +R$* < @ $+ @ $+ > $@ $1 < @ $3 > $M is defined -- use it R$* $@ $>61 $1 qualify unqual'ed names diff --git a/usr.sbin/sendmail/cf/mailer/uucp.m4 b/usr.sbin/sendmail/cf/mailer/uucp.m4 index c4b5e8e0f9e..517839f1613 100644 --- a/usr.sbin/sendmail/cf/mailer/uucp.m4 +++ b/usr.sbin/sendmail/cf/mailer/uucp.m4 @@ -34,7 +34,7 @@ PUSHDIVERT(-1) # ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)') -ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$f -gC $h!rmail ($u)')') +ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$f -gC $h!rmail ($u)')') ifdef(`UUCP_MAILER_FLAGS',, `define(`UUCP_MAILER_FLAGS', `')') ifdef(`UUCP_MAX_SIZE',, `define(`UUCP_MAX_SIZE', 100000)') POPDIVERT @@ -42,7 +42,7 @@ POPDIVERT ### UUCP Mailer specification ### ##################################### -VERSIONID(`@(#)uucp.m4 8.13 (Berkeley) 1/10/94') +VERSIONID(`@(#)uucp.m4 8.15 (Berkeley) 2/16/94') # # There are innumerable variations on the UUCP mailer. It really @@ -151,7 +151,7 @@ R! $+ $: $j ! $1 in case $M undefined') PUSHDIVERT(4) # resolve locally connected UUCP links -R$* < @ $=Z . UUCP. > $* $#uucp-uudom $@ $1 $: $1 < @ $2 .UUCP. > $3 @host.UUCP: ... +R$* < @ $=Z . UUCP. > $* $#uucp-uudom $@ $2 $: $1 < @ $2 .UUCP. > $3 R$* < @ $=Y . UUCP. > $* $#uucp-new $@ $2 $: $1 < @ $2 .UUCP. > $3 R$* < @ $=U . UUCP. > $* $#uucp-old $@ $2 $: $1 < @ $2 .UUCP. > $3 POPDIVERT diff --git a/usr.sbin/sendmail/cf/ostype/irix.m4 b/usr.sbin/sendmail/cf/ostype/irix.m4 index 752c04d7aa8..6cd7fc9a959 100644 --- a/usr.sbin/sendmail/cf/ostype/irix.m4 +++ b/usr.sbin/sendmail/cf/ostype/irix.m4 @@ -34,8 +34,8 @@ divert(-1) # divert(0) -VERSIONID(`@(#)irix.m4 8.3 (Berkeley) 11/27/93') -define(`LOCAL_MAILER_FLAGS', Ehmu)dnl +VERSIONID(`@(#)irix.m4 8.4 (Berkeley) 2/1/94') +define(`LOCAL_MAILER_FLAGS', Ehm)dnl define(`QUEUE_DIR', /usr/spool/mqueue)dnl define(`ALIAS_FILE', /usr/lib/aliases)dnl define(`STATUS_FILE', /usr/lib/sendmail.st)dnl diff --git a/usr.sbin/sendmail/cf/sh/makeinfo.sh b/usr.sbin/sendmail/cf/sh/makeinfo.sh index 216cf615a37..dd5044afe97 100644 --- a/usr.sbin/sendmail/cf/sh/makeinfo.sh +++ b/usr.sbin/sendmail/cf/sh/makeinfo.sh @@ -32,7 +32,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# @(#)makeinfo.sh 8.3 (Berkeley) 7/23/93 +# @(#)makeinfo.sh 8.4 (Berkeley) 3/4/94 # usewhoami=0 @@ -73,5 +73,5 @@ then else host=`uname -n` fi -echo '#####' built by $user on `date` -echo '#####' in `pwd` on $host +echo '#####' built by $user@$host on `date` +echo '#####' in `pwd` | sed 's/\/tmp_mnt//' diff --git a/usr.sbin/sendmail/contrib/expn.pl b/usr.sbin/sendmail/contrib/expn.pl index 288939bbbeb..28ad88bddca 100644 --- a/usr.sbin/sendmail/contrib/expn.pl +++ b/usr.sbin/sendmail/contrib/expn.pl @@ -14,7 +14,7 @@ $sockaddr = 'S n a4 x8'; # system requirements: # must have 'nslookup' and 'hostname' programs. -# $Header: /cvsroot/src/usr.sbin/sendmail/contrib/Attic/expn.pl,v 1.1.1.2 1994/03/15 05:10:52 glass Exp $ +# $Header: /cvsroot/src/usr.sbin/sendmail/contrib/Attic/expn.pl,v 1.2 1994/03/16 02:12:38 glass Exp $ # TODO: # less magic should apply to command-line addresses diff --git a/usr.sbin/sendmail/contrib/mmuegel b/usr.sbin/sendmail/contrib/mmuegel index f440f47dc3f..6db4a45189c 100644 --- a/usr.sbin/sendmail/contrib/mmuegel +++ b/usr.sbin/sendmail/contrib/mmuegel @@ -1,3 +1,21 @@ +From: "Michael S. Muegel" <mmuegel@cssun6.corp.mot.com> +Message-Id: <199307280818.AA08111@cssun6.corp.mot.com> +Subject: Re: contributed software +To: eric@cs.berkeley.edu (Eric Allman) +Date: Wed, 28 Jul 1993 03:18:02 -0500 (CDT) +In-Reply-To: <199307221853.LAA04266@mastodon.CS.Berkeley.EDU> from "Eric Allman" at Jul 22, 93 11:53:47 am +X-Mailer: ELM [version 2.4 PL22] +Mime-Version: 1.0 +Content-Type: text/plain; charset=US-ASCII +Content-Transfer-Encoding: 7bit +Content-Length: 69132 + +OK. Here is a new shell archive. + +Cheers, +-Mike + +---- Cut Here and feed the following to sh ---- #!/bin/sh # This is a shell archive (produced by shar 3.49) # To extract the files from this archive, save it to a file, remove diff --git a/usr.sbin/sendmail/doc/op/op.me b/usr.sbin/sendmail/doc/op/op.me index 0ad2bb6c180..0e63aa3f6b6 100644 --- a/usr.sbin/sendmail/doc/op/op.me +++ b/usr.sbin/sendmail/doc/op/op.me @@ -30,7 +30,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)op.me 8.32 (Berkeley) 1/12/94 +.\" @(#)op.me 8.34 (Berkeley) 3/3/94 .\" .\" eqn op.me | pic | troff -me .eh 'SMM:08-%''Sendmail Installation and Operation Guide' @@ -69,7 +69,7 @@ University of California, Berkeley Mammoth Project eric@CS.Berkeley.EDU .sp -Version 8.32 +Version 8.34 .sp For Sendmail Version 8.6 .)l @@ -2471,10 +2471,22 @@ is later rewritten by the mailer-specific envelope rewriting set and assigned to the .b $u macro. +As a special case, if the value to +.b $# +is +.q local +and the first character of the +.b $: +value is +.q @ , +the +.q @ +is stripped off, and a flag is set in the address descriptor +that causes sendmail to not do ruleset 5 processing. .pp -Normally, a ruleset that matches is retried, +Normally, a rule that matches is retried, that is, -the ruleset loops until it fails. +the rule loops until it fails. A RHS may also be preceded by a .b $@ or a @@ -3387,7 +3399,7 @@ Strip all output to seven bits. This is the default if the .b L flag is set. -Note that setting this is not +Note that clearing this option is not sufficient to get full eight bit data passed through .i sendmail . If the @@ -6875,7 +6887,7 @@ A transcript of the current session. .\"Eric Allman .\"Britton-Lee, Inc. .\".sp -.\"Version 8.32 +.\"Version 8.34 .\".ce 0 .bp 2 .rs diff --git a/usr.sbin/sendmail/praliases/praliases.c b/usr.sbin/sendmail/praliases/praliases.c index 8ba77a5ff5a..2c22279205e 100644 --- a/usr.sbin/sendmail/praliases/praliases.c +++ b/usr.sbin/sendmail/praliases/praliases.c @@ -39,7 +39,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)praliases.c 8.2 (Berkeley) 9/22/93"; +static char sccsid[] = "@(#)praliases.c 8.3 (Berkeley) 3/6/94"; #endif /* not lint */ #include <ndbm.h> @@ -85,15 +85,16 @@ main(argc, argv) if (db = dbopen(buf, O_RDONLY, 0444 , DB_HASH, NULL)) { if (!argc) { while(!db->seq(db, &newdbkey, &newdbcontent, R_NEXT)) - printf("%s:%s\n", newdbkey.data, - newdbcontent.data); + printf("%.*s:%.*s\n", + newdbkey.size, newdbkey.data, + newdbcontent.size, newdbcontent.data); } else for (; *argv; ++argv) { newdbkey.data = *argv; newdbkey.size = strlen(*argv) + 1; - if ( !db->get(db, &newdbkey, &newdbcontent, 0) ) - printf("%s:%s\n", newdbkey.data, - newdbcontent.data); + if (!db->get(db, &newdbkey, &newdbcontent, 0)) + printf("%s:%.*s\n", newdbkey.data, + newdbcontent.size, newdbcontent.data); else printf("%s: No such key\n", newdbkey.data); @@ -110,7 +111,9 @@ main(argc, argv) for (key = dbm_firstkey(dbp); key.dptr != NULL; key = dbm_nextkey(dbp)) { content = dbm_fetch(dbp, key); - (void)printf("%s:%s\n", key.dptr, content.dptr); + (void)printf("%.*s:%.*s\n", + key.dsize, key.dptr, + content.dsize, content.dptr); } else for (; *argv; ++argv) { key.dptr = *argv; @@ -119,7 +122,8 @@ main(argc, argv) if (!content.dptr) (void)printf("%s: No such key\n", key.dptr); else - (void)printf("%s:%s\n", key.dptr, content.dptr); + (void)printf("%s:%.*s\n", key.dptr, + content.dsize, content.dptr); } #ifdef NEWDB } diff --git a/usr.sbin/sendmail/src/Makefile b/usr.sbin/sendmail/src/Makefile index 3345fcead41..18795746010 100644 --- a/usr.sbin/sendmail/src/Makefile +++ b/usr.sbin/sendmail/src/Makefile @@ -1,8 +1,9 @@ # # NetBSD Makefile # -# $Id: Makefile,v 1.19 1994/02/02 07:22:49 glass Exp $ -# @(#)Makefile 8.2 (Berkeley) 8/15/93 +# @(#)Makefile.NetBSD 8.1 (Berkeley) 2/26/94 +# @Id: Makefile.NetBSD,v 1.3 1994/02/01 05:33:44 glass Exp $ +# PROG= sendmail @@ -16,19 +17,16 @@ PROG= sendmail # spiral snail, but it will work. DBMDEF= -DNEWDB -DNIS -#nasty warning about gcc 2.4.x caused bugs -CFLAGS=-I${.CURDIR} ${DBMDEF} -DNETISO -#CFLAGS+=-I${.CURDIR} ${DBMDEF} -DNETISO +CFLAGS+=-I${.CURDIR} ${DBMDEF} -DNETISO SRCS= alias.c arpadate.c clock.c collect.c conf.c convtime.c daemon.c \ deliver.c domain.c envelope.c err.c headers.c macro.c main.c map.c \ mci.c parseaddr.c queue.c readcf.c recipient.c savemail.c srvrsmtp.c \ stab.c stats.c sysexits.c trace.c udb.c usersmtp.c \ util.c version.c -MAN1= newaliases.0 +MAN1= mailq.0 newaliases.0 MAN5= aliases.0 MAN8= sendmail.0 -MLINKS= sendmail.8 mailq.8 LINKS= /usr/sbin/sendmail /usr/bin/newaliases \ /usr/sbin/sendmail /usr/bin/mailq BINDIR= /usr/sbin diff --git a/usr.sbin/sendmail/src/READ_ME b/usr.sbin/sendmail/src/READ_ME index a2e7ad793bf..50f75fba991 100644 --- a/usr.sbin/sendmail/src/READ_ME +++ b/usr.sbin/sendmail/src/READ_ME @@ -30,7 +30,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# @(#)READ_ME 8.47 (Berkeley) 1/12/94 +# @(#)READ_ME 8.58 (Berkeley) 3/13/94 # This directory contains the source files for sendmail. @@ -138,6 +138,12 @@ use the version from the Net2 distribution! However, if you are on BSD/386 or 386BSD-based systems, use the one that already exists on your system. You may need to define OLD_NEWDB to do this.] +[NOTE WELL: it is CRITICAL that you remove ndbm.o from libdb.a and +ndbm.h from the appropriate include directories if you want to get +ndbm support. These files OVERRIDE calls to ndbm routines -- in +particular, if you leave ndbm.h in, you can find yourself using +the new db package even if you don't define NEWDB.] + If NEWDB and NDBM are defined (but not NIS), then sendmail will read NDBM format alias files, but the next time a newaliases is run the format will be converted to NEWDB; that format will be used forever @@ -179,6 +185,7 @@ NeXT Define this if you are on a NeXT box. (This one may have to make -- see below. _AIX3 Define this if you are IBM AIX 3.x. RISCOS Define this if you are running RISC/os from MIPS. +IRIX Define this if you are running IRIX from SGI. _SCO_unix_ Define this if you are on SCO UNIX. _SCO_unix_4_2 Define this if you are on SCO Open Server 3.2v4. @@ -204,12 +211,6 @@ HASUNAME Set if you have the "uname" system call. Implied by SYSTEM5. HASUNSETENV Define this if your system library has the "unsetenv" subroutine. -HASSTATFS Define this if you have the statfs(2) system call. It's - not a disaster to get this wrong -- but you do lose the - queue free space code. -HASUSTAT Define this if you have the ustat(2) system call. It's - not a disaster to get this wrong -- but you do lose the - queue free space code. HASSETSID Define this if you have the setsid(2) system call. This is implied if your system appears to be POSIX compliant. HASINITGROUPS Define this if you have the initgroups(3) routine. @@ -270,19 +271,36 @@ ARBPTR_T The type of an arbitrary pointer -- defaults to "void *". If you are an very old compiler you may need to define this to be "char *". LA_TYPE The type of load average your kernel supports. These - can be LA_SUBR (4) if you have the getloadavg(3) routine, + can be one of: + LA_ZERO (1) -- it always returns the load average as + "zero" (and does so on all architectures). + LA_SUBR (4) if you have the getloadavg(3) routine, LA_MACH (5) to use MACH-style load averages (calls - processor_set_info()), LA_FLOAT (3) if you read kmem and - interpret the value as a floating point number, LA_INT (2) - to interpret as a long integer, or LA_SHORT (6) to - interpret as a short integer. These last three have - several other parameters that they try to divine: the - name of your kernel, the name of the variable in the - kernel to examine, the number of bits of precision in - a fixed point load average, and so forth. In desparation, - use LA_ZERO (1) -- it always returns the load average as - "zero" (and does so on all architectures). The actual - code is in conf.c -- it can be tweaked if you are brave. + processor_set_info()), + LA_PROCSTR (7) to read /proc/loadavg and interpret it + as a string representing a floating-point + number (Linux-style), + LA_FLOAT (3) if you read kmem and interpret the value + as a floating point number, + LA_INT (2) to interpret as a long integer, + LA_SHORT (6) to interpret as a short integer. + These last three have several other parameters that they + try to divine: the name of your kernel, the name of the + variable in the kernel to examine, the number of bits of + precision in a fixed point load average, and so forth. + In desperation, use LA_ZERO. The actual code is in + conf.c -- it can be tweaked if you are brave. +SFS_TYPE Encodes how your kernel can locate the amount of free + space on a disk partition. This can be set to SFS_NONE + (0) if you have no way of getting this information, + SFS_USTAT (1) if you have the ustat(2) system call, + SFS_4ARGS (2) if you have a four-argument statfs(2) + system call (and the include file is <sys/statfs.h>), + and SFS_VFS (3), SFS_MOUNT (4), or SFS_STATFS (5) if + you have the two-argument statfs(2) system call, with + includes in <sys/vfs.h>, <sys/mount.h>, or <sys/statfs.h> + respectively. The default if nothing is defined is + SFS_NONE. ERRLIST_PREDEFINED If set, assumes that some header file defines sys_errlist. This may be needed if you get type conflicts on this @@ -301,6 +319,12 @@ SYSLOG_BUFSIZE You can define this to be the size of the buffer that e-mail message will log many more messages, since it will log each piece of information as a separate line in syslog. +BROKEN_RES_SEARCH + On Ultrix (and maybe other systems?) if you use the + res_search routine with an unknown host name, it returns + -1 but sets h_errno to 0 instead of HOST_NOT_FOUND. If + you set this, sendmail considers 0 to be the same as + HOST_NOT_FOUND. +-----------------------+ @@ -371,7 +395,7 @@ help to link with "-l44bsd" to solve this problem. the header files you used -- some people have used the 4.9 headers and linked with BIND 4.8 or vice versa, and it doesn't work. Unfortunately, it doesn't fail in an obvious way -- things just -subtlely don't work. +subtly don't work. +-------------------------------------+ @@ -440,6 +464,10 @@ SunOS 4.x (Solaris 1.x) Solaris 2.x (SunOS 5.x) To compile for Solaris, be sure you use -DSOLARIS. + To the best of my knowledge, Solaris does not have the + gethostbyname problem described above. However, it does + have another one: + From a correspondent: For solaris 2.2, I have @@ -450,17 +478,41 @@ Solaris 2.x (SunOS 5.x) qualified host name. I think "files" has to be before "dns" in /etc/nsswitch.conf during bootup. - To the best of my knowledge, Solaris does not have the - gethostbyname problem described above. + From another correspondent: + + When running sendmail under Solaris, the gethostbyname() + hack in conf.c which should perform proper canonicalization + of host names could fail. Result: the host name is not + canonicalized despite the hack, and you'll have to define $j + and $m in sendmail.cf somewhere. + + The reason could be that /etc/nsswitch.conf is improperly + configured (at least from sendmail's point of view). For + example, the line + + hosts: files nisplus dns + + will make gethostbyname() look in /etc/hosts first, then ask + nisplus, then dns. However, if /etc/hosts does not contain + the full canonicalized hostname, then no amount of + gethostbyname()s will work. + + Solution (or rather, a workaround): Ask nisplus first, then + dns, then local files: + + hosts: nisplus dns [NOTFOUND=return] files The Solaris "syslog" function is apparently limited to something about 90 characters because of a kernel limitation. If you have - source code, you can probably up this number. The syslogd patch - is included in kernel jumbo patch for Solaris 2.2 as of revision - -39 or so. At least one person is running with patch 100999-45 - and their long lost sendmail logging is finally showing up. At - least one other person is running with patch 101318 installed - under Solaris 2.3 with success. + source code, you can probably up this number. You can get patches + that fix this problem: the patch ids are: + + Solaris 2.1 100834 + Solaris 2.2 100999 + Solaris 2.3 101318 + + Be sure you have the appropriate patch installed or you won't + see system logging. OSF/1 If you are compiling on OSF/1 (DEC Alpha), you must use @@ -471,6 +523,17 @@ OSF/1 Also, the enclosed makefile removed /usr/sbin/smtpd; if you need it, just create the link to the sendmail binary. +IRIX + The header files on SGI IRIX are completely prototyped, and as + a result you can sometimes get some warning messages during + compilation. These can be ignored. There are two errors in + deliver only if you are using gcc, both of the form ``warning: + passing arg N of `execve' from incompatible pointer type''. + Also, if you compile with -DNIS, you will get a complaint + about a declaration of struct dom_binding in a prototype + when compiling map.c; this is not important because the + function being prototyped is not used in that file. + NeXT If you are compiling on NeXT, you will have to create an empty file "unistd.h" and create a file "dirent.h" containing: @@ -560,6 +623,50 @@ DG/UX DG/UX -- the person who has this working, Douglas Anderson <dlander@afterlife.ncsc.mil>, used procmail instead. +Apollo DomainOS + If you are compiling on Apollo, you will have to create an empty + file "unistd.h" and create a file "dirent.h" containing: + + #include <sys/dir.h> + #define dirent direct + + (The Makefile.DomainOS will attempt to do both of these for you.) + +HP-UX 8.00 + Date: Mon, 24 Jan 1994 13:25:45 +0200 + From: Kimmo Suominen <Kimmo.Suominen@lut.fi> + Subject: 8.6.5 w/ HP-UX 8.00 on s300 + + Just compiled and fought with sendmail 8.6.5 on a HP9000/360 (ie. a + series 300 machine) running HP-UX 8.00. + + I was getting segmentation fault when delivering to a local user. + With debugging I saw it was faulting when doing _free@libc... *sigh* + It seems the new implementation of malloc on s300 is buggy as of 8.0, + so I tried out the one in -lmalloc (malloc(3X)). With that it seems + to work just dandy. + + When linking, you will get the following error: + + ld: multiply defined symbol _freespace in file /usr/lib/libmalloc.a + + but you can just ignore it. You might want to add this info to the + README file for the future... + +Linux + Something broke between versions 0.99.13 and 0.99.14 of Linux: + the flock() system call gives errors. If you are running .14, + you must not use flock. You can do this with -DHASFLOCK=0. + +AIX + This version of sendmail does not support MB, MG, and MR resource + records, which are supported by AIX sendmail. + +RISC/os + RISC/os from MIPS is a merged AT&T/Berkeley system. When you + compile on that platform you will get duplicate definitions + on many files. You can ignore these. + System V Release 4 Based Systems There is a single Makefile that is intended for all SVR4-based systems (called Makefile.SVR4). It defines __svr4__, which is @@ -642,6 +749,18 @@ GNU getopt I'm told that GNU getopt has a problem in that it gets confused by the double call. Use the version in conf.c instead. +BIND 4.9.2 and Ultrix + If you are running on Ultrix, be sure you read the conf/Info.Ultrix + carefully -- there is information in there that you need to know + in order to avoid errors of the form: + + /lib/libc.a(gethostent.o): sethostent: multiply defined + /lib/libc.a(gethostent.o): endhostent: multiply defined + /lib/libc.a(gethostent.o): gethostbyname: multiply defined + /lib/libc.a(gethostent.o): gethostbyaddr: multiply defined + + during the link stage. + +--------------+ | MANUAL PAGES | @@ -742,4 +861,4 @@ version.c The version number and information about this Eric Allman -(Version 8.47, last update 1/12/94 05:59:56) +(Version 8.58, last update 3/13/94 09:38:06) diff --git a/usr.sbin/sendmail/src/alias.c b/usr.sbin/sendmail/src/alias.c index 66d81d77bf6..20a316200ca 100644 --- a/usr.sbin/sendmail/src/alias.c +++ b/usr.sbin/sendmail/src/alias.c @@ -36,7 +36,7 @@ # include <pwd.h> #ifndef lint -static char sccsid[] = "@(#)alias.c 8.21 (Berkeley) 12/11/93"; +static char sccsid[] = "@(#)alias.c 8.24 (Berkeley) 2/28/94"; #endif /* not lint */ @@ -114,7 +114,9 @@ alias(a, sendq, e) message("aliased to %s", p); #ifdef LOG if (LogLevel > 9) - syslog(LOG_INFO, "%s: alias %s => %s", e->e_id, a->q_paddr, p); + syslog(LOG_INFO, "%s: alias %s => %s", + e->e_id == NULL ? "NOQUEUE" : e->e_id, + a->q_paddr, p); #endif a->q_flags &= ~QSELFREF; AliasLevel++; @@ -417,7 +419,7 @@ rebuildaliases(map, automatic) /* try to lock the source file */ if ((af = fopen(map->map_file, "r+")) == NULL) { - if (errno != EACCES || automatic || + if ((errno != EACCES && errno != EROFS) || automatic || (af = fopen(map->map_file, "r")) == NULL) { int saveerr = errno; @@ -748,7 +750,8 @@ forward(user, sendq, e) #ifdef LOG if (LogLevel > 2) syslog(LOG_ERR, "%s: forward %s: transient error: %s", - e->e_id, buf, errstring(err)); + e->e_id == NULL ? "NOQUEUE" : e->e_id, + buf, errstring(err)); #endif message("%s: %s: message queued", buf, errstring(err)); user->q_flags |= QQUEUEUP; diff --git a/usr.sbin/sendmail/src/cdefs.h b/usr.sbin/sendmail/src/cdefs.h index afc1a68ef19..c104b9e964d 100644 --- a/usr.sbin/sendmail/src/cdefs.h +++ b/usr.sbin/sendmail/src/cdefs.h @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)cdefs.h 8.5 (Berkeley) 1/4/94 + * @(#)cdefs.h 8.7 (Berkeley) 1/21/94 */ #ifndef _CDEFS_H_ diff --git a/usr.sbin/sendmail/src/collect.c b/usr.sbin/sendmail/src/collect.c index e0eb672358b..b434d4900eb 100644 --- a/usr.sbin/sendmail/src/collect.c +++ b/usr.sbin/sendmail/src/collect.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)collect.c 8.8 (Berkeley) 1/8/94"; +static char sccsid[] = "@(#)collect.c 8.9 (Berkeley) 1/31/94"; #endif /* not lint */ # include <errno.h> @@ -317,8 +317,11 @@ readerr: "collect: %s on connection from %s, sender=%s: %m\n", problem, host, e->e_from.q_paddr); # endif - (feof(InChannel) ? usrerr : syserr) - ("451 collect: %s on connection from %s, from=%s", + if (feof(InChannel)) + usrerr("451 collect: %s on connection from %s, from=%s", + problem, host, e->e_from.q_paddr); + else + syserr("451 collect: %s on connection from %s, from=%s", problem, host, e->e_from.q_paddr); /* don't return an error indication */ diff --git a/usr.sbin/sendmail/src/conf.c b/usr.sbin/sendmail/src/conf.c index cc6605a66c1..1c859282e8f 100644 --- a/usr.sbin/sendmail/src/conf.c +++ b/usr.sbin/sendmail/src/conf.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)conf.c 8.62 (Berkeley) 1/9/94"; +static char sccsid[] = "@(#)conf.c 8.82 (Berkeley) 3/6/94"; #endif /* not lint */ # include "sendmail.h" @@ -628,6 +628,7 @@ init_md(argc, argv) #define LA_SUBR 4 /* call getloadavg */ #define LA_MACH 5 /* MACH load averages (as on NeXT boxes) */ #define LA_SHORT 6 /* read kmem for avenrun; interpret as short */ +#define LA_PROCSTR 7 /* read string ("1.17") from /proc/loadavg */ /* do guesses based on general OS type */ #ifndef LA_TYPE @@ -827,6 +828,52 @@ getla() #else +#if LA_TYPE == LA_PROCSTR + +/* +** Read /proc/loadavg for the load average. This is assumed to be +** in a format like "0.15 0.12 0.06". +** +** Initially intended for Linux. This has been in the kernel +** since at least 0.99.15. +*/ + +# ifndef _PATH_LOADAVG +# define _PATH_LOADAVG "/proc/loadavg" +# endif + +int +getla() +{ + double avenrun; + register int result; + FILE *fp; + + fp = fopen(_PATH_LOADAVG, "r"); + if (fp == NULL) + { + if (tTd(3, 1)) + printf("getla: fopen(%s): %s\n", + _PATH_LOADAVG, errstring(errno)); + return -1; + } + result = fscanf(fp, "%lf", &avenrun); + fclose(fp); + if (result != 1) + { + if (tTd(3, 1)) + printf("getla: fscanf() = %d: %s\n", + result, errstring(errno)); + return -1; + } + + if (tTd(3, 1)) + printf("getla(): %.2f\n", avenrun); + + return ((int) (avenrun + 0.5)); +} + +#else getla() { @@ -838,6 +885,54 @@ getla() #endif #endif #endif +#endif + + +/* + * Copyright 1989 Massachusetts Institute of Technology + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of M.I.T. not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. M.I.T. makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T. + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Authors: Many and varied... + */ + +/* Non Apollo stuff removed by Don Lewis 11/15/93 */ +#ifndef lint +static char rcsid[] = "@(#)$Id: conf.c,v 1.7 1994/03/16 02:13:13 glass Exp $"; +#endif /* !lint */ + +#ifdef apollo +# undef volatile +# include <apollo/base.h> + +/* ARGSUSED */ +int getloadavg( call_data ) + caddr_t call_data; /* pointer to (double) return value */ +{ + double *avenrun = (double *) call_data; + int i; + status_$t st; + long loadav[3]; + proc1_$get_loadav(loadav, &st); + *avenrun = loadav[0] / (double) (1 << 16); + return(0); +} +# endif /* apollo */ /* ** SHOULDQUEUE -- should this message be queued or sent? ** @@ -909,6 +1004,9 @@ refuseconnections() */ #ifdef SETPROCTITLE +# ifdef HASSETPROCTITLE + *** ERROR *** Cannot have both SETPROCTITLE and HASSETPROCTITLE defined +# endif # ifdef __hpux # include <sys/pstat.h> # endif @@ -932,6 +1030,8 @@ refuseconnections() # define PROCTITLEPAD ' ' #endif +#ifndef HASSETPROCTITLE + /*VARARGS1*/ #ifdef __STDC__ setproctitle(char *fmt, ...) @@ -986,6 +1086,8 @@ setproctitle(fmt, va_alist) # endif # endif /* SETPROCTITLE */ } + +#endif /* ** REAPCHILD -- pick up the body of my child, lest it become a zombie ** @@ -1407,6 +1509,8 @@ char *DefaultUserShells[] = #endif +#define WILDCARD_SHELL "/SENDMAIL/ANY/SHELL/" + bool usershellok(shell) char *shell; @@ -1417,7 +1521,7 @@ usershellok(shell) setusershell(); while ((p = getusershell()) != NULL) - if (strcmp(p, shell) == 0 || strcmp(p, "*") == 0) + if (strcmp(p, shell) == 0 || strcmp(p, WILDCARD_SHELL) == 0) break; endusershell(); return p != NULL; @@ -1452,7 +1556,7 @@ usershellok(shell) while (*p != '\0' && *p != '#' && !isspace(*p)) p++; *p = '\0'; - if (strcmp(shell, q) == 0 || strcmp("*", q) == 0) + if (strcmp(shell, q) == 0 || strcmp(WILDCARD_SHELL, q) == 0) { fclose(shellf); return TRUE; @@ -1480,24 +1584,29 @@ usershellok(shell) ** Puts the filesystem block size into bsize. */ -#ifdef HASSTATFS -# undef HASUSTAT +/* statfs types */ +#define SFS_NONE 0 /* no statfs implementation */ +#define SFS_USTAT 1 /* use ustat */ +#define SFS_4ARGS 2 /* use four-argument statfs call */ +#define SFS_VFS 3 /* use <sys/vfs.h> implementation */ +#define SFS_MOUNT 4 /* use <sys/mount.h> implementation */ +#define SFS_STATFS 5 /* use <sys/statfs.h> implementation */ + +#ifndef SFS_TYPE +# define SFS_TYPE SFS_NONE #endif -#if defined(HASUSTAT) +#if SFS_TYPE == SFS_USTAT # include <ustat.h> #endif - -#ifdef HASSTATFS -# if defined(IRIX) || defined(apollo) || defined(_SCO_unix_) || defined(UMAXV) || defined(DGUX) || defined(_AIX3) -# include <sys/statfs.h> -# else -# if (defined(sun) && !defined(BSD)) || defined(__hpux) || defined(_CONVEX_SOURCE) || defined(NeXT) || defined(_AUX_SOURCE) || defined(MACH386) -# include <sys/vfs.h> -# else -# include <sys/mount.h> -# endif -# endif +#if SFS_TYPE == SFS_4ARGS || SFS_TYPE == SFS_STATFS +# include <sys/statfs.h> +#endif +#if SFS_TYPE == SFS_VFS +# include <sys/vfs.h> +#endif +#if SFS_TYPE == SFS_MOUNT +# include <sys/mount.h> #endif long @@ -1505,8 +1614,8 @@ freespace(dir, bsize) char *dir; long *bsize; { -#if defined(HASSTATFS) || defined(HASUSTAT) -# if defined(HASUSTAT) +#if SFS_TYPE != SFS_NONE +# if SFS_TYPE == SFS_USTAT struct ustat fs; struct stat statbuf; # define FSBLOCKSIZE DEV_BSIZE @@ -1519,17 +1628,17 @@ freespace(dir, bsize) # else struct statfs fs; # define FSBLOCKSIZE fs.f_bsize -# if defined(_SCO_unix_) || defined(IRIX) +# if defined(_SCO_unix_) || defined(IRIX) || defined(apollo) # define f_bavail f_bfree # endif # endif # endif extern int errno; -# if defined(HASUSTAT) +# if SFS_TYPE == SFS_USTAT if (stat(dir, &statbuf) == 0 && ustat(statbuf.st_dev, &fs) == 0) # else -# if defined(IRIX) || defined(apollo) || defined(UMAXV) || defined(DGUX) +# if SFS_TYPE == SFS_4ARGS if (statfs(dir, &fs, sizeof fs, 0) == 0) # else # if defined(ultrix) @@ -1694,6 +1803,9 @@ transienterror(err) #ifdef EADDRNOTAVAIL case EADDRNOTAVAIL: /* Can't assign requested address */ #endif +#ifdef ETXTBSY + case ETXTBSY: /* (Apollo) file locked */ +#endif #if defined(ENOSR) && (!defined(ENOBUFS) || (ENOBUFS != ENOSR)) case ENOSR: /* Out of streams resources */ #endif @@ -1726,7 +1838,7 @@ lockfile(fd, filename, ext, type) char *ext; int type; { -# ifndef HASFLOCK +# if !HASFLOCK int action; struct flock lfd; @@ -1823,6 +1935,65 @@ lockfile(fd, filename, ext, type) return FALSE; } /* +** CHOWNSAFE -- tell if chown is "safe" (executable only by root) +** +** Parameters: +** fd -- the file descriptor to check. +** +** Returns: +** TRUE -- if only root can chown the file to an arbitrary +** user. +** FALSE -- if an arbitrary user can give away a file. +*/ + +bool +chownsafe(fd) + int fd; +{ +#ifdef __hpux + char *s; + int tfd; + uid_t o_uid, o_euid; + gid_t o_gid, o_egid; + bool rval; + struct stat stbuf; + + o_uid = getuid(); + o_euid = geteuid(); + o_gid = getgid(); + o_egid = getegid(); + fstat(fd, &stbuf); + setresuid(stbuf.st_uid, stbuf.st_uid, -1); + setresgid(stbuf.st_gid, stbuf.st_gid, -1); + s = tmpnam(NULL); + tfd = open(s, O_RDONLY|O_CREAT, 0600); + rval = fchown(tfd, DefUid, DefGid) != 0; + close(tfd); + unlink(s); + setreuid(o_uid, o_euid); + setresgid(o_gid, o_egid, -1); + return rval; +#else +# ifdef _POSIX_CHOWN_RESTRICTED +# if _POSIX_CHOWN_RESTRICTED == -1 + return FALSE; +# else + return TRUE; +# endif +# else +# ifdef _PC_CHOWN_RESTRICTED + return fpathconf(fd, _PC_CHOWN_RESTRICTED) > 0; +# else +# ifdef BSD + return TRUE; +# else + return FALSE; +# endif +# endif +# endif +#endif +} +/* ** GETCFNAME -- return the name of the .cf file. ** ** Some systems (e.g., NeXT) determine this dynamically. @@ -1877,46 +2048,104 @@ setvendor(vendor) ** STRTOL -- convert string to long integer ** ** For systems that don't have it in the C library. +** +** This is taken verbatim from the 4.4-Lite C library. */ #ifdef NEEDSTRTOL +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)strtol.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#include <limits.h> + +/* + * Convert a string to a long integer. + * + * Ignores `locale' stuff. Assumes that the upper and lower case + * alphabets and digits are each contiguous. + */ + long -strtol(p, ep, b) - char *p; - char **ep; - int b; +strtol(nptr, endptr, base) + const char *nptr; + char **endptr; + register int base; { - long l = 0; - char c; - char maxd; - int neg = 1; - - maxd = (b > 10) ? '9' : b + '0'; + register const char *s = nptr; + register unsigned long acc; + register int c; + register unsigned long cutoff; + register int neg = 0, any, cutlim; - if (p && *p == '-') { - neg = -1; - p++; + /* + * Skip white space and pick up leading +/- sign if any. + * If base is 0, allow 0x for hex and 0 for octal, else + * assume decimal; if base is already 16, allow 0x. + */ + do { + c = *s++; + } while (isspace(c)); + if (c == '-') { + neg = 1; + c = *s++; + } else if (c == '+') + c = *s++; + if ((base == 0 || base == 16) && + c == '0' && (*s == 'x' || *s == 'X')) { + c = s[1]; + s += 2; + base = 16; } - while (p && (c = *p)) { - if (c >= '0' && c <= maxd) { - l = l*b + *p++ - '0'; - continue; - } - if (c >= 'A' && c <= 'Z') - c -= 'A' + 'a'; - c = c - 'a' + 10; - if (b > c) { - l = l*b + c; - p++; - continue; + if (base == 0) + base = c == '0' ? 8 : 10; + + /* + * Compute the cutoff value between legal numbers and illegal + * numbers. That is the largest legal value, divided by the + * base. An input number that is greater than this value, if + * followed by a legal input character, is too big. One that + * is equal to this value may be valid or not; the limit + * between valid and invalid numbers is then based on the last + * digit. For instance, if the range for longs is + * [-2147483648..2147483647] and the input base is 10, + * cutoff will be set to 214748364 and cutlim to either + * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated + * a value > 214748364, or equal but the next digit is > 7 (or 8), + * the number is too big, and we will return a range error. + * + * Set any if any `digits' consumed; make it negative to indicate + * overflow. + */ + cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX; + cutlim = cutoff % (unsigned long)base; + cutoff /= (unsigned long)base; + for (acc = 0, any = 0;; c = *s++) { + if (isdigit(c)) + c -= '0'; + else if (isalpha(c)) + c -= isupper(c) ? 'A' - 10 : 'a' - 10; + else + break; + if (c >= base) + break; + if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim) + any = -1; + else { + any = 1; + acc *= base; + acc += c; } - break; } - l *= neg; - if (ep) - *ep = p; - return l; + if (any < 0) { + acc = neg ? LONG_MIN : LONG_MAX; + errno = ERANGE; + } else if (neg) + acc = -acc; + if (endptr != 0) + *endptr = (char *)(any ? s - 1 : nptr); + return (acc); } #endif @@ -1998,7 +2227,7 @@ ni_propval(directory, propname) char *directory; char *propname; { - char *propval; + char *propval = NULL; int i; void *ni = NULL; void *lastni = NULL; diff --git a/usr.sbin/sendmail/src/conf.h b/usr.sbin/sendmail/src/conf.h index a06738c0fb8..8341de5cb2d 100644 --- a/usr.sbin/sendmail/src/conf.h +++ b/usr.sbin/sendmail/src/conf.h @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)conf.h 8.75 (Berkeley) 1/8/94 + * @(#)conf.h 8.96 (Berkeley) 3/11/94 */ /* @@ -80,14 +80,22 @@ # define NETUNIX 1 /* include unix domain support */ # define NETINET 1 /* include internet support */ # define SETPROCTITLE 1 /* munge argv to display current status */ -# define NAMED_BIND 1 /* use Berkeley Internet Domain Server */ # define MATCHGECOS 1 /* match user names from gecos field */ # define XDEBUG 1 /* enable extended debugging */ - # ifdef NEWDB # define USERDB 1 /* look in user database (requires NEWDB) */ # endif +/********************************************************************** +** 0/1 Compilation options. +** #define these to 1 if they are available; +** #define them to 0 otherwise. +**********************************************************************/ + +# ifndef NAMED_BIND +# define NAMED_BIND 1 /* use Berkeley Internet Domain Server */ +# endif + /* ** Most systems have symbolic links today, so default them on. You ** can turn them off by #undef'ing this below. @@ -131,10 +139,10 @@ # undef m_flags # define SYSTEM5 1 /* include all the System V defines */ # define HASINITGROUPS 1 /* has initgroups(3) call */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASSETREUID 1 /* has setreuid(2) call */ -# define setreuid(r, e) setresuid(r, e, -1) +# define setreuid(r, e) setresuid(r, e, -1) # define LA_TYPE LA_FLOAT +# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */ # define GIDSET_T gid_t # define _PATH_UNIX "/hp-ux" # ifndef _PATH_SENDMAILCF @@ -159,11 +167,11 @@ extern int syslog(int, char *, ...); # ifdef _AIX3 # define HASINITGROUPS 1 /* has initgroups(3) call */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASUNAME 1 /* use System V uname(2) system call */ # define HASGETUSERSHELL 0 /* does not have getusershell(3) call */ # define FORK fork /* no vfork primitive available */ # undef SETPROCTITLE /* setproctitle confuses AIX */ +# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */ # endif @@ -177,12 +185,12 @@ extern int syslog(int, char *, ...); # include <sys/sysmacros.h> # define HASSETREUID 1 /* has setreuid(2) call */ # define HASINITGROUPS 1 /* has initgroups(3) call */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASGETUSERSHELL 0 /* does not have getusershell(3) call */ # define FORK fork /* no vfork primitive available */ # define WAITUNION 1 /* use "union wait" as wait argument type */ # define setpgid BSDsetpgrp # define GIDSET_T gid_t +# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */ # endif @@ -195,10 +203,10 @@ extern int syslog(int, char *, ...); #if defined(sun) && !defined(BSD) -# define LA_TYPE LA_INT # define HASINITGROUPS 1 /* has initgroups(3) call */ # define HASUNAME 1 /* use System V uname(2) system call */ # define HASGETUSERSHELL 1 /* DOES have getusershell(3) call in libc */ +# define LA_TYPE LA_INT # ifdef SOLARIS_2_3 # define SOLARIS @@ -222,12 +230,17 @@ extern int syslog(int, char *, ...); # ifndef _PATH_SENDMAILPID # define _PATH_SENDMAILPID "/etc/mail/sendmail.pid" # endif +# ifndef SYSLOG_BUFSIZE +# define SYSLOG_BUFSIZE 1024 /* allow full size syslog buffer */ +# endif # else /* SunOS 4.0.3 or 4.1.x */ # define HASSETREUID 1 /* has setreuid(2) call */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ -# define HASFLOCK 1 /* has flock(2) call */ +# ifndef HASFLOCK +# define HASFLOCK 1 /* has flock(2) call */ +# endif +# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */ # include <vfork.h> # ifdef SUNOS403 @@ -255,15 +268,16 @@ extern char *getenv(); #ifdef DGUX # define SYSTEM5 1 # define LA_TYPE LA_SUBR -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASSETREUID 1 /* has setreuid(2) call */ # define HASUNAME 1 /* use System V uname(2) system call */ # define HASSETSID 1 /* has Posix setsid(2) call */ # define HASINITGROUPS 1 /* has initgroups(3) call */ +# define HASGETUSERSHELL 0 /* does not have getusershell(3) */ # ifndef IDENTPROTO # define IDENTPROTO 0 /* TCP/IP implementation is broken */ # endif # undef SETPROCTITLE +# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */ /* these include files must be included early on DG/UX */ # include <netinet/in.h> @@ -283,18 +297,22 @@ extern long dgux_inet_addr(); */ #ifdef ultrix -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASSETREUID 1 /* has setreuid(2) call */ # define HASUNSETENV 1 /* has unsetenv(3) call */ # define HASINITGROUPS 1 /* has initgroups(3) call */ -# define HASFLOCK 1 /* has flock(2) call */ +# define HASUNAME 1 /* use System V uname(2) system call */ +# ifndef HASFLOCK +# define HASFLOCK 1 /* has flock(2) call */ +# endif # define HASGETUSERSHELL 0 /* does not have getusershell(3) call */ +# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_errno=0 */ # ifdef vax # define LA_TYPE LA_FLOAT # else # define LA_TYPE LA_INT # define LA_AVENRUN "avenrun" # endif +# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */ # ifndef IDENTPROTO # define IDENTPROTO 0 /* TCP/IP implementation is broken */ # endif @@ -306,12 +324,14 @@ extern long dgux_inet_addr(); */ #ifdef __osf__ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASUNSETENV 1 /* has unsetenv(3) call */ # define HASSETREUID 1 /* has setreuid(2) call */ # define HASINITGROUPS 1 /* has initgroups(3) call */ -# define HASFLOCK 1 /* has flock(2) call */ +# ifndef HASFLOCK +# define HASFLOCK 1 /* has flock(2) call */ +# endif # define LA_TYPE LA_INT +# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */ # ifndef _PATH_SENDMAILPID # define _PATH_SENDMAILPID "/var/run/sendmail.pid" # endif @@ -324,15 +344,17 @@ extern long dgux_inet_addr(); #ifdef NeXT # define HASINITGROUPS 1 /* has initgroups(3) call */ -# define HASFLOCK 1 /* has flock(2) call */ +# ifndef HASFLOCK +# define HASFLOCK 1 /* has flock(2) call */ +# endif # define NEEDGETOPT 1 /* need a replacement for getopt(3) */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define WAITUNION 1 /* use "union wait" as wait argument type */ # define sleep sleepX # define setpgid setpgrp # ifndef LA_TYPE # define LA_TYPE LA_MACH # endif +# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */ # ifndef _POSIX_SOURCE typedef int pid_t; # undef WEXITSTATUS @@ -355,7 +377,29 @@ typedef int pid_t; #ifdef BSD4_4 # define HASUNSETENV 1 /* has unsetenv(3) call */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ +# include <sys/cdefs.h> +# define ERRLIST_PREDEFINED /* don't declare sys_errlist */ +# ifndef LA_TYPE +# define LA_TYPE LA_SUBR +# endif +# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */ +#endif + + +/* +** BSD/386 (all versions) +** From Tony Sanders, BSDI +*/ + +#ifdef __bsdi__ +# define HASUNSETENV 1 /* has the unsetenv(3) call */ +# define HASSETSID 1 /* has the setsid(2) POSIX syscall */ +# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */ +# if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 +# define HASSETPROCTITLE 1 /* setproctitle is in libc */ +# else +# define SETPROCTITLE 1 +# endif # include <sys/cdefs.h> # define ERRLIST_PREDEFINED /* don't declare sys_errlist */ # ifndef LA_TYPE @@ -364,6 +408,7 @@ typedef int pid_t; #endif + /* ** 386BSD / FreeBSD 1.0E / NetBSD (all architectures, all versions) ** @@ -375,12 +420,12 @@ typedef int pid_t; #if defined(__386BSD__) || defined(__FreeBSD__) || defined(__NetBSD__) # define HASUNSETENV 1 /* has unsetenv(3) call */ # define HASSETSID 1 /* has the setsid(2) POSIX syscall */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # include <sys/cdefs.h> # define ERRLIST_PREDEFINED /* don't declare sys_errlist */ # ifndef LA_TYPE # define LA_TYPE LA_SUBR # endif +# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */ #endif @@ -394,14 +439,16 @@ typedef int pid_t; # define MACH386 1 # define HASUNSETENV 1 /* has unsetenv(3) call */ # define HASINITGROUPS 1 /* has initgroups(3) call */ -# define HASFLOCK 1 /* has flock(2) call */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ +# ifndef HASFLOCK +# define HASFLOCK 1 /* has flock(2) call */ +# endif # define NEEDGETOPT 1 /* need a replacement for getopt(3) */ # define NEEDSTRTOL 1 /* need the strtol() function */ # define setpgid setpgrp # ifndef LA_TYPE # define LA_TYPE LA_FLOAT # endif +# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */ # undef HASSETVBUF /* don't actually have setvbuf(3) */ # undef WEXITSTATUS # undef WIFEXITED @@ -417,11 +464,13 @@ typedef int pid_t; /* ** 4.3 BSD -- this is for very old systems ** +** Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1. +** ** You'll also have to install a new resolver library. ** I don't guarantee that support for this environment is complete. */ -#ifdef oldBSD43 +#if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) # define NEEDVPRINTF 1 /* need a replacement for vprintf(3) */ # define NEEDGETOPT 1 /* need a replacement for getopt(3) */ # define ARBPTR_T char * @@ -465,26 +514,40 @@ extern int errno; #ifdef _SCO_unix_ # define SYSTEM5 1 /* include all the System V defines */ # define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASGETUSERSHELL 0 /* does not have getusershell(3) call */ # define FORK fork # define MAXPATHLEN PATHSIZE # define LA_TYPE LA_SHORT +# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */ # undef NETUNIX /* no unix domain socket support */ #endif /* ** ConvexOS 11.0 and later +** +** "Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this +** works on 9.1 as well. */ #ifdef _CONVEX_SOURCE # define BSD 1 /* include all the BSD defines */ # define HASUNAME 1 /* use System V uname(2) system call */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASSETSID 1 /* has POSIX setsid(2) call */ # define NEEDGETOPT 1 /* need replacement for getopt(3) */ # define LA_TYPE LA_FLOAT +# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */ +# ifndef _PATH_SENDMAILCF +# define _PATH_SENDMAILCF "/usr/lib/sendmail.cf" +# endif +# ifndef S_IREAD +# define S_IREAD _S_IREAD +# define S_IWRITE _S_IWRITE +# define S_IEXEC _S_IEXEC +# define S_IFMT _S_IFMT +# define S_IFCHR _S_IFCHR +# define S_IFBLK _S_IFBLK +# endif # ifndef IDENTPROTO # define IDENTPROTO 0 /* TCP/IP implementation is broken */ # endif @@ -500,7 +563,9 @@ extern int errno; #ifdef RISCOS # define HASUNSETENV 1 /* has unsetenv(3) call */ -# define HASFLOCK 1 /* has flock(2) call */ +# ifndef HASFLOCK +# define HASFLOCK 1 /* has flock(2) call */ +# endif # define WAITUNION 1 /* use "union wait" as wait argument type */ # define NEEDGETOPT 1 /* need a replacement for getopt(3) */ # define LA_TYPE LA_INT @@ -522,19 +587,32 @@ extern void *malloc(); /* ** Linux 0.99pl10 and above... -** From Karl London <karl@borg.demon.co.uk>. +** +** Thanks to, in reverse order of contact: +** +** John Kennedy <warlock@csuchico.edu> +** Florian La Roche <rzsfl@rz.uni-sb.de> +** Karl London <karl@borg.demon.co.uk> +** +** Last compiled against: [03/02/94 @ 05:34 PM (Wednesday)] +** sendmail 8.6.6.b9 named 4.9.2-931205-p1 db-1.73 +** gcc 2.5.8 libc.so.4.5.19 +** slackware 1.1.2 linux 0.99.15 */ #ifdef __linux__ -# define BSD 1 /* pretend to be BSD based today */ -# undef NEEDVPRINTF 1 /* need a replacement for vprintf(3) */ +# define BSD 1 /* include BSD defines */ # define NEEDGETOPT 1 /* need a replacement for getopt(3) */ +# define HASUNAME 1 /* use System V uname(2) system call */ # define HASUNSETENV 1 /* has unsetenv(3) call */ +# define ERRLIST_PREDEFINED /* don't declare sys_errlist */ +# define GIDSET_T gid_t /* from <linux/types.h> */ # ifndef LA_TYPE -# define LA_TYPE LA_FLOAT +# define LA_TYPE LA_PROCSTR # endif +# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() impl */ # include <sys/sysmacros.h> -# define GIDSET_T gid_t +# undef atol /* wounded in <stdlib.h> */ #endif @@ -563,9 +641,7 @@ extern void *malloc(); #ifdef _AUX_SOURCE # include <sys/sysmacros.h> # define BSD /* has BSD routines */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASUNAME 1 /* use System V uname(2) system call */ -# define HASUSTAT 1 /* use System V ustat(2) syscall */ # define HASSETVBUF 1 /* we have setvbuf(3) in libc */ # define SIGFUNC_DEFINED /* sigfunc_t already defined */ # ifndef IDENTPROTO @@ -578,6 +654,7 @@ extern void *malloc(); # ifndef LA_TYPE # define LA_TYPE LA_ZERO # endif +# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */ # undef WIFEXITED # undef WEXITSTATUS #endif @@ -592,13 +669,13 @@ extern void *malloc(); #ifdef UMAXV # include <limits.h> # define HASUNAME 1 /* use System V uname(2) system call */ -# define HASSTATFS 1 /* has the statfs(2) syscall */ # define HASSETVBUF 1 /* we have setvbuf(3) in libc */ # define HASINITGROUPS 1 /* has initgroups(3) call */ # define HASGETUSERSHELL 0 /* does not have getusershell(3) call */ # define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */ # define SYS5SETPGRP 1 /* use System V setpgrp(2) syscall */ # define FORK fork /* no vfork(2) primitive available */ +# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */ # define MAXPATHLEN PATH_MAX extern struct passwd *getpwent(), *getpwnam(), *getpwuid(); extern struct group *getgrent(), *getgrnam(), *getgrgid(); @@ -632,6 +709,7 @@ typedef int pid_t; */ #ifdef sequent + # define BSD 1 # define HASUNSETENV 1 # define BSD4_3 1 /* to get signal() in conf.c */ @@ -651,6 +729,10 @@ typedef int pid_t; typedef int pid_t; # define isgraph(c) (isprint(c) && (c != ' ')) +# ifndef IDENTPROTO +# define IDENTPROTO 0 /* TCP/IP implementation is broken */ +# endif + # ifndef _PATH_UNIX # define _PATH_UNIX "/dynix" # endif @@ -661,6 +743,81 @@ typedef int pid_t; #endif +/* +** Sequent DYNIX/ptx v2.0 (and higher) +** +** For DYNIX/ptx v1.x, undefine HASSETREUID. +** +** From Tim Wright <timw@sequent.com>. +*/ + +#ifdef _SEQUENT_ +# define SYSTEM5 1 /* include all the System V defines */ +# define HASSETSID 1 /* has POSIX setsid(2) call */ +# define HASINITGROUPS 1 /* has initgroups(3) call */ +# define HASSETREUID 1 /* has setreuid(2) call */ +# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */ +# define GIDSET_T gid_t +# define LA_TYPE LA_INT +# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */ +# undef SETPROCTITLE +# ifndef IDENTPROTO +# define IDENTPROTO 0 /* TCP/IP implementation is broken */ +# endif +# ifndef _PATH_SENDMAILCF +# define _PATH_SENDMAILCF "/usr/lib/sendmail.cf" +# endif +# ifndef _PATH_SENDMAILPID +# define _PATH_SENDMAILPID "/etc/sendmail.pid" +# endif +#endif + + +/* +** Cray Unicos +** +** Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov> +*/ + +#ifdef UNICOS +# define SYSTEM5 1 /* include all the System V defines */ +# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */ +# define MAXPATHLEN PATHSIZE +# define LA_TYPE LA_ZERO +# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */ +#endif + + +/* +** Apollo DomainOS +** +** From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com> +** +** 15 Jan 1994 +** +*/ + +#ifdef apollo +# define HASSETREUID 1 /* has setreuid(2) call */ +# define HASINITGROUPS 1 /* has initgroups(2) call */ +# undef SETPROCTITLE +# define LA_TYPE LA_SUBR /* use getloadavg.c */ +# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */ +# ifndef _PATH_SENDMAILCF +# define _PATH_SENDMAILCF "/usr/lib/sendmail.cf" +# endif +# ifndef _PATH_SENDMAILPID +# define _PATH_SENDMAILPID "/etc/sendmail.pid" +# endif +# undef S_IFSOCK /* S_IFSOCK and S_IFIFO are the same */ +# undef S_IFIFO +# define S_IFIFO 0010000 +# ifndef IDENTPROTO +# define IDENTPROTO 0 /* TCP/IP implementation is broken */ +# endif +#endif + + /********************************************************************** @@ -676,7 +833,9 @@ typedef int pid_t; # define HASGETDTABLESIZE 1 /* has getdtablesize(2) call */ # define HASSETREUID 1 /* has setreuid(2) call */ # define HASINITGROUPS 1 /* has initgroups(2) call */ -# define HASFLOCK 1 /* has flock(2) call */ +# ifndef HASFLOCK +# define HASFLOCK 1 /* has flock(2) call */ +# endif #endif /* general System V Release 4 defines */ @@ -703,19 +862,21 @@ typedef int pid_t; #endif /* general System V defines */ -# ifdef SYSTEM5 +#ifdef SYSTEM5 # include <sys/sysmacros.h> # define HASUNAME 1 /* use System V uname(2) system call */ -# define HASUSTAT 1 /* use System V ustat(2) syscall */ # define SYS5SETPGRP 1 /* use System V setpgrp(2) syscall */ # define HASSETVBUF 1 /* we have setvbuf(3) in libc */ # ifndef LA_TYPE -# define LA_TYPE LA_INT +# define LA_TYPE LA_INT /* assume integer load average */ +# endif +# ifndef SFS_TYPE +# define SFS_TYPE SFS_USTAT /* use System V ustat(2) syscall */ # endif # define bcopy(s, d, l) (memmove((d), (s), (l))) # define bzero(d, l) (memset((d), '\0', (l))) # define bcmp(s, d, l) (memcmp((s), (d), (l))) -# endif +#endif /* general POSIX defines */ #ifdef _POSIX_VERSION @@ -742,6 +903,7 @@ typedef int pid_t; # undef HASINITGROUPS /* doesn't have initgroups(3) call */ #endif + /* ** Due to a "feature" in some operating systems such as Ultrix 4.3 and ** HPUX 8.0, if you receive a "No route to host" message (ICMP message @@ -761,6 +923,10 @@ typedef int pid_t; # define HASGETUSERSHELL 1 /* libc has getusershell(3) call */ #endif +#ifndef HASFLOCK +# define HASFLOCK 0 /* assume no flock(2) support */ +#endif + /********************************************************************** ** Remaining definitions should never have to be changed. They are @@ -935,3 +1101,11 @@ typedef void (*sigfunc_t) __P((int)); # ifndef FORK # define FORK vfork /* function to call to fork mailer */ # endif + +/* +** If we are going to link scanf anyway, use it in readcf +*/ + +#if !defined(HASUNAME) && !defined(SCANF) +# define SCANF 1 +#endif diff --git a/usr.sbin/sendmail/src/daemon.c b/usr.sbin/sendmail/src/daemon.c index 8e5f55540f9..f7876825161 100644 --- a/usr.sbin/sendmail/src/daemon.c +++ b/usr.sbin/sendmail/src/daemon.c @@ -37,19 +37,18 @@ #ifndef lint #ifdef DAEMON -static char sccsid[] = "@(#)daemon.c 8.30 (Berkeley) 1/8/94 (with daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.39 (Berkeley) 3/13/94 (with daemon mode)"; #else -static char sccsid[] = "@(#)daemon.c 8.30 (Berkeley) 1/8/94 (without daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.39 (Berkeley) 3/13/94 (without daemon mode)"; #endif #endif /* not lint */ #ifdef DAEMON # include <netdb.h> -# include <sys/time.h> # include <arpa/inet.h> -#ifdef NAMED_BIND +#if NAMED_BIND # include <arpa/nameser.h> # include <resolv.h> #endif @@ -302,10 +301,15 @@ getrequests() */ (void) setsignal(SIGCHLD, SIG_DFL); + DisConnected = FALSE; + + setproctitle("startup with %s", + anynet_ntoa(&RealHostAddr)); /* determine host name */ p = hostnamebyanyaddr(&RealHostAddr); RealHostName = newstr(p); + setproctitle("startup with %s", p); #ifdef LOG if (LogLevel > 11) @@ -545,7 +549,7 @@ makeconnection(host, port, mci, usesecureport) SOCKADDR addr; int sav_errno; int addrlen; -#ifdef NAMED_BIND +#if NAMED_BIND extern int h_errno; #endif @@ -554,7 +558,7 @@ makeconnection(host, port, mci, usesecureport) ** Accept "[a.b.c.d]" syntax for host name. */ -#ifdef NAMED_BIND +#if NAMED_BIND h_errno = 0; #endif errno = 0; @@ -577,6 +581,12 @@ makeconnection(host, port, mci, usesecureport) { /* try it as a host name (avoid MX lookup) */ hp = gethostbyname(&host[1]); + if (hp == NULL && p[-1] == '.') + { + p[-1] = '\0'; + hp = gethostbyname(&host[1]); + p[-1] = '.'; + } *p = ']'; goto gothostent; } @@ -594,11 +604,19 @@ makeconnection(host, port, mci, usesecureport) } else { + register char *p = &host[strlen(host) - 1]; + hp = gethostbyname(host); + if (hp == NULL && *p == '.') + { + *p = '\0'; + hp = gethostbyname(host); + *p = '.'; + } gothostent: if (hp == NULL) { -#ifdef NAMED_BIND +#if NAMED_BIND if (errno == ETIMEDOUT || h_errno == TRY_AGAIN) return (EX_TEMPFAIL); @@ -844,9 +862,6 @@ myhostname(hostbuf, size) ** ** Returns: ** The user@host information associated with this descriptor. -** -** Side Effects: -** Sets RealHostName to the name of the host at the other end. */ #if IDENTPROTO @@ -884,18 +899,16 @@ getauthinfo(fd) if (getpeername(fd, &fa.sa, &falen) < 0 || falen <= 0 || fa.sa.sa_family == 0) { - RealHostName = "localhost"; (void) sprintf(hbuf, "%s@localhost", RealUserName); if (tTd(9, 1)) printf("getauthinfo: %s\n", hbuf); return hbuf; } - p = hostnamebyanyaddr(&fa); - RealHostName = newstr(p); - RealHostAddr = fa; - #if IDENTPROTO + if (TimeOuts.to_ident == 0) + goto noident; + lalen = sizeof la; if (fa.sa.sa_family != AF_INET || getsockname(fd, &la.sa, &lalen) < 0 || lalen <= 0 || @@ -940,10 +953,7 @@ getauthinfo(fd) if (bind(s, &la.sa, sizeof la.sin) < 0 || connect(s, &fa.sa, sizeof fa.sin) < 0) { -closeident: - (void) close(s); - clrevent(ev); - goto noident; + goto closeident; } if (tTd(9, 10)) @@ -1002,16 +1012,27 @@ closeident: continue; /* p now points to the authenticated name */ - (void) sprintf(hbuf, "%s@%s", p, RealHostName); + (void) sprintf(hbuf, "%s@%s", + p, RealHostName == NULL ? "localhost" : RealHostName); goto finish; +closeident: + (void) close(s); + clrevent(ev); + #endif /* IDENTPROTO */ noident: + if (RealHostName == NULL) + { + if (tTd(9, 1)) + printf("getauthinfo: NULL\n"); + return NULL; + } (void) strcpy(hbuf, RealHostName); finish: - if (RealHostName[0] != '[') + if (RealHostName != NULL && RealHostName[0] != '[') { p = &hbuf[strlen(hbuf)]; (void) sprintf(p, " [%s]", anynet_ntoa(&RealHostAddr)); @@ -1055,7 +1076,9 @@ host_map_lookup(map, name, av, statp) register STAB *s; char hbuf[MAXNAME]; extern struct hostent *gethostbyaddr(); +#if NAMED_BIND extern int h_errno; +#endif /* ** See if we have already looked up this name. If so, just @@ -1069,7 +1092,9 @@ host_map_lookup(map, name, av, statp) printf("host_map_lookup(%s) => CACHE %s\n", name, s->s_namecanon.nc_cname); errno = s->s_namecanon.nc_errno; +#if NAMED_BIND h_errno = s->s_namecanon.nc_herrno; +#endif *statp = s->s_namecanon.nc_stat; if (CurEnv->e_message == NULL && *statp == EX_TEMPFAIL) { @@ -1107,10 +1132,11 @@ host_map_lookup(map, name, av, statp) { register struct hostent *hp; - if (tTd(9, 1)) - printf("FAIL (%d)\n", h_errno); s->s_namecanon.nc_errno = errno; +#if NAMED_BIND s->s_namecanon.nc_herrno = h_errno; + if (tTd(9, 1)) + printf("FAIL (%d)\n", h_errno); switch (h_errno) { case TRY_AGAIN: @@ -1137,6 +1163,11 @@ host_map_lookup(map, name, av, statp) *statp = EX_UNAVAILABLE; break; } +#else + if (tTd(9, 1)) + printf("FAIL\n"); + *statp = EX_NOHOST; +#endif s->s_namecanon.nc_stat = *statp; if (*statp != EX_TEMPFAIL || UseNameServer) return NULL; @@ -1167,7 +1198,9 @@ host_map_lookup(map, name, av, statp) /* nope -- ask the name server */ hp = gethostbyaddr((char *)&in_addr, sizeof(struct in_addr), AF_INET); s->s_namecanon.nc_errno = errno; +#if NAMED_BIND s->s_namecanon.nc_herrno = h_errno; +#endif s->s_namecanon.nc_flags |= NCF_VALID; /* will be soon */ if (hp == NULL) { @@ -1261,7 +1294,7 @@ hostnamebyanyaddr(sap) register struct hostent *hp; int saveretry; -#ifdef NAMED_BIND +#if NAMED_BIND /* shorten name server timeout to avoid higher level timeouts */ saveretry = _res.retry; _res.retry = 3; @@ -1298,7 +1331,7 @@ hostnamebyanyaddr(sap) break; } -#ifdef NAMED_BIND +#if NAMED_BIND _res.retry = saveretry; #endif /* NAMED_BIND */ diff --git a/usr.sbin/sendmail/src/deliver.c b/usr.sbin/sendmail/src/deliver.c index d627395bee9..692dffe932a 100644 --- a/usr.sbin/sendmail/src/deliver.c +++ b/usr.sbin/sendmail/src/deliver.c @@ -33,13 +33,13 @@ */ #ifndef lint -static char sccsid[] = "@(#)deliver.c 8.62 (Berkeley) 1/12/94"; +static char sccsid[] = "@(#)deliver.c 8.78 (Berkeley) 3/11/94"; #endif /* not lint */ #include "sendmail.h" #include <netdb.h> #include <errno.h> -#ifdef NAMED_BIND +#if NAMED_BIND #include <arpa/nameser.h> #include <resolv.h> @@ -124,9 +124,11 @@ sendall(e, mode) if (e->e_hopcount > MaxHopCount) { errno = 0; + e->e_flags |= EF_FATALERRS|EF_PM_NOTIFY|EF_CLRQUEUE; syserr("554 too many hops %d (%d max): from %s via %s, to %s", e->e_hopcount, MaxHopCount, e->e_from.q_paddr, - RealHostName, e->e_sendqueue->q_paddr); + RealHostName == NULL ? "localhost" : RealHostName, + e->e_sendqueue->q_paddr); return; } @@ -247,10 +249,16 @@ sendall(e, mode) for (q = e->e_sendqueue; q != NULL; q = q->q_next) if (q->q_owner == owner) + { q->q_flags |= QDONTSEND; + q->q_flags &= ~QQUEUEUP; + } for (q = ee->e_sendqueue; q != NULL; q = q->q_next) if (q->q_owner != owner) + { q->q_flags |= QDONTSEND; + q->q_flags &= ~QQUEUEUP; + } if (e->e_df != NULL && mode != SM_VERIFY) { @@ -263,13 +271,10 @@ sendall(e, mode) e->e_df, ee->e_df); } } - - if (mode != SM_VERIFY) - openxscript(ee); #ifdef LOG if (LogLevel > 4) - syslog(LOG_INFO, "%s: clone %s", - ee->e_id, e->e_id); + syslog(LOG_INFO, "%s: clone %s, owner=%s", + ee->e_id, e->e_id, owner); #endif } } @@ -309,15 +314,15 @@ sendall(e, mode) for (ee = splitenv; ee != NULL; ee = ee->e_sibling) { CurEnv = ee; + if (mode != SM_VERIFY) + openxscript(ee); sendenvelope(ee, mode); + dropenvelope(ee); } CurEnv = e; } sendenvelope(e, mode); - - for (; splitenv != NULL; splitenv = splitenv->e_sibling) - dropenvelope(splitenv); } sendenvelope(e, mode) @@ -360,7 +365,7 @@ sendenvelope(e, mode) if (e->e_xfp != NULL) (void) fflush(e->e_xfp); -# ifndef HASFLOCK +# if !HASFLOCK /* ** Since fcntl locking has the interesting semantic that ** the lock is owned by a process, not by an open file @@ -401,16 +406,27 @@ sendenvelope(e, mode) (void) xfclose(e->e_dfp, "sendenvelope", e->e_df); e->e_dfp = NULL; e->e_id = e->e_df = NULL; + + /* catch intermediate zombie */ + (void) waitfor(pid); return; } /* double fork to avoid zombies */ - if (fork() > 0) + pid = fork(); + if (pid > 0) exit(EX_OK); /* be sure we are immune from the terminal */ disconnect(1, e); + /* prevent parent from waiting if there was an error */ + if (pid < 0) + { + e->e_flags |= EF_INQUEUE|EF_KEEPQUEUE; + finis(); + } + /* ** Close any cached connections. ** @@ -604,7 +620,7 @@ deliver(e, firstto) if (bitset(QDONTSEND|QBADADDR|QQUEUEUP, to->q_flags)) return (0); -#ifdef NAMED_BIND +#if NAMED_BIND /* unless interactive, try twice, over a minute */ if (OpMode == MD_DAEMON || OpMode == MD_SMTP) { @@ -620,8 +636,8 @@ deliver(e, firstto) SmtpError[0] = '\0'; if (tTd(10, 1)) - printf("\n--deliver, mailer=%d, host=`%s', first user=`%s'\n", - m->m_mno, host, to->q_user); + printf("\n--deliver, id=%s, mailer=%s, host=`%s', first user=`%s'\n", + e->e_id, m->m_name, host, to->q_user); if (tTd(10, 100)) printopenfds(FALSE); @@ -916,10 +932,11 @@ deliver(e, firstto) */ /*XXX this seems a bit wierd */ - if (ctladdr == NULL && bitset(QGOODUID, e->e_from.q_flags)) + if (ctladdr == NULL && m != ProgMailer && + bitset(QGOODUID, e->e_from.q_flags)) ctladdr = &e->e_from; -#ifdef NAMED_BIND +#if NAMED_BIND if (ConfigLevel < 2) _res.options &= ~(RES_DEFNAMES | RES_DNSRCH); /* XXX */ #endif @@ -1047,7 +1064,7 @@ tryhost: bitnset(M_SECURE_PORT, m->m_flags)); mci->mci_exitstat = i; mci->mci_errno = errno; -#ifdef NAMED_BIND +#if NAMED_BIND mci->mci_herrno = h_errno; #endif if (i == EX_OK) @@ -1223,7 +1240,8 @@ tryhost: } (void) close(rpvect[1]); } - else if (OpMode == MD_SMTP || OpMode == MD_DAEMON || HoldErrs) + else if (OpMode == MD_SMTP || OpMode == MD_DAEMON || + HoldErrs || DisConnected) { /* put mailer output in transcript */ if (dup2(fileno(e->e_xfp), STDOUT_FILENO) < 0) @@ -1260,12 +1278,20 @@ tryhost: (void) fcntl(i, F_SETFD, j | 1); } - /* set up the mailer environment */ + /* + ** Set up the mailer environment + ** TZ is timezone information. + ** SYSTYPE is Apollo software sys type (required). + ** ISP is Apollo hardware system type (required). + */ + i = 0; env[i++] = "AGENT=sendmail"; for (ep = environ; *ep != NULL; ep++) { - if (strncmp(*ep, "TZ=", 3) == 0) + if (strncmp(*ep, "TZ=", 3) == 0 || + strncmp(*ep, "ISP=", 4) == 0 || + strncmp(*ep, "SYSTYPE=", 8) == 0) env[i++] = *ep; } env[i++] = NULL; @@ -1344,7 +1370,7 @@ tryhost: /* couldn't open the mailer */ rcode = mci->mci_exitstat; errno = mci->mci_errno; -#ifdef NAMED_BIND +#if NAMED_BIND h_errno = mci->mci_herrno; #endif if (rcode == EX_OK) @@ -1366,10 +1392,10 @@ tryhost: ** Format and send message. */ - putfromline(mci->mci_out, m, e); - (*e->e_puthdr)(mci->mci_out, m, e); - putline("\n", mci->mci_out, m); - (*e->e_putbody)(mci->mci_out, m, e, NULL); + putfromline(mci, e); + (*e->e_puthdr)(mci, e); + putline("\n", mci); + (*e->e_putbody)(mci, e, NULL); /* get the exit status */ rcode = endmailer(mci, e, pv); @@ -1437,7 +1463,7 @@ tryhost: goto give_up; } #endif /* SMTP */ -#ifdef NAMED_BIND +#if NAMED_BIND if (ConfigLevel < 2) _res.options |= RES_DEFNAMES | RES_DNSRCH; /* XXX */ #endif @@ -1667,7 +1693,7 @@ giveresponse(stat, m, mci, ctladdr, e) else if (stat == EX_TEMPFAIL) { (void) strcpy(buf, SysExMsg[i] + 1); -#ifdef NAMED_BIND +#if NAMED_BIND if (h_errno == TRY_AGAIN) statmsg = errstring(h_errno+E_DNSBASE); else @@ -1691,7 +1717,7 @@ giveresponse(stat, m, mci, ctladdr, e) } statmsg = buf; } -#ifdef NAMED_BIND +#if NAMED_BIND else if (stat == EX_NOHOST && h_errno != 0) { statmsg = errstring(h_errno + E_DNSBASE); @@ -1717,7 +1743,7 @@ giveresponse(stat, m, mci, ctladdr, e) { extern char MsgBuf[]; - message(&statmsg[4], errstring(errno)); + message("%s", &statmsg[4]); if (stat == EX_TEMPFAIL && e->e_xfp != NULL) fprintf(e->e_xfp, "%s\n", &MsgBuf[4]); } @@ -1737,6 +1763,10 @@ giveresponse(stat, m, mci, ctladdr, e) if (LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6)) logdelivery(m, mci, &statmsg[4], ctladdr, e); + if (tTd(11, 2)) + printf("giveresponse: stat=%d, e->e_message=%s\n", + stat, e->e_message); + if (stat != EX_TEMPFAIL) setstat(stat); if (stat != EX_OK && (stat != EX_TEMPFAIL || e->e_message == NULL)) @@ -1746,7 +1776,7 @@ giveresponse(stat, m, mci, ctladdr, e) e->e_message = newstr(&statmsg[4]); } errno = 0; -#ifdef NAMED_BIND +#if NAMED_BIND h_errno = 0; #endif } @@ -1820,9 +1850,9 @@ logdelivery(m, mci, stat, ctladdr, e) (void) strcat(bp, mci->mci_host); # ifdef DAEMON - (void) strcat(bp, " ("); + (void) strcat(bp, " ["); (void) strcat(bp, anynet_ntoa(&CurHostAddr)); - (void) strcat(bp, ")"); + (void) strcat(bp, "]"); # endif } else @@ -1876,7 +1906,7 @@ logdelivery(m, mci, stat, ctladdr, e) # else /* we have a very short log buffer size */ - l = SYSLOG_BUFSIZE - 80; + l = SYSLOG_BUFSIZE - 85; p = e->e_to; while (strlen(p) >= l) { @@ -1914,19 +1944,21 @@ logdelivery(m, mci, stat, ctladdr, e) sprintf(bp, ", mailer=%s", m->m_name); bp += strlen(bp); } + syslog(LOG_INFO, "%s: %s", e->e_id, buf); + buf[0] = '\0'; if (mci != NULL && mci->mci_host != NULL) { # ifdef DAEMON extern SOCKADDR CurHostAddr; # endif - sprintf(bp, ", relay=%s", mci->mci_host); + sprintf(buf, "relay=%s", mci->mci_host); # ifdef DAEMON - (void) strcat(bp, " ("); - (void) strcat(bp, anynet_ntoa(&CurHostAddr)); - (void) strcat(bp, ")"); + (void) strcat(buf, " ["); + (void) strcat(buf, anynet_ntoa(&CurHostAddr)); + (void) strcat(buf, "]"); # endif } else @@ -1934,9 +1966,10 @@ logdelivery(m, mci, stat, ctladdr, e) char *p = macvalue('h', e); if (p != NULL && p[0] != '\0') - sprintf(bp, ", relay=%s", p); + sprintf(buf, "relay=%s", p); } - syslog(LOG_INFO, "%s: %s", e->e_id, buf); + if (buf[0] != '\0') + syslog(LOG_INFO, "%s: %s", e->e_id, buf); syslog(LOG_INFO, "%s: stat=%s", e->e_id, shortenstring(stat, 63)); # endif /* short log buffer */ @@ -1953,8 +1986,8 @@ logdelivery(m, mci, stat, ctladdr, e) ** this kind of antique garbage???? ** ** Parameters: -** fp -- the file to output to. -** m -- the mailer describing this entry. +** mci -- the connection information. +** e -- the envelope. ** ** Returns: ** none @@ -1963,19 +1996,18 @@ logdelivery(m, mci, stat, ctladdr, e) ** outputs some text to fp. */ -putfromline(fp, m, e) - register FILE *fp; - register MAILER *m; +putfromline(mci, e) + register MCI *mci; ENVELOPE *e; { char *template = "\201l\n"; char buf[MAXLINE]; - if (bitnset(M_NHDR, m->m_flags)) + if (bitnset(M_NHDR, mci->mci_mailer->m_flags)) return; # ifdef UGLYUUCP - if (bitnset(M_UGLYUUCP, m->m_flags)) + if (bitnset(M_UGLYUUCP, mci->mci_mailer->m_flags)) { char *bang; char xbuf[MAXLINE]; @@ -1996,14 +2028,13 @@ putfromline(fp, m, e) } # endif /* UGLYUUCP */ expand(template, buf, &buf[sizeof buf - 1], e); - putline(buf, fp, m); + putline(buf, mci); } /* ** PUTBODY -- put the body of a message. ** ** Parameters: -** fp -- file to output onto. -** m -- a mailer descriptor to control output format. +** mci -- the connection information. ** e -- the envelope to put out. ** separator -- if non-NULL, a message separator that must ** not be permitted in the resulting message. @@ -2015,9 +2046,8 @@ putfromline(fp, m, e) ** The message is written onto fp. */ -putbody(fp, m, e, separator) - FILE *fp; - MAILER *m; +putbody(mci, e, separator) + register MCI *mci; register ENVELOPE *e; char *separator; { @@ -2037,25 +2067,26 @@ putbody(fp, m, e, separator) e->e_df, e->e_to, e->e_from.q_paddr); } else - putline("<<< No Message Collected >>>", fp, m); + putline("<<< No Message Collected >>>", mci); } if (e->e_dfp != NULL) { rewind(e->e_dfp); - while (!ferror(fp) && fgets(buf, sizeof buf, e->e_dfp) != NULL) + while (!ferror(mci->mci_out) && fgets(buf, sizeof buf, e->e_dfp) != NULL) { - if (buf[0] == 'F' && bitnset(M_ESCFROM, m->m_flags) && + if (buf[0] == 'F' && + bitnset(M_ESCFROM, mci->mci_mailer->m_flags) && strncmp(buf, "From ", 5) == 0) - (void) putc('>', fp); + (void) putc('>', mci->mci_out); if (buf[0] == '-' && buf[1] == '-' && separator != NULL) { /* possible separator */ int sl = strlen(separator); if (strncmp(&buf[2], separator, sl) == 0) - (void) putc(' ', fp); + (void) putc(' ', mci->mci_out); } - putline(buf, fp, m); + putline(buf, mci); } if (ferror(e->e_dfp)) @@ -2066,11 +2097,12 @@ putbody(fp, m, e, separator) } /* some mailers want extra blank line at end of message */ - if (bitnset(M_BLANKEND, m->m_flags) && buf[0] != '\0' && buf[0] != '\n') - putline("", fp, m); + if (bitnset(M_BLANKEND, mci->mci_mailer->m_flags) && + buf[0] != '\0' && buf[0] != '\n') + putline("", mci); - (void) fflush(fp); - if (ferror(fp) && errno != EPIPE) + (void) fflush(mci->mci_out); + if (ferror(mci->mci_out) && errno != EPIPE) { syserr("putbody: write error"); ExitStat = EX_IOERR; @@ -2135,6 +2167,7 @@ mailfile(filename, ctladdr, e) { /* child -- actually write to file */ struct stat stb; + MCI mcibuf; (void) setsignal(SIGINT, SIG_DFL); (void) setsignal(SIGHUP, SIG_DFL); @@ -2197,11 +2230,17 @@ mailfile(filename, ctladdr, e) exit(EX_CANTCREAT); } - putfromline(f, FileMailer, e); - (*e->e_puthdr)(f, FileMailer, e); - putline("\n", f, FileMailer); - (*e->e_putbody)(f, FileMailer, e, NULL); - putline("\n", f, FileMailer); + bzero(&mcibuf, sizeof mcibuf); + mcibuf.mci_mailer = FileMailer; + mcibuf.mci_out = f; + if (bitnset(M_7BITS, FileMailer->m_flags)) + mcibuf.mci_flags |= MCIF_7BIT; + + putfromline(&mcibuf, e); + (*e->e_puthdr)(&mcibuf, e); + putline("\n", &mcibuf); + (*e->e_putbody)(&mcibuf, e, NULL); + putline("\n", &mcibuf); if (ferror(f)) { message("451 I/O error: %s", errstring(errno)); @@ -2260,7 +2299,7 @@ hostsignature(m, host, e) register STAB *s; int i; int len; -#ifdef NAMED_BIND +#if NAMED_BIND int nmx; auto int rcode; char *hp; @@ -2292,7 +2331,7 @@ hostsignature(m, host, e) ** Not already there -- create a signature. */ -#ifdef NAMED_BIND +#if NAMED_BIND if (ConfigLevel < 2) { oldoptions = _res.options; @@ -2315,7 +2354,7 @@ hostsignature(m, host, e) mci = mci_get(hp, m); mci->mci_exitstat = rcode; mci->mci_errno = errno; -#ifdef NAMED_BIND +#if NAMED_BIND mci->mci_herrno = h_errno; #endif diff --git a/usr.sbin/sendmail/src/domain.c b/usr.sbin/sendmail/src/domain.c index ab2f7ff5c4d..48109fef977 100644 --- a/usr.sbin/sendmail/src/domain.c +++ b/usr.sbin/sendmail/src/domain.c @@ -35,14 +35,14 @@ #include "sendmail.h" #ifndef lint -#ifdef NAMED_BIND -static char sccsid[] = "@(#)domain.c 8.10 (Berkeley) 12/21/93 (with name server)"; +#if NAMED_BIND +static char sccsid[] = "@(#)domain.c 8.19 (Berkeley) 3/11/94 (with name server)"; #else -static char sccsid[] = "@(#)domain.c 8.10 (Berkeley) 12/21/93 (without name server)"; +static char sccsid[] = "@(#)domain.c 8.19 (Berkeley) 3/11/94 (without name server)"; #endif #endif /* not lint */ -#ifdef NAMED_BIND +#if NAMED_BIND #include <errno.h> #include <arpa/nameser.h> @@ -69,6 +69,10 @@ static char MXHostBuf[MAXMXHOSTS*PACKETSZ]; # define NO_DATA NO_ADDRESS #endif +#ifndef HEADERSZ +# define HEADERSZ sizeof(HEADER) +#endif + /* don't use sizeof because sizeof(long) is different on 64-bit machines */ #define SHORTSIZE 2 /* size of a short (really, must be 2) */ #define LONGSIZE 4 /* size of a long (really, must be 4) */ @@ -116,6 +120,9 @@ getmxrr(host, mxhosts, droplocalhost, rcode) int weight[MAXMXHOSTS]; extern bool getcanonname(); + if (tTd(8, 2)) + printf("getmxrr(%s, droplocalhost=%d)\n", host, droplocalhost); + if (fallbackMX != NULL) { if (firsttime && res_query(FallBackMX, C_IN, T_A, @@ -156,6 +163,10 @@ getmxrr(host, mxhosts, droplocalhost, rcode) goto punt; case HOST_NOT_FOUND: +#ifdef BROKEN_RES_SEARCH + /* Ultrix resolver returns failure w/ h_errno=0 */ + case 0: +#endif /* the host just doesn't exist */ *rcode = EX_NOHOST; @@ -174,6 +185,12 @@ getmxrr(host, mxhosts, droplocalhost, rcode) /* it might come up later; better queue it up */ *rcode = EX_TEMPFAIL; break; + + default: + syserr("getmxrr: res_search (%s) failed with impossible h_errno (%d)\n", + host, h_errno); + *rcode = EX_OSERR; + break; } /* irreconcilable differences */ @@ -182,7 +199,7 @@ getmxrr(host, mxhosts, droplocalhost, rcode) /* find first satisfactory answer */ hp = (HEADER *)&answer; - cp = (u_char *)&answer + sizeof(HEADER); + cp = (u_char *)&answer + HEADERSZ; eom = (u_char *)&answer + n; for (qdcount = ntohs(hp->qdcount); qdcount--; cp += n + QFIXEDSZ) if ((n = dn_skipname(cp, eom)) < 0) @@ -216,6 +233,9 @@ getmxrr(host, mxhosts, droplocalhost, rcode) (st = stab(bp, ST_CLASS, ST_FIND)) != NULL && bitnset('w', st->s_class)) { + if (tTd(8, 3)) + printf("found localhost (%s) in MX list, pref=%d\n", + bp, pref); if (!seenlocal || pref < localpref) localpref = pref; seenlocal = TRUE; @@ -283,6 +303,8 @@ punt: */ *rcode = EX_CONFIG; + syserr("MX list for %s points back to %s", + host, MyHostName); return -1; } strcpy(MXHostBuf, host); @@ -365,7 +387,7 @@ mxrand(host) if (isascii(c) && isupper(c)) c = tolower(c); - hfunc = ((hfunc << 1) + c) % 2003; + hfunc = ((hfunc << 1) ^ c) % 2003; } hfunc &= 0xff; @@ -478,6 +500,10 @@ cnameloop: { *dp++ = _res.defdname; } + else if (*cp == '.') + { + *cp = '\0'; + } *dp = NULL; /* @@ -546,7 +572,7 @@ cnameloop: */ hp = (HEADER *) &answer; - ap = (u_char *) &answer + sizeof(HEADER); + ap = (u_char *) &answer + HEADERSZ; eom = (u_char *) &answer + ret; /* skip question part of response -- we know what we asked */ @@ -597,9 +623,19 @@ cnameloop: case T_CNAME: if (loopcnt++ > MAXCNAMEDEPTH) { - syserr("DNS failure: CNAME loop for %s", + /*XXX should notify postmaster XXX*/ + message("DNS failure: CNAME loop for %s", host); - continue; + if (CurEnv->e_message == NULL) + { + char ebuf[MAXLINE]; + + sprintf(ebuf, "Deferred: DNS failure: CNAME loop for %s", + host); + CurEnv->e_message = newstr(ebuf); + } + h_errno = NO_RECOVERY; + return FALSE; } /* value points at name */ diff --git a/usr.sbin/sendmail/src/envelope.c b/usr.sbin/sendmail/src/envelope.c index 3048ac3dc3a..14656f0d7ee 100644 --- a/usr.sbin/sendmail/src/envelope.c +++ b/usr.sbin/sendmail/src/envelope.c @@ -33,11 +33,10 @@ */ #ifndef lint -static char sccsid[] = "@(#)envelope.c 8.28 (Berkeley) 1/9/94"; +static char sccsid[] = "@(#)envelope.c 8.33 (Berkeley) 2/10/94"; #endif /* not lint */ #include "sendmail.h" -#include <sys/time.h> #include <pwd.h> /* @@ -585,7 +584,7 @@ setsender(from, e, delimptr, internal) */ if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP || - OpMode == MD_DAEMON) + OpMode == MD_ARPAFTP || OpMode == MD_DAEMON) realname = from; if (realname == NULL || realname[0] == '\0') realname = username(); @@ -694,9 +693,11 @@ setsender(from, e, delimptr, internal) ** Process passwd file entry. */ - /* extract home directory */ - e->e_from.q_home = newstr(pw->pw_dir); + if (strcmp(pw->pw_dir, "/") == 0) + e->e_from.q_home = newstr(""); + else + e->e_from.q_home = newstr(pw->pw_dir); define('z', e->e_from.q_home, e); /* extract user and group id */ @@ -720,7 +721,12 @@ setsender(from, e, delimptr, internal) else if (!internal && OpMode != MD_DAEMON) { if (e->e_from.q_home == NULL) + { e->e_from.q_home = getenv("HOME"); + if (e->e_from.q_home != NULL && + strcmp(e->e_from.q_home, "/") == 0) + e->e_from.q_home++; + } e->e_from.q_uid = RealUid; e->e_from.q_gid = RealGid; e->e_from.q_flags |= QGOODUID; diff --git a/usr.sbin/sendmail/src/err.c b/usr.sbin/sendmail/src/err.c index 60e78e3b7c5..fee36c4b42a 100644 --- a/usr.sbin/sendmail/src/err.c +++ b/usr.sbin/sendmail/src/err.c @@ -33,12 +33,13 @@ */ #ifndef lint -static char sccsid[] = "@(#)err.c 8.19 (Berkeley) 1/8/94"; +static char sccsid[] = "@(#)err.c 8.26 (Berkeley) 3/11/94"; #endif /* not lint */ # include "sendmail.h" # include <errno.h> # include <netdb.h> +# include <pwd.h> /* ** SYSERR -- Print error message. @@ -68,7 +69,7 @@ char MsgBuf[BUFSIZ*2]; /* text of most recent message */ static void fmtmsg(); -#if defined(NAMED_BIND) && !defined(NO_DATA) +#if NAMED_BIND && !defined(NO_DATA) # define NO_DATA NO_ADDRESS #endif @@ -85,6 +86,11 @@ syserr(fmt, va_alist) register char *p; int olderrno = errno; bool panic; +#ifdef LOG + char *uname; + struct passwd *pw; + char ubuf[80]; +#endif VA_LOCAL_DECL panic = *fmt == '!'; @@ -108,13 +114,24 @@ syserr(fmt, va_alist) ExitStat = EX_SOFTWARE; else ExitStat = EX_OSERR; + if (tTd(54, 1)) + printf("syserr: ExitStat = %d\n", ExitStat); } # ifdef LOG + pw = getpwuid(getuid()); + if (pw != NULL) + uname = pw->pw_name; + else + { + uname = ubuf; + sprintf(ubuf, "UID%d", getuid()); + } + if (LogLevel > 0) - syslog(panic ? LOG_ALERT : LOG_CRIT, "%s: SYSERR: %s", + syslog(panic ? LOG_ALERT : LOG_CRIT, "%s: SYSERR(%s): %s", CurEnv->e_id == NULL ? "NOQUEUE" : CurEnv->e_id, - &MsgBuf[4]); + uname, &MsgBuf[4]); # endif /* LOG */ if (olderrno == EMFILE) { @@ -285,7 +302,10 @@ putoutmsg(msg, holdmsg) msg[0] = '5'; (void) fflush(stdout); - if (OpMode == MD_SMTP || OpMode == MD_DAEMON) + + /* if DisConnected, OutChannel now points to the transcript */ + if (!DisConnected && + (OpMode == MD_SMTP || OpMode == MD_DAEMON || OpMode == MD_ARPAFTP)) fprintf(OutChannel, "%s\r\n", msg); else fprintf(OutChannel, "%s\n", &msg[4]); @@ -294,7 +314,7 @@ putoutmsg(msg, holdmsg) (OpMode == MD_SMTP || OpMode == MD_DAEMON) ? msg : &msg[4]); if (msg[3] == ' ') (void) fflush(OutChannel); - if (!ferror(OutChannel)) + if (!ferror(OutChannel) || DisConnected) return; /* @@ -404,7 +424,7 @@ fmtmsg(eb, to, num, eno, fmt, ap) /* output the "to" person */ if (to != NULL && to[0] != '\0') { - (void) sprintf(eb, "%s... ", to); + (void) sprintf(eb, "%s... ", shortenstring(to, 203)); while (*eb != '\0') *eb++ &= 0177; } @@ -434,18 +454,18 @@ fmtmsg(eb, to, num, eno, fmt, ap) ** ERRSTRING -- return string description of error code ** ** Parameters: -** errno -- the error number to translate +** errnum -- the error number to translate ** ** Returns: -** A string description of errno. +** A string description of errnum. ** ** Side Effects: ** none. */ const char * -errstring(errno) - int errno; +errstring(errnum) + int errnum; { char *dnsmsg; static char buf[MAXLINE]; @@ -464,12 +484,12 @@ errstring(errno) */ dnsmsg = NULL; - switch (errno) + switch (errnum) { # if defined(DAEMON) && defined(ETIMEDOUT) case ETIMEDOUT: case ECONNRESET: - (void) strcpy(buf, sys_errlist[errno]); + (void) strcpy(buf, sys_errlist[errnum]); if (SmtpPhase != NULL) { (void) strcat(buf, " during "); @@ -498,7 +518,7 @@ errstring(errno) case EOPENTIMEOUT: return "Timeout on file open"; -# ifdef NAMED_BIND +# if NAMED_BIND case HOST_NOT_FOUND + E_DNSBASE: dnsmsg = "host not found"; break; @@ -533,9 +553,9 @@ errstring(errno) return buf; } - if (errno > 0 && errno < sys_nerr) - return (sys_errlist[errno]); + if (errnum > 0 && errnum < sys_nerr) + return (sys_errlist[errnum]); - (void) sprintf(buf, "Error %d", errno); + (void) sprintf(buf, "Error %d", errnum); return (buf); } diff --git a/usr.sbin/sendmail/src/headers.c b/usr.sbin/sendmail/src/headers.c index b05876bf20e..0d80b884b10 100644 --- a/usr.sbin/sendmail/src/headers.c +++ b/usr.sbin/sendmail/src/headers.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)headers.c 8.22 (Berkeley) 1/13/94"; +static char sccsid[] = "@(#)headers.c 8.30 (Berkeley) 2/25/94"; #endif /* not lint */ # include <errno.h> @@ -163,6 +163,7 @@ chompheader(line, def, e) { auto ADDRESS a; char *fancy; + bool oldSuprErrs = SuprErrs; extern char *crackaddr(); extern char *udbsender(); @@ -170,8 +171,16 @@ chompheader(line, def, e) ** Try doing USERDB rewriting even on fully commented ** names; this saves the "comment" information (such ** as full name) and rewrites the electronic part. + ** + ** XXX This code doesn't belong here -- parsing should + ** XXX not be done during collect() phase because + ** XXX error messages can confuse the SMTP phase. + ** XXX Setting SuprErrs is a crude hack around this + ** XXX problem. */ + if (OpMode == MD_SMTP || OpMode == MD_ARPAFTP) + SuprErrs = TRUE; fancy = crackaddr(fvalue); if (parseaddr(fvalue, &a, RF_COPYNONE, '\0', NULL, e) != NULL && a.q_mailer == LocalMailer && @@ -184,6 +193,7 @@ chompheader(line, def, e) define('g', oldg, e); fvalue = buf; } + SuprErrs = oldSuprErrs; } #endif #endif @@ -470,6 +480,32 @@ eatheader(e, full) define('a', p, e); /* + ** From person in antiquated ARPANET mode + ** required by UK Grey Book e-mail gateways (sigh) + */ + + if (OpMode == MD_ARPAFTP) + { + register struct hdrinfo *hi; + + for (hi = HdrInfo; hi->hi_field != NULL; hi++) + { + if (bitset(H_FROM, hi->hi_flags) && + (!bitset(H_RESENT, hi->hi_flags) || + bitset(EF_RESENT, e->e_flags)) && + (p = hvalue(hi->hi_field, e)) != NULL) + break; + } + if (hi->hi_field != NULL) + { + if (tTd(32, 2)) + printf("eatheader: setsender(*%s == %s)\n", + hi->hi_field, p); + setsender(p, e, NULL, TRUE); + } + } + + /* ** Log collection information. */ @@ -504,6 +540,8 @@ logsender(e, msgid) name = "[RESPONSE]"; else if ((name = macvalue('_', e)) != NULL) ; + else if (RealHostName == NULL) + name = "localhost"; else if (RealHostName[0] == '[') name = RealHostName; else @@ -860,8 +898,7 @@ crackaddr(addr) ** PUTHEADER -- put the header part of a message from the in-core copy ** ** Parameters: -** fp -- file to put it on. -** m -- mailer to use. +** mci -- the connection information. ** e -- envelope to use. ** ** Returns: @@ -878,9 +915,8 @@ crackaddr(addr) # define MAX(a,b) (((a)>(b))?(a):(b)) #endif -putheader(fp, m, e) - register FILE *fp; - register MAILER *m; +putheader(mci, e) + register MCI *mci; register ENVELOPE *e; { char buf[MAX(MAXLINE,BUFSIZ)]; @@ -888,7 +924,8 @@ putheader(fp, m, e) char obuf[MAXLINE]; if (tTd(34, 1)) - printf("--- putheader, mailer = %s ---\n", m->m_name); + printf("--- putheader, mailer = %s ---\n", + mci->mci_mailer->m_name); for (h = e->e_header; h != NULL; h = h->h_link) { @@ -902,7 +939,7 @@ putheader(fp, m, e) } if (bitset(H_CHECK|H_ACHECK, h->h_flags) && - !bitintersect(h->h_mflags, m->m_flags)) + !bitintersect(h->h_mflags, mci->mci_mailer->m_flags)) { if (tTd(34, 11)) printf(" (skipped)\n"); @@ -941,7 +978,7 @@ putheader(fp, m, e) if (bitset(H_FROM, h->h_flags)) oldstyle = FALSE; - commaize(h, p, fp, oldstyle, m, e); + commaize(h, p, oldstyle, mci, e); } else { @@ -954,12 +991,12 @@ putheader(fp, m, e) *nlp = '\0'; (void) strcat(obuf, p); *nlp = '\n'; - putline(obuf, fp, m); + putline(obuf, mci); p = ++nlp; obuf[0] = '\0'; } (void) strcat(obuf, p); - putline(obuf, fp, m); + putline(obuf, mci); } } } @@ -969,10 +1006,8 @@ putheader(fp, m, e) ** Parameters: ** h -- the header field to output. ** p -- the value to put in it. -** fp -- file to put it to. ** oldstyle -- TRUE if this is an old style header. -** m -- a pointer to the mailer descriptor. If NULL, -** don't transform the name at all. +** mci -- the connection information. ** e -- the envelope containing the message. ** ** Returns: @@ -982,16 +1017,17 @@ putheader(fp, m, e) ** outputs "p" to file "fp". */ -commaize(h, p, fp, oldstyle, m, e) +void +commaize(h, p, oldstyle, mci, e) register HDR *h; register char *p; - FILE *fp; bool oldstyle; - register MAILER *m; + register MCI *mci; register ENVELOPE *e; { register char *obp; int opos; + int omax; bool firstone = TRUE; char obuf[MAXLINE + 3]; @@ -1007,6 +1043,9 @@ commaize(h, p, fp, oldstyle, m, e) (void) sprintf(obp, "%s: ", h->h_field); opos = strlen(h->h_field) + 2; obp += opos; + omax = mci->mci_mailer->m_linelimit - 2; + if (omax < 0 || omax > 78) + omax = 78; /* ** Run through the list of values. @@ -1070,7 +1109,7 @@ commaize(h, p, fp, oldstyle, m, e) if (bitset(H_FROM, h->h_flags)) flags |= RF_SENDERADDR; stat = EX_OK; - name = remotename(name, m, flags, &stat, e); + name = remotename(name, mci->mci_mailer, flags, &stat, e); if (*name == '\0') { *p = savechar; @@ -1081,19 +1120,19 @@ commaize(h, p, fp, oldstyle, m, e) opos += strlen(name); if (!firstone) opos += 2; - if (opos > 78 && !firstone) + if (opos > omax && !firstone) { (void) strcpy(obp, ",\n"); - putline(obuf, fp, m); + putline(obuf, mci); obp = obuf; - (void) sprintf(obp, " "); + (void) strcpy(obp, " "); opos = strlen(obp); obp += opos; opos += strlen(name); } else if (!firstone) { - (void) sprintf(obp, ", "); + (void) strcpy(obp, ", "); obp += 2; } @@ -1103,7 +1142,7 @@ commaize(h, p, fp, oldstyle, m, e) *p = savechar; } (void) strcpy(obp, "\n"); - putline(obuf, fp, m); + putline(obuf, mci); } /* ** COPYHEADER -- copy header list diff --git a/usr.sbin/sendmail/src/macro.c b/usr.sbin/sendmail/src/macro.c index 8beb5a7e375..8a8a90b4f0f 100644 --- a/usr.sbin/sendmail/src/macro.c +++ b/usr.sbin/sendmail/src/macro.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)macro.c 8.2 (Berkeley) 7/29/93"; +static char sccsid[] = "@(#)macro.c 8.3 (Berkeley) 2/7/94"; #endif /* not lint */ # include "sendmail.h" @@ -115,8 +115,14 @@ expand(s, buf, buflim, e) continue; case MACROEXPAND: /* macro interpolation */ - c = *++s; - q = macvalue(c & 0177, e); + c = *++s & 0177; + if (c != '\0') + q = macvalue(c, e); + else + { + s--; + q = NULL; + } if (q == NULL) continue; break; diff --git a/usr.sbin/sendmail/src/main.c b/usr.sbin/sendmail/src/main.c index d05f13da46c..cdd97c34a9a 100644 --- a/usr.sbin/sendmail/src/main.c +++ b/usr.sbin/sendmail/src/main.c @@ -39,14 +39,13 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)main.c 8.46 (Berkeley) 1/9/94"; +static char sccsid[] = "@(#)main.c 8.52 (Berkeley) 3/11/94"; #endif /* not lint */ #define _DEFINE #include "sendmail.h" -#include <sgtty.h> -#ifdef NAMED_BIND +#if NAMED_BIND #include <arpa/nameser.h> #include <resolv.h> #endif @@ -321,7 +320,7 @@ main(argc, argv, envp) OpMode = MD_DELIVER; FullName = getenv("NAME"); -#ifdef NAMED_BIND +#if NAMED_BIND if (tTd(8, 8)) _res.options |= RES_DEBUG; #endif @@ -443,6 +442,9 @@ main(argc, argv, envp) case MD_TEST: case MD_INITALIAS: case MD_PRINT: +#ifdef MAYBE_NEXT_RELEASE + case MD_ARPAFTP: +#endif OpMode = j; break; @@ -708,13 +710,6 @@ main(argc, argv, envp) /* remove things that don't make sense in daemon mode */ FullName = NULL; break; - - case MD_SMTP: - if (RealUid != 0) - auth_warning(CurEnv, - "%s owned process doing -bs", - RealUserName); - break; } /* do heuristic mode adjustment */ @@ -1297,6 +1292,7 @@ disconnect(droplev, e) HoldErrs = TRUE; CurEnv->e_errormode = EM_MAIL; Verbose = FALSE; + DisConnected = TRUE; /* all input from /dev/null */ if (InChannel != stdin) @@ -1360,7 +1356,7 @@ obsolete(argv) /* skip over options that do have a value */ op = strchr(OPTIONS, ap[1]); if (op != NULL && *++op == ':' && ap[2] == '\0' && - argv[1] != NULL && argv[1][0] != '-') + ap[1] != 'd' && argv[1] != NULL && argv[1][0] != '-') { argv++; continue; diff --git a/usr.sbin/sendmail/src/map.c b/usr.sbin/sendmail/src/map.c index 7a3bdc0c002..7444cdab737 100644 --- a/usr.sbin/sendmail/src/map.c +++ b/usr.sbin/sendmail/src/map.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)map.c 8.20 (Berkeley) 12/11/93"; +static char sccsid[] = "@(#)map.c 8.22 (Berkeley) 2/18/94"; #endif /* not lint */ #include "sendmail.h" @@ -638,7 +638,7 @@ bt_map_open(map, mode) if (omode == O_RDWR) { omode |= O_CREAT|O_TRUNC; -#if defined(O_EXLOCK) && defined(HASFLOCK) +#if defined(O_EXLOCK) && HASFLOCK omode |= O_EXLOCK; # if !defined(OLD_NEWDB) } @@ -664,7 +664,7 @@ bt_map_open(map, mode) syserr("Cannot open BTREE database %s", map->map_file); return FALSE; } -#if !defined(OLD_NEWDB) && defined(HASFLOCK) +#if !defined(OLD_NEWDB) && HASFLOCK fd = db->fd(db); # if !defined(O_EXLOCK) if (mode == O_RDWR && fd >= 0) @@ -722,7 +722,7 @@ hash_map_open(map, mode) if (omode == O_RDWR) { omode |= O_CREAT|O_TRUNC; -#if defined(O_EXLOCK) && defined(HASFLOCK) +#if defined(O_EXLOCK) && HASFLOCK omode |= O_EXLOCK; # if !defined(OLD_NEWDB) } @@ -748,7 +748,7 @@ hash_map_open(map, mode) syserr("Cannot open HASH database %s", map->map_file); return FALSE; } -#if !defined(OLD_NEWDB) && defined(HASFLOCK) +#if !defined(OLD_NEWDB) && HASFLOCK fd = db->fd(db); # if !defined(O_EXLOCK) if (mode == O_RDWR && fd >= 0) @@ -965,12 +965,20 @@ nis_map_open(map, mode) map->map_domain = p; } - if (map->map_domain == NULL) - yp_get_default_domain(&map->map_domain); - if (*map->map_file == '\0') map->map_file = "mail.aliases"; + if (map->map_domain == NULL) + { + yperr = yp_get_default_domain(&map->map_domain); + if (yperr != 0) + { + syserr("NIS map %s specified, but NIS not running\n", + map->map_file); + return FALSE; + } + } + /* check to see if this map actually exists */ yperr = yp_match(map->map_domain, map->map_file, "@", 1, &vp, &vsize); diff --git a/usr.sbin/sendmail/src/mci.c b/usr.sbin/sendmail/src/mci.c index 68a98dd3a67..978b8c3cdbc 100644 --- a/usr.sbin/sendmail/src/mci.c +++ b/usr.sbin/sendmail/src/mci.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)mci.c 8.9 (Berkeley) 12/1/93"; +static char sccsid[] = "@(#)mci.c 8.12 (Berkeley) 2/9/94"; #endif /* not lint */ #include "sendmail.h" @@ -275,6 +275,9 @@ mci_get(host, m) bzero(&CurHostAddr, sizeof CurHostAddr); #endif + /* clear out any expired connections */ + mci_scan(NULL); + if (m->m_mno < 0) syserr("negative mno %d (%s)", m->m_mno, m->m_name); s = stab(host, ST_MCI + m->m_mno, ST_ENTER); @@ -300,6 +303,21 @@ mci_get(host, m) mci->mci_exitstat = EX_OK; mci->mci_state = MCIS_CLOSED; } + else + { + /* get peer host address for logging reasons only */ + /* (this should really be in the mci struct) */ + int socksize = sizeof CurHostAddr; + + (void) getpeername(fileno(mci->mci_in), + (struct sockaddr *) &CurHostAddr, &socksize); + } + } + if (mci->mci_state == MCIS_CLOSED) + { + /* copy out any mailer flags needed in connection state */ + if (bitnset(M_7BITS, m->m_flags)) + mci->mci_flags |= MCIF_7BIT; } return mci; diff --git a/usr.sbin/sendmail/src/newaliases.1 b/usr.sbin/sendmail/src/newaliases.1 index 65cfc5f38e3..c611b78b62b 100644 --- a/usr.sbin/sendmail/src/newaliases.1 +++ b/usr.sbin/sendmail/src/newaliases.1 @@ -29,9 +29,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" @(#)newaliases.1 8.1 (Berkeley) 6/7/93 +.\" @(#)newaliases.1 8.4 (Berkeley) 2/22/94 .\" -.Dd June 7, 1993 +.Dd February 22, 1994 .Dt NEWALIASES 1 .Os BSD 4 .Sh NAME @@ -43,12 +43,23 @@ .Nm Newaliases rebuilds the random access data base for the mail aliases file .Pa /etc/aliases . -It must be run each time -.Pa /etc/aliases -is changed in order +It must be run each time this file is changed in order for the change to take effect. +.Pp +.Nm Newaliases +is identical to +.Dq Li "sendmail -bi" . +.Pp +The +.Nm newaliases +utility exits 0 on success, and >0 if an error occurs. +.Sh FILES +.Bl -tag -width /etc/aliases -compact +.It Pa /etc/aliases +The mail aliases file +.El .Sh SEE ALSO -.\" .Xr aliases 5 , +.Xr aliases 5 , .Xr sendmail 8 .Sh HISTORY The diff --git a/usr.sbin/sendmail/src/parseaddr.c b/usr.sbin/sendmail/src/parseaddr.c index 13274dab7c6..800a1372cdc 100644 --- a/usr.sbin/sendmail/src/parseaddr.c +++ b/usr.sbin/sendmail/src/parseaddr.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)parseaddr.c 8.29 (Berkeley) 1/5/94"; +static char sccsid[] = "@(#)parseaddr.c 8.30 (Berkeley) 2/9/94"; #endif /* not lint */ # include "sendmail.h" @@ -1331,7 +1331,7 @@ badaddr: } else { - usrerr("%s", buf); + usrerr("553 %s", buf); } goto badaddr; } diff --git a/usr.sbin/sendmail/src/queue.c b/usr.sbin/sendmail/src/queue.c index e2cad4cf51d..99e851efad7 100644 --- a/usr.sbin/sendmail/src/queue.c +++ b/usr.sbin/sendmail/src/queue.c @@ -36,9 +36,9 @@ #ifndef lint #ifdef QUEUE -static char sccsid[] = "@(#)queue.c 8.36 (Berkeley) 1/9/94 (with queueing)"; +static char sccsid[] = "@(#)queue.c 8.40 (Berkeley) 3/6/94 (with queueing)"; #else -static char sccsid[] = "@(#)queue.c 8.36 (Berkeley) 1/9/94 (without queueing)"; +static char sccsid[] = "@(#)queue.c 8.40 (Berkeley) 3/6/94 (without queueing)"; #endif #endif /* not lint */ @@ -94,6 +94,7 @@ queueup(e, queueall, announce) bool newid; register char *p; MAILER nullmailer; + MCI mcibuf; char buf[MAXLINE], tf[MAXLINE]; /* @@ -182,7 +183,10 @@ queueup(e, queueall, announce) if (fd < 0 || (dfp = fdopen(fd, "w")) == NULL) syserr("!queueup: cannot create data temp file %s, uid=%d", e->e_df, geteuid()); - (*e->e_putbody)(dfp, FileMailer, e, NULL); + bzero(&mcibuf, sizeof mcibuf); + mcibuf.mci_out = dfp; + mcibuf.mci_mailer = FileMailer; + (*e->e_putbody)(&mcibuf, e, NULL); (void) xfclose(dfp, "queueup dfp", e->e_id); e->e_putbody = putbody; } @@ -278,6 +282,9 @@ queueup(e, queueall, announce) nullmailer.m_re_rwset = nullmailer.m_rh_rwset = nullmailer.m_se_rwset = nullmailer.m_sh_rwset = -1; nullmailer.m_eol = "\n"; + bzero(&mcibuf, sizeof mcibuf); + mcibuf.mci_mailer = &nullmailer; + mcibuf.mci_out = tfp; define('g', "\201f", e); for (h = e->e_header; h != NULL; h = h->h_link) @@ -330,8 +337,7 @@ queueup(e, queueall, announce) if (bitset(H_FROM, h->h_flags)) oldstyle = FALSE; - commaize(h, h->h_value, tfp, oldstyle, - &nullmailer, e); + commaize(h, h->h_value, oldstyle, &mcibuf, e); TrafficLogFile = savetrace; } @@ -565,7 +571,8 @@ runqueue(forkflag) pid = dowork(w->w_name + 2, ForkQueueRuns, FALSE, e); errno = 0; - (void) waitfor(pid); + if (pid != 0) + (void) waitfor(pid); } free(w->w_name); free((char *) w); @@ -891,6 +898,7 @@ dowork(id, forkflag, requeueflag, e) e->e_errormode = EM_MAIL; e->e_id = id; GrabTo = UseErrorsTo = FALSE; + ExitStat = EX_OK; if (forkflag) { disconnect(1, e); @@ -913,7 +921,7 @@ dowork(id, forkflag, requeueflag, e) if (forkflag) exit(EX_OK); else - return; + return 0; } e->e_flags |= EF_INQUEUE; @@ -1135,7 +1143,7 @@ readqf(e) break; default: - syserr("readqf: %s: line %s: bad line \"%s\"", + syserr("readqf: %s: line %d: bad line \"%s\"", qf, LineNumber, bp); fclose(qfp); rename(qf, queuename(e, 'Q')); @@ -1539,7 +1547,10 @@ setctluser(user) *p++ = '\0'; if (*user != '\0' && (pw = getpwnam(user)) != NULL) { - a->q_home = newstr(pw->pw_dir); + if (strcmp(pw->pw_dir, "/") == 0) + a->q_home = ""; + else + a->q_home = newstr(pw->pw_dir); a->q_uid = pw->pw_uid; a->q_gid = pw->pw_gid; a->q_user = newstr(user); diff --git a/usr.sbin/sendmail/src/readcf.c b/usr.sbin/sendmail/src/readcf.c index 0d8d6fddf3a..4c6be01b090 100644 --- a/usr.sbin/sendmail/src/readcf.c +++ b/usr.sbin/sendmail/src/readcf.c @@ -33,13 +33,13 @@ */ #ifndef lint -static char sccsid[] = "@(#)readcf.c 8.18 (Berkeley) 1/9/94"; +static char sccsid[] = "@(#)readcf.c 8.22 (Berkeley) 3/11/94"; #endif /* not lint */ # include "sendmail.h" # include <pwd.h> # include <grp.h> -#ifdef NAMED_BIND +#if NAMED_BIND # include <arpa/nameser.h> # include <resolv.h> #endif @@ -221,7 +221,7 @@ readcf(cfname, safe, e) if (*p == '\0') { - syserr("invalid rewrite line \"%s\"", bp); + syserr("invalid rewrite line \"%s\" (tab expected)", bp); break; } @@ -542,7 +542,7 @@ readcf(cfname, safe, e) { /* user didn't initialize: set up host map */ strcpy(buf, "host host"); -#ifdef NAMED_BIND +#if NAMED_BIND if (ConfigLevel >= 2) strcat(buf, " -a."); #endif @@ -600,8 +600,19 @@ fileclass(class, filename, fmt, safe, optional) struct stat stbuf; char buf[MAXLINE]; + if (tTd(37, 2)) + printf("fileclass(%s, fmt=%s)\n", filename, fmt); + + if (filename[0] == '|') + { + syserr("fileclass: pipes (F%c%s) not supported due to security problems", + class, filename); + return; + } if (stat(filename, &stbuf) < 0) { + if (tTd(37, 2)) + printf(" cannot stat (%s)\n", errstring(errno)); if (!optional) syserr("fileclass: cannot stat %s", filename); return; @@ -659,8 +670,7 @@ fileclass(class, filename, fmt, safe, optional) *p++ = '\0'; /* enter the word in the symbol table */ - s = stab(q, ST_CLASS, ST_ENTER); - setbitn(class, s->s_class); + setclass(class, q); } } @@ -1007,7 +1017,7 @@ printrules() static BITMAP StickyOpt; /* set if option is stuck */ -#ifdef NAMED_BIND +#if NAMED_BIND struct resolverflags { @@ -1216,7 +1226,7 @@ setoption(opt, val, safe, sticky, e) break; case 'I': /* use internet domain name server */ -#ifdef NAMED_BIND +#if NAMED_BIND UseNameServer = TRUE; for (p = val; *p != 0; ) { diff --git a/usr.sbin/sendmail/src/recipient.c b/usr.sbin/sendmail/src/recipient.c index 706fddc82c4..c6c15c4b6c6 100644 --- a/usr.sbin/sendmail/src/recipient.c +++ b/usr.sbin/sendmail/src/recipient.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)recipient.c 8.39 (Berkeley) 1/10/94"; +static char sccsid[] = "@(#)recipient.c 8.44 (Berkeley) 2/28/94"; #endif /* not lint */ # include "sendmail.h" @@ -307,8 +307,9 @@ recipient(a, sendq, e) { #ifdef LOG if (LogLevel > 2) - syslog(LOG_ERR, "%s: include %s: transient error: %e", - e->e_id, a->q_user, errstring(ret)); + syslog(LOG_ERR, "%s: include %s: transient error: %s", + e->e_id == NULL ? "NOQUEUE" : e->e_id, + a->q_user, errstring(ret)); #endif a->q_flags |= QQUEUEUP; a->q_flags &= ~QDONTSEND; @@ -376,7 +377,8 @@ recipient(a, sendq, e) # ifdef LOG if (LogLevel > 8) syslog(LOG_INFO, "%s: deferred: udbexpand: %s", - e->e_id, errstring(errno)); + e->e_id == NULL ? "NOQUEUE" : e->e_id, + errstring(errno)); # endif message("queued (user database error): %s", errstring(errno)); @@ -447,7 +449,10 @@ recipient(a, sendq, e) (void) strcpy(buf, pw->pw_name); goto trylocaluser; } - a->q_home = newstr(pw->pw_dir); + if (strcmp(pw->pw_dir, "/") == 0) + a->q_home = ""; + else + a->q_home = newstr(pw->pw_dir); a->q_uid = pw->pw_uid; a->q_gid = pw->pw_gid; a->q_ruser = newstr(pw->pw_name); @@ -719,6 +724,19 @@ writable(filename, ctladdr, flags) ** Side Effects: ** reads the :include: file and sends to everyone ** listed in that file. +** +** Security Note: +** If you have restricted chown (that is, you can't +** give a file away), it is reasonable to allow programs +** and files called from this :include: file to be to be +** run as the owner of the :include: file. This is bogus +** if there is any chance of someone giving away a file. +** We assume that pre-POSIX systems can give away files. +** +** There is an additional restriction that if you +** forward to a :include: file, it will not take on +** the ownership of the :include: file. This may not +** be necessary, but shouldn't hurt. */ static jmp_buf CtxIncludeTimeout; @@ -750,6 +768,24 @@ include(fname, forwarding, ctladdr, sendq, e) int sfflags = forwarding ? SFF_MUSTOWN : SFF_ANYFILE; struct stat st; char buf[MAXLINE]; +#ifdef _POSIX_CHOWN_RESTRICTED +# if _POSIX_CHOWN_RESTRICTED == -1 +# define safechown FALSE +# else +# define safechown TRUE +# endif +#else +# ifdef _PC_CHOWN_RESTRICTED + bool safechown; +# else +# ifdef BSD +# define safechown TRUE +# else +# define safechown FALSE +# endif +# endif +#endif + extern bool chownsafe(); if (tTd(27, 2)) printf("include(%s)\n", fname); @@ -858,7 +894,10 @@ resetuid: return rval; } - if (ca == NULL) +#ifndef safechown + safechown = chownsafe(fileno(fp)); +#endif + if (ca == NULL && safechown) { ctladdr->q_uid = st.st_uid; ctladdr->q_gid = st.st_gid; @@ -872,13 +911,25 @@ resetuid: } else { + char *sh; register struct passwd *pw; + sh = "/SENDMAIL/ANY/SHELL/"; pw = getpwuid(st.st_uid); - if (pw == NULL || !usershellok(pw->pw_shell)) + if (pw != NULL) { ctladdr->q_ruser = newstr(pw->pw_name); + if (safechown) + sh = pw->pw_shell; + } + if (pw == NULL) ctladdr->q_flags |= QBOGUSSHELL; + else if(!usershellok(sh)) + { + if (safechown) + ctladdr->q_flags |= QBOGUSSHELL; + else + ctladdr->q_flags |= QUNSAFEADDR; } } @@ -924,7 +975,8 @@ resetuid: #ifdef LOG if (forwarding && LogLevel > 9) syslog(LOG_INFO, "%s: forward %s => %s", - e->e_id, oldto, buf); + e->e_id == NULL ? "NOQUEUE" : e->e_id, + oldto, buf); #endif AliasLevel++; diff --git a/usr.sbin/sendmail/src/savemail.c b/usr.sbin/sendmail/src/savemail.c index 2d09594b3c7..6467defcfdb 100644 --- a/usr.sbin/sendmail/src/savemail.c +++ b/usr.sbin/sendmail/src/savemail.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)savemail.c 8.24 (Berkeley) 12/18/93"; +static char sccsid[] = "@(#)savemail.c 8.28 (Berkeley) 3/11/94"; #endif /* not lint */ # include "sendmail.h" @@ -81,17 +81,19 @@ savemail(e) register FILE *fp; int state; auto ADDRESS *q = NULL; + register char *p; + MCI mcibuf; char buf[MAXLINE+1]; extern struct passwd *getpwnam(); - register char *p; extern char *ttypath(); typedef int (*fnptr)(); extern bool writable(); if (tTd(6, 1)) { - printf("\nsavemail, errormode = %c, id = %s\n e_from=", - e->e_errormode, e->e_id == NULL ? "NONE" : e->e_id); + printf("\nsavemail, errormode = %c, id = %s, ExitStat = %d\n e_from=", + e->e_errormode, e->e_id == NULL ? "NONE" : e->e_id, + ExitStat); printaddr(&e->e_from, FALSE); } @@ -282,8 +284,8 @@ savemail(e) state = ESM_POSTMASTER; break; } - if (returntosender(e->e_message, - q, (e->e_class >= 0), e) == 0) + if (returntosender(e->e_message, e->e_errorqueue, + (e->e_class >= 0), e) == 0) { state = ESM_DONE; break; @@ -393,11 +395,17 @@ savemail(e) break; } - putfromline(fp, FileMailer, e); - (*e->e_puthdr)(fp, FileMailer, e); - putline("\n", fp, FileMailer); - (*e->e_putbody)(fp, FileMailer, e, NULL); - putline("\n", fp, FileMailer); + bzero(&mcibuf, sizeof mcibuf); + mcibuf.mci_out = fp; + mcibuf.mci_mailer = FileMailer; + if (bitnset(M_7BITS, FileMailer->m_flags)) + mcibuf.mci_flags |= MCIF_7BIT; + + putfromline(&mcibuf, e); + (*e->e_puthdr)(&mcibuf, e); + putline("\n", &mcibuf); + (*e->e_putbody)(&mcibuf, e, NULL); + putline("\n", &mcibuf); (void) fflush(fp); state = ferror(fp) ? ESM_PANIC : ESM_DONE; (void) xfclose(fp, "savemail", "/usr/tmp/dead.letter"); @@ -564,8 +572,7 @@ returntosender(msg, returnq, sendbody, e) ** original offending message. ** ** Parameters: -** fp -- the output file. -** m -- the mailer to output to. +** mci -- the mailer connection information. ** e -- the envelope we are working in. ** ** Returns: @@ -575,9 +582,8 @@ returntosender(msg, returnq, sendbody, e) ** Outputs the body of an error message. */ -errbody(fp, m, e) - register FILE *fp; - register struct mailer *m; +errbody(mci, e) + register MCI *mci; register ENVELOPE *e; { register FILE *xfile; @@ -589,7 +595,7 @@ errbody(fp, m, e) if (e->e_parent == NULL) { syserr("errbody: null parent"); - putline(" ----- Original message lost -----\n", fp, m); + putline(" ----- Original message lost -----\n", mci); return; } @@ -599,11 +605,11 @@ errbody(fp, m, e) if (e->e_msgboundary != NULL) { - putline("This is a MIME-encapsulated message", fp, m); - putline("", fp, m); + putline("This is a MIME-encapsulated message", mci); + putline("", mci); (void) sprintf(buf, "--%s", e->e_msgboundary); - putline(buf, fp, m); - putline("", fp, m); + putline(buf, mci); + putline("", mci); } /* @@ -617,21 +623,21 @@ errbody(fp, m, e) !bitset(EF_FATALERRS|EF_SENDRECEIPT, e->e_parent->e_flags)) { putline(" **********************************************", - fp, m); + mci); putline(" ** THIS IS A WARNING MESSAGE ONLY **", - fp, m); + mci); putline(" ** YOU DO NOT NEED TO RESEND YOUR MESSAGE **", - fp, m); + mci); putline(" **********************************************", - fp, m); - putline("", fp, m); + mci); + putline("", mci); } sprintf(buf, "The original message was received at %s", arpadate(ctime(&e->e_parent->e_ctime))); - putline(buf, fp, m); + putline(buf, mci); expand("from \201_", buf, &buf[sizeof buf - 1], e->e_parent); - putline(buf, fp, m); - putline("", fp, m); + putline(buf, mci); + putline("", mci); /* ** Output error message header (if specified and available). @@ -647,17 +653,17 @@ errbody(fp, m, e) while (fgets(buf, sizeof buf, xfile) != NULL) { expand(buf, buf, &buf[sizeof buf - 1], e); - putline(buf, fp, m); + putline(buf, mci); } (void) fclose(xfile); - putline("\n", fp, m); + putline("\n", mci); } } else { expand(ErrMsgFile, buf, &buf[sizeof buf - 1], e); - putline(buf, fp, m); - putline("", fp, m); + putline(buf, mci); + putline("", mci); } } @@ -673,7 +679,7 @@ errbody(fp, m, e) if (printheader) { putline(" ----- The following addresses had delivery problems -----", - fp, m); + mci); printheader = FALSE; } strcpy(buf, q->q_paddr); @@ -681,18 +687,18 @@ errbody(fp, m, e) strcat(buf, " (unrecoverable error)"); else strcat(buf, " (transient failure)"); - putline(buf, fp, m); + putline(buf, mci); if (q->q_alias != NULL) { strcpy(buf, " (expanded from: "); strcat(buf, q->q_alias->q_paddr); strcat(buf, ")"); - putline(buf, fp, m); + putline(buf, mci); } } } if (!printheader) - putline("\n", fp, m); + putline("\n", mci); /* ** Output transcript of errors @@ -703,15 +709,15 @@ errbody(fp, m, e) if ((xfile = fopen(p, "r")) == NULL) { syserr("Cannot open %s", p); - putline(" ----- Transcript of session is unavailable -----\n", fp, m); + putline(" ----- Transcript of session is unavailable -----\n", mci); } else { - putline(" ----- Transcript of session follows -----\n", fp, m); + putline(" ----- Transcript of session follows -----\n", mci); if (e->e_xfp != NULL) (void) fflush(e->e_xfp); while (fgets(buf, sizeof buf, xfile) != NULL) - putline(buf, fp, m); + putline(buf, mci); (void) xfclose(xfile, "errbody xscript", p); } errno = 0; @@ -722,42 +728,42 @@ errbody(fp, m, e) if (NoReturn) SendBody = FALSE; - putline("", fp, m); + putline("", mci); if (e->e_parent->e_df != NULL) { if (SendBody) - putline(" ----- Original message follows -----\n", fp, m); + putline(" ----- Original message follows -----\n", mci); else - putline(" ----- Message header follows -----\n", fp, m); - (void) fflush(fp); + putline(" ----- Message header follows -----\n", mci); + (void) fflush(mci->mci_out); if (e->e_msgboundary != NULL) { - putline("", fp, m); + putline("", mci); (void) sprintf(buf, "--%s", e->e_msgboundary); - putline(buf, fp, m); - putline("Content-Type: message/rfc822", fp, m); - putline("", fp, m); + putline(buf, mci); + putline("Content-Type: message/rfc822", mci); + putline("", mci); } - putheader(fp, m, e->e_parent); - putline("", fp, m); + putheader(mci, e->e_parent); + putline("", mci); if (SendBody) - putbody(fp, m, e->e_parent, e->e_msgboundary); + putbody(mci, e->e_parent, e->e_msgboundary); else - putline(" ----- Message body suppressed -----", fp, m); + putline(" ----- Message body suppressed -----", mci); } else { - putline(" ----- No message was collected -----\n", fp, m); + putline(" ----- No message was collected -----\n", mci); } if (e->e_msgboundary != NULL) { - putline("", fp, m); + putline("", mci); (void) sprintf(buf, "--%s--", e->e_msgboundary); - putline(buf, fp, m); + putline(buf, mci); } - putline("", fp, m); + putline("", mci); /* ** Cleanup and exit @@ -786,7 +792,7 @@ errbody(fp, m, e) pruneroute(addr) char *addr; { -#ifdef NAMED_BIND +#if NAMED_BIND char *start, *at, *comma; char c; int rcode; diff --git a/usr.sbin/sendmail/src/sendmail.h b/usr.sbin/sendmail/src/sendmail.h index e68ffe09889..ca6af5fef14 100644 --- a/usr.sbin/sendmail/src/sendmail.h +++ b/usr.sbin/sendmail/src/sendmail.h @@ -31,7 +31,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)sendmail.h 8.38 (Berkeley) 1/5/94 + * @(#)sendmail.h 8.41 (Berkeley) 2/6/94 */ /* @@ -41,7 +41,7 @@ # ifdef _DEFINE # define EXTERN # ifndef lint -static char SmailSccsId[] = "@(#)sendmail.h 8.38 1/5/94"; +static char SmailSccsId[] = "@(#)sendmail.h 8.41 2/6/94"; # endif # else /* _DEFINE */ # define EXTERN extern @@ -268,6 +268,50 @@ extern struct hdrinfo HdrInfo[]; # define H_RECEIPTTO 02000 /* this field has return receipt info */ # define H_ERRORSTO 04000 /* this field has error address info */ /* +** Information about currently open connections to mailers, or to +** hosts that we have looked up recently. +*/ + +# define MCI struct mailer_con_info + +MCI +{ + short mci_flags; /* flag bits, see below */ + short mci_errno; /* error number on last connection */ + short mci_herrno; /* h_errno from last DNS lookup */ + short mci_exitstat; /* exit status from last connection */ + short mci_state; /* SMTP state */ + long mci_maxsize; /* max size this server will accept */ + FILE *mci_in; /* input side of connection */ + FILE *mci_out; /* output side of connection */ + int mci_pid; /* process id of subordinate proc */ + char *mci_phase; /* SMTP phase string */ + struct mailer *mci_mailer; /* ptr to the mailer for this conn */ + char *mci_host; /* host name */ + time_t mci_lastuse; /* last usage time */ +}; + + +/* flag bits */ +#define MCIF_VALID 000001 /* this entry is valid */ +#define MCIF_TEMP 000002 /* don't cache this connection */ +#define MCIF_CACHED 000004 /* currently in open cache */ +#define MCIF_ESMTP 000010 /* this host speaks ESMTP */ +#define MCIF_EXPN 000020 /* EXPN command supported */ +#define MCIF_SIZE 000040 /* SIZE option supported */ +#define MCIF_8BITMIME 000100 /* BODY=8BITMIME supported */ +#define MCIF_7BIT 000200 /* strip this message to 7 bits */ +#define MCIF_MULTSTAT 000400 /* MAIL11V3: handles MULT status */ + +/* states */ +#define MCIS_CLOSED 0 /* no traffic on this connection */ +#define MCIS_OPENING 1 /* sending initial protocol */ +#define MCIS_OPEN 2 /* open, initial protocol sent */ +#define MCIS_ACTIVE 3 /* message being sent */ +#define MCIS_QUITING 4 /* running quit protocol */ +#define MCIS_SSD 5 /* service shutting down */ +#define MCIS_ERROR 6 /* I/O error on connection */ +/* ** Envelope structure. ** This structure defines the message itself. There is usually ** only one of these -- for the message that we originally read @@ -298,9 +342,9 @@ ENVELOPE short e_nsent; /* number of sends since checkpoint */ short e_sendmode; /* message send mode */ short e_errormode; /* error return mode */ - int (*e_puthdr)__P((FILE *, MAILER *, ENVELOPE *)); + int (*e_puthdr)__P((MCI *, ENVELOPE *)); /* function to put header of message */ - int (*e_putbody)__P((FILE *, MAILER *, ENVELOPE *, char *)); + int (*e_putbody)__P((MCI *, ENVELOPE *, char *)); /* function to put body of message */ struct envelope *e_parent; /* the message this one encloses */ struct envelope *e_sibling; /* the next envelope of interest */ @@ -429,49 +473,6 @@ struct metamac u_char metaval; /* internal code (as above) */ }; /* -** Information about currently open connections to mailers, or to -** hosts that we have looked up recently. -*/ - -# define MCI struct mailer_con_info - -MCI -{ - short mci_flags; /* flag bits, see below */ - short mci_errno; /* error number on last connection */ - short mci_herrno; /* h_errno from last DNS lookup */ - short mci_exitstat; /* exit status from last connection */ - short mci_state; /* SMTP state */ - long mci_maxsize; /* max size this server will accept */ - FILE *mci_in; /* input side of connection */ - FILE *mci_out; /* output side of connection */ - int mci_pid; /* process id of subordinate proc */ - char *mci_phase; /* SMTP phase string */ - struct mailer *mci_mailer; /* ptr to the mailer for this conn */ - char *mci_host; /* host name */ - time_t mci_lastuse; /* last usage time */ -}; - - -/* flag bits */ -#define MCIF_VALID 000001 /* this entry is valid */ -#define MCIF_TEMP 000002 /* don't cache this connection */ -#define MCIF_CACHED 000004 /* currently in open cache */ -#define MCIF_ESMTP 000010 /* this host speaks ESMTP */ -#define MCIF_EXPN 000020 /* EXPN command supported */ -#define MCIF_SIZE 000040 /* SIZE option supported */ -#define MCIF_8BITMIME 000100 /* BODY=8BITMIME supported */ -#define MCIF_MULTSTAT 000200 /* MAIL11V3: handles MULT status */ - -/* states */ -#define MCIS_CLOSED 0 /* no traffic on this connection */ -#define MCIS_OPENING 1 /* sending initial protocol */ -#define MCIS_OPEN 2 /* open, initial protocol sent */ -#define MCIS_ACTIVE 3 /* message being sent */ -#define MCIS_QUITING 4 /* running quit protocol */ -#define MCIS_SSD 5 /* service shutting down */ -#define MCIS_ERROR 6 /* I/O error on connection */ -/* ** Name canonification short circuit. ** ** If the name server for a host is down, the process of trying to @@ -660,6 +661,7 @@ EXTERN char OpMode; /* operation mode, see below */ #define MD_DELIVER 'm' /* be a mail sender */ #define MD_SMTP 's' /* run SMTP on standard input */ +#define MD_ARPAFTP 'a' /* obsolete ARPANET mode (Grey Book) */ #define MD_DAEMON 'd' /* run as a daemon */ #define MD_VERIFY 'v' /* verify: don't collect or deliver */ #define MD_TEST 't' /* test mode: resolve addrs only */ @@ -824,6 +826,7 @@ EXTERN bool UseErrorsTo; /* use Errors-To: header (back compat) */ EXTERN bool TryNullMXList; /* if we are the best MX, try host directly */ extern bool CheckLoopBack; /* check for loopback on HELO packet */ EXTERN bool InChild; /* true if running in an SMTP subprocess */ +EXTERN bool DisConnected; /* running with OutChannel redirected to xf */ EXTERN char SpaceSub; /* substitution for <lwsp> */ EXTERN int PrivacyFlags; /* privacy flags */ EXTERN char *ConfFile; /* location of configuration file [conf.c] */ @@ -950,6 +953,7 @@ extern void closexscript __P((ENVELOPE *)); extern sigfunc_t setsignal __P((int, sigfunc_t)); extern char *shortenstring __P((char *, int)); extern bool usershellok __P((char *)); +extern void commaize __P((HDR *, char *, int, MCI *, ENVELOPE *)); /* ellipsis is a different case though */ #ifdef __STDC__ diff --git a/usr.sbin/sendmail/src/srvrsmtp.c b/usr.sbin/sendmail/src/srvrsmtp.c index 2966f80af6e..e049de3ff17 100644 --- a/usr.sbin/sendmail/src/srvrsmtp.c +++ b/usr.sbin/sendmail/src/srvrsmtp.c @@ -36,9 +36,9 @@ #ifndef lint #ifdef SMTP -static char sccsid[] = "@(#)srvrsmtp.c 8.23 (Berkeley) 12/21/93 (with SMTP)"; +static char sccsid[] = "@(#)srvrsmtp.c 8.32 (Berkeley) 3/8/94 (with SMTP)"; #else -static char sccsid[] = "@(#)srvrsmtp.c 8.23 (Berkeley) 12/21/93 (without SMTP)"; +static char sccsid[] = "@(#)srvrsmtp.c 8.32 (Berkeley) 3/8/94 (without SMTP)"; #endif #endif /* not lint */ @@ -117,6 +117,10 @@ bool OneXact = FALSE; /* one xaction only this run */ char *CurSmtpClient; /* who's at the other end of channel */ static char *skipword(); +extern char RealUserName[]; + + +#define MAXBADCOMMANDS 25 /* maximum number of bad commands */ smtp(e) register ENVELOPE *e; @@ -132,10 +136,12 @@ smtp(e) char *protocol; /* sending protocol */ char *sendinghost; /* sending hostname */ long msize; /* approximate maximum message size */ + char *peerhostname; /* name of SMTP peer or "localhost" */ auto char *delimptr; char *id; int nrcpts; /* number of RCPT commands */ bool doublequeue; + int badcommands = 0; /* count of bad commands */ char inp[MAXLINE]; char cmdbuf[MAXLINE]; extern char Version[]; @@ -147,10 +153,13 @@ smtp(e) (void) dup2(fileno(OutChannel), fileno(stdout)); } settime(e); - CurHostName = RealHostName; + peerhostname = RealHostName; + if (peerhostname == NULL) + peerhostname = "localhost"; + CurHostName = peerhostname; CurSmtpClient = macvalue('_', e); if (CurSmtpClient == NULL) - CurSmtpClient = RealHostName; + CurSmtpClient = CurHostName; setproctitle("server %s startup", CurSmtpClient); expand("\201e", inp, &inp[sizeof inp], e); @@ -170,11 +179,15 @@ smtp(e) for (;;) { /* arrange for backout */ - if (setjmp(TopFrame) > 0 && InChild) + if (setjmp(TopFrame) > 0) { - QuickAbort = FALSE; - SuprErrs = TRUE; - finis(); + /* if() nesting is necessary for Cray UNICOS */ + if (InChild) + { + QuickAbort = FALSE; + SuprErrs = TRUE; + finis(); + } } QuickAbort = FALSE; HoldErrs = FALSE; @@ -196,6 +209,7 @@ smtp(e) if (p == NULL) { /* end of file, just die */ + disconnect(1, e); message("421 %s Lost input channel from %s", MyHostName, CurSmtpClient); #ifdef LOG @@ -260,14 +274,6 @@ smtp(e) SmtpPhase = "server HELO"; } sendinghost = newstr(p); - if (strcasecmp(p, RealHostName) != 0 && - (strcasecmp(RealHostName, "localhost") != 0 || - strcasecmp(p, MyHostName) != 0)) - { - auth_warning(e, "Host %s claimed to be %s", - RealHostName, p); - } - gothello = TRUE; if (c->cmdcode != CMDEHLO) { @@ -297,7 +303,7 @@ smtp(e) { /* set sending host to our known value */ if (sendinghost == NULL) - sendinghost = RealHostName; + sendinghost = peerhostname; if (bitset(PRIV_NEEDMAILHELO, PrivacyFlags)) { @@ -326,8 +332,18 @@ smtp(e) { auth_warning(e, "Host %s didn't use HELO protocol", - RealHostName); + peerhostname); } +#ifdef PICKY_HELO_CHECK + if (strcasecmp(sendinghost, peerhostname) != 0 && + (strcasecmp(peerhostname, "localhost") != 0 || + strcasecmp(sendinghost, MyHostName) != 0)) + { + auth_warning(e, "Host %s claimed to be %s", + peerhostname, sendinghost); + } +#endif + if (protocol == NULL) protocol = "SMTP"; define('r', protocol, e); @@ -362,12 +378,21 @@ smtp(e) if (p != NULL && *p != '\0') *p++ = '\0'; + /* check for possible spoofing */ + if (RealUid != 0 && OpMode == MD_SMTP && + (e->e_from.q_mailer != LocalMailer && + strcmp(e->e_from.q_user, RealUserName) != 0)) + { + auth_warning(e, "%s owned process doing -bs", + RealUserName); + } + /* now parse ESMTP arguments */ msize = 0; for (; p != NULL && *p != '\0'; p++) { char *kp; - char *vp; + char *vp = NULL; /* locate the beginning of the keyword */ while (isascii(*p) && isspace(*p)) @@ -700,8 +725,9 @@ smtp(e) case CMDQUIT: /* quit -- leave mail */ message("221 %s closing connection", MyHostName); +doquit: /* avoid future 050 messages */ - Verbose = FALSE; + disconnect(1, e); if (InChild) ExitStat = EX_QUIT; @@ -745,12 +771,19 @@ smtp(e) if (LogLevel > 0) syslog(LOG_CRIT, "\"%s\" command from %s (%s)", - c->cmdname, RealHostName, + c->cmdname, peerhostname, anynet_ntoa(&RealHostAddr)); # endif /* FALL THROUGH */ case CMDERROR: /* unknown command */ + if (++badcommands > MAXBADCOMMANDS) + { + message("421 %s Too many bad commands; closing connection", + MyHostName); + goto doquit; + } + message("500 Command unrecognized"); break; @@ -782,6 +815,7 @@ skipword(p, w) char *w; { register char *q; + char *firstp = p; /* find beginning of word */ while (isascii(*p) && isspace(*p)) @@ -796,7 +830,8 @@ skipword(p, w) if (*p != ':') { syntax: - message("501 Syntax error in parameters"); + message("501 Syntax error in parameters scanning \"%s\"", + firstp); Errors++; return (NULL); } @@ -955,8 +990,11 @@ runinchild(label, e) label, st & 0177); /* if we exited on a QUIT command, complete the process */ - if (st == (EX_QUIT << 8)) + if (WEXITSTATUS(st) == EX_QUIT) + { + disconnect(1, e); finis(); + } return (1); } diff --git a/usr.sbin/sendmail/src/trace.c b/usr.sbin/sendmail/src/trace.c index f27d70b318e..29421eee3c6 100644 --- a/usr.sbin/sendmail/src/trace.c +++ b/usr.sbin/sendmail/src/trace.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)trace.c 8.1 (Berkeley) 6/7/93"; +static char sccsid[] = "@(#)trace.c 8.2 (Berkeley) 3/14/94"; #endif /* not lint */ # include "sendmail.h" @@ -82,8 +82,8 @@ tTsetup(vect, size, defflags) tTflag(s) register char *s; { - int first, last; - register int i; + unsigned int first, last; + register unsigned int i; if (*s == '\0') s = DefFlags; diff --git a/usr.sbin/sendmail/src/udb.c b/usr.sbin/sendmail/src/udb.c index 46b9d658453..dbd1d046c19 100644 --- a/usr.sbin/sendmail/src/udb.c +++ b/usr.sbin/sendmail/src/udb.c @@ -36,15 +36,14 @@ #ifndef lint #ifdef USERDB -static char sccsid [] = "@(#)udb.c 8.4 (Berkeley) 11/25/93 (with USERDB)"; +static char sccsid [] = "@(#)udb.c 8.6 (Berkeley) 3/11/94 (with USERDB)"; #else -static char sccsid [] = "@(#)udb.c 8.4 (Berkeley) 11/25/93 (without USERDB)"; +static char sccsid [] = "@(#)udb.c 8.6 (Berkeley) 3/11/94 (without USERDB)"; #endif #endif #ifdef USERDB -#include <sys/time.h> #include <errno.h> #include <netdb.h> #include <db.h> @@ -571,7 +570,7 @@ _udbx_init() case '*': /* search remote database (expand MX) */ if (*spec == '*') { -#ifdef NAMED_BIND +#if NAMED_BIND nmx = getmxrr(spec + 1, mxhosts, FALSE, &rcode); #else mxhosts[0] = spec + 1; diff --git a/usr.sbin/sendmail/src/usersmtp.c b/usr.sbin/sendmail/src/usersmtp.c index 14b2f7fda72..06acd3f2fc8 100644 --- a/usr.sbin/sendmail/src/usersmtp.c +++ b/usr.sbin/sendmail/src/usersmtp.c @@ -36,9 +36,9 @@ #ifndef lint #ifdef SMTP -static char sccsid[] = "@(#)usersmtp.c 8.17 (Berkeley) 1/5/94 (with SMTP)"; +static char sccsid[] = "@(#)usersmtp.c 8.18 (Berkeley) 1/24/94 (with SMTP)"; #else -static char sccsid[] = "@(#)usersmtp.c 8.17 (Berkeley) 1/5/94 (without SMTP)"; +static char sccsid[] = "@(#)usersmtp.c 8.18 (Berkeley) 1/24/94 (without SMTP)"; #endif #endif /* not lint */ @@ -303,7 +303,10 @@ helo_options(line, m, mci, e) mci->mci_maxsize = atol(p); } else if (strcasecmp(line, "8bitmime") == 0) + { mci->mci_flags |= MCIF_8BITMIME; + mci->mci_flags &= ~MCIF_7BIT; + } else if (strcasecmp(line, "expn") == 0) mci->mci_flags |= MCIF_EXPN; } @@ -536,9 +539,9 @@ smtpdata(m, mci, e) ev = setevent(timeout, datatimeout, 0); /* now output the actual message */ - (*e->e_puthdr)(mci->mci_out, m, e); - putline("\n", mci->mci_out, m); - (*e->e_putbody)(mci->mci_out, m, e, NULL); + (*e->e_puthdr)(mci, e); + putline("\n", mci); + (*e->e_putbody)(mci, e, NULL); clrevent(ev); diff --git a/usr.sbin/sendmail/src/util.c b/usr.sbin/sendmail/src/util.c index 85e0f04dd34..ca7612d7673 100644 --- a/usr.sbin/sendmail/src/util.c +++ b/usr.sbin/sendmail/src/util.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)util.c 8.28 (Berkeley) 1/4/94"; +static char sccsid[] = "@(#)util.c 8.34 (Berkeley) 3/11/94"; #endif /* not lint */ # include "sendmail.h" @@ -644,8 +644,16 @@ dfopen(filename, omode, cmode) fd = open(filename, omode, cmode); if (fd >= 0) break; - if (errno != ENFILE && errno != EINTR) - break; + switch (errno) + { + case ENFILE: /* system file table full */ + case EINTR: /* interrupted syscall */ +#ifdef ETXTBSY + case ETXTBSY: /* Apollo: net file locked */ +#endif + continue; + } + break; } if (fd >= 0 && fstat(fd, &st) >= 0 && S_ISREG(st.st_mode)) { @@ -672,8 +680,7 @@ dfopen(filename, omode, cmode) ** ** Parameters: ** l -- line to put. -** fp -- file to put it onto. -** m -- the mailer used to control output. +** mci -- the mailer connection information. ** ** Returns: ** none @@ -682,16 +689,16 @@ dfopen(filename, omode, cmode) ** output of l to fp. */ -putline(l, fp, m) +putline(l, mci) register char *l; - FILE *fp; - MAILER *m; + register MCI *mci; { register char *p; register char svchar; + int slop = 0; /* strip out 0200 bits -- these can look like TELNET protocol */ - if (bitnset(M_7BITS, m->m_flags)) + if (bitset(MCIF_7BIT, mci->mci_flags)) { for (p = l; (svchar = *p) != '\0'; ++p) if (bitset(0200, svchar)) @@ -709,40 +716,45 @@ putline(l, fp, m) fprintf(TrafficLogFile, "%05d >>> ", getpid()); /* check for line overflow */ - while (m->m_linelimit > 0 && (p - l) > m->m_linelimit) + while (mci->mci_mailer->m_linelimit > 0 && + (p - l + slop) > mci->mci_mailer->m_linelimit) { - register char *q = &l[m->m_linelimit - 1]; + register char *q = &l[mci->mci_mailer->m_linelimit - slop - 1]; svchar = *q; *q = '\0'; - if (l[0] == '.' && bitnset(M_XDOT, m->m_flags)) + if (l[0] == '.' && slop == 0 && + bitnset(M_XDOT, mci->mci_mailer->m_flags)) { - (void) putc('.', fp); + (void) putc('.', mci->mci_out); if (TrafficLogFile != NULL) (void) putc('.', TrafficLogFile); } - fputs(l, fp); - (void) putc('!', fp); - fputs(m->m_eol, fp); + fputs(l, mci->mci_out); + (void) putc('!', mci->mci_out); + fputs(mci->mci_mailer->m_eol, mci->mci_out); + (void) putc(' ', mci->mci_out); if (TrafficLogFile != NULL) - fprintf(TrafficLogFile, "%s!\n%05d >>> ", + fprintf(TrafficLogFile, "%s!\n%05d >>> ", l, getpid()); *q = svchar; l = q; + slop = 1; } /* output last part */ - if (l[0] == '.' && bitnset(M_XDOT, m->m_flags)) + if (l[0] == '.' && slop == 0 && + bitnset(M_XDOT, mci->mci_mailer->m_flags)) { - (void) putc('.', fp); + (void) putc('.', mci->mci_out); if (TrafficLogFile != NULL) (void) putc('.', TrafficLogFile); } if (TrafficLogFile != NULL) fprintf(TrafficLogFile, "%.*s\n", p - l, l); for ( ; l < p; ++l) - (void) putc(*l, fp); - fputs(m->m_eol, fp); + (void) putc(*l, mci->mci_out); + fputs(mci->mci_mailer->m_eol, mci->mci_out); if (*l == '\n') ++l; } while (l[0] != '\0'); @@ -836,6 +848,12 @@ sfgets(buf, siz, fp, timeout, during) register EVENT *ev = NULL; register char *p; + if (fp == NULL) + { + buf[0] = '\0'; + return NULL; + } + /* set the timeout */ if (timeout != 0) { @@ -1309,7 +1327,7 @@ dumpfd(fd, printclosed, logit) p += strlen(p); goto defprint; -#ifdef S_IFIFO +#if defined(S_IFIFO) && (!defined(S_IFSOCK) || S_IFIFO != S_IFSOCK) case S_IFIFO: sprintf(p, "FIFO: "); p += strlen(p); diff --git a/usr.sbin/sendmail/src/version.c b/usr.sbin/sendmail/src/version.c index 3169f6ac937..881c30a2c5d 100644 --- a/usr.sbin/sendmail/src/version.c +++ b/usr.sbin/sendmail/src/version.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)version.c 8.6.1.5 (Berkeley) 1/13/94"; +static char sccsid[] = "@(#)version.c 8.6.7.1 (Berkeley) 3/14/94"; #endif /* not lint */ -char Version[] = "8.6.5"; +char Version[] = "8.6.7"; |
