summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2002-06-03 17:25:45 +0000
committermillert <millert@openbsd.org>2002-06-03 17:25:45 +0000
commitdae5cc1900ec4b6c9bbed5d1844772c1ea9ee17e (patch)
tree4e36e9b534917b55d1fdb994ce5031728f5125cf
parentdetect stereo reception; from jumbo@ (diff)
downloadwireguard-openbsd-dae5cc1900ec4b6c9bbed5d1844772c1ea9ee17e.tar.xz
wireguard-openbsd-dae5cc1900ec4b6c9bbed5d1844772c1ea9ee17e.zip
Update to sendmail-8.12.4
-rw-r--r--gnu/usr.sbin/sendmail/LICENSE4
-rw-r--r--gnu/usr.sbin/sendmail/README50
-rw-r--r--gnu/usr.sbin/sendmail/RELEASE_NOTES101
-rw-r--r--gnu/usr.sbin/sendmail/cf/README83
-rw-r--r--gnu/usr.sbin/sendmail/cf/feature/dnsbl.m410
-rw-r--r--gnu/usr.sbin/sendmail/cf/feature/enhdnsbl.m46
-rw-r--r--gnu/usr.sbin/sendmail/cf/feature/preserve_luser_host.m45
-rw-r--r--gnu/usr.sbin/sendmail/cf/m4/proto.m421
-rw-r--r--gnu/usr.sbin/sendmail/cf/m4/version.m44
-rw-r--r--gnu/usr.sbin/sendmail/contrib/dnsblaccess.m410
-rw-r--r--gnu/usr.sbin/sendmail/contrib/smcontrol.pl16
-rw-r--r--gnu/usr.sbin/sendmail/doc/op/op.me76
-rw-r--r--gnu/usr.sbin/sendmail/include/libmilter/mfapi.h5
-rw-r--r--gnu/usr.sbin/sendmail/include/libsmdb/smdb.h5
-rw-r--r--gnu/usr.sbin/sendmail/include/sendmail/pathnames.h4
-rw-r--r--gnu/usr.sbin/sendmail/include/sm/conf.h9
-rw-r--r--gnu/usr.sbin/sendmail/include/sm/mbdb.h8
-rw-r--r--gnu/usr.sbin/sendmail/include/sm/os/sm_os_freebsd.h8
-rw-r--r--gnu/usr.sbin/sendmail/include/sm/shm.h7
-rw-r--r--gnu/usr.sbin/sendmail/libmilter/docs/sample.html672
-rw-r--r--gnu/usr.sbin/sendmail/libmilter/docs/smfi_addheader.html25
-rw-r--r--gnu/usr.sbin/sendmail/libmilter/docs/smfi_chgheader.html25
-rw-r--r--gnu/usr.sbin/sendmail/libmilter/handler.c10
-rw-r--r--gnu/usr.sbin/sendmail/libmilter/libmilter.h3
-rw-r--r--gnu/usr.sbin/sendmail/libmilter/listener.c119
-rw-r--r--gnu/usr.sbin/sendmail/libmilter/main.c26
-rw-r--r--gnu/usr.sbin/sendmail/libmilter/smfi.c3
-rw-r--r--gnu/usr.sbin/sendmail/libsm/Makefile4
-rw-r--r--gnu/usr.sbin/sendmail/libsm/mbdb.c15
-rw-r--r--gnu/usr.sbin/sendmail/libsm/mpeix.c6
-rw-r--r--gnu/usr.sbin/sendmail/libsm/t-event.c2
-rw-r--r--gnu/usr.sbin/sendmail/libsmdb/smdb.c18
-rw-r--r--gnu/usr.sbin/sendmail/libsmdb/smdb1.c8
-rw-r--r--gnu/usr.sbin/sendmail/libsmdb/smdb2.c12
-rw-r--r--gnu/usr.sbin/sendmail/libsmdb/smndbm.c4
-rw-r--r--gnu/usr.sbin/sendmail/libsmutil/cf.c6
-rw-r--r--gnu/usr.sbin/sendmail/libsmutil/safefile.c22
-rw-r--r--gnu/usr.sbin/sendmail/mail.local/mail.local.c6
-rw-r--r--gnu/usr.sbin/sendmail/mailstats/mailstats.89
-rw-r--r--gnu/usr.sbin/sendmail/mailstats/mailstats.c31
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/Makefile4
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/README6
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS8
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/alias.c21
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/bf.c21
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/bf.h5
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/collect.c4
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/conf.c59
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/conf.h12
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/daemon.c8
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/deliver.c26
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/domain.c8
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/envelope.c4
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/main.c12
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/map.c78
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/mci.c8
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/milter.c25
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/mime.c5
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/queue.c44
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/readcf.c10
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/recipient.c12
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/sasl.c80
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/savemail.c15
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/sendmail.89
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/sendmail.h42
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/sfsasl.c15
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c234
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/stats.c4
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/usersmtp.c301
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/util.c8
-rw-r--r--gnu/usr.sbin/sendmail/sendmail/version.c4
-rw-r--r--gnu/usr.sbin/sendmail/smrsh/smrsh.83
-rw-r--r--gnu/usr.sbin/sendmail/smrsh/smrsh.c42
-rw-r--r--gnu/usr.sbin/sendmail/vacation/vacation.c73
74 files changed, 1946 insertions, 722 deletions
diff --git a/gnu/usr.sbin/sendmail/LICENSE b/gnu/usr.sbin/sendmail/LICENSE
index 0a7b647530e..5418ce41d88 100644
--- a/gnu/usr.sbin/sendmail/LICENSE
+++ b/gnu/usr.sbin/sendmail/LICENSE
@@ -33,7 +33,7 @@ each of the following conditions is met:
forth as paragraph 6 below, in the documentation and/or other materials
provided with the distribution. For the purposes of binary distribution
the "Copyright Notice" refers to the following language:
- "Copyright (c) 1998-2001 Sendmail, Inc. All rights reserved."
+ "Copyright (c) 1998-2002 Sendmail, Inc. All rights reserved."
4. Neither the name of Sendmail, Inc. nor the University of California nor
the names of their contributors may be used to endorse or promote
@@ -76,4 +76,4 @@ each of the following conditions is met:
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-$Revision: 1.5 $, Last updated $Date: 2001/09/11 19:02:47 $
+$Revision: 1.6 $, Last updated $Date: 2002/06/03 17:25:45 $
diff --git a/gnu/usr.sbin/sendmail/README b/gnu/usr.sbin/sendmail/README
index 03430cc884a..e4ce7bc9d4e 100644
--- a/gnu/usr.sbin/sendmail/README
+++ b/gnu/usr.sbin/sendmail/README
@@ -106,6 +106,54 @@ a "chmod go-w $FILE" on each. Also, do a "chmod go-w $DIR" for
each directory in the file's path.
++--------------------------+
+| FILE AND MAP PERMISSIONS |
++--------------------------+
+
+Any application which uses either flock() or fcntl() style locking or
+other APIs that use one of these locking methods (such as open() with
+O_EXLOCK and O_SHLOCK) on files readable by other local untrusted users
+may be susceptible to local denial of service attacks.
+
+File locking is used throughout sendmail for a variety of files
+including aliases, maps, statistics, and the pid file. Any user who
+can open one of these files can prevent sendmail or it's associated
+utilities, e.g., makemap or newaliases, from operating properly. This
+can also affect sendmail's ability to update status files such as
+statistics files. For system which use flock() for file locking, a
+user's ability to obtain an exclusive lock prevents other sendmail
+processes from reading certain files such as alias or map databases.
+
+A workaround for this problem is to protect all sendmail files such
+that they can't be opened by untrusted users. As long as users can
+not open a file, they can not lock it. Since queue files should
+already have restricted permissions, the only files that need
+adjustment are alias, map, statistics, and pid files. These files
+should be owned by root or the trusted user specified in the
+TrustedUser option. Changing the permissions to be only readable and
+writable by that user is sufficient to avoid the denial of service.
+For example, depending on the paths you use, these commands would be
+used:
+
+ chmod 0640 /etc/mail/aliases /etc/mail/aliases.{db,pag,dir}
+ chmod 0640 /etc/mail/*.{db,pag,dir}
+ chmod 0640 /etc/mail/statistics /var/log/sendmail.st
+ chmod 0600 /var/run/sendmail.pid /etc/mail/sendmail.pid
+
+If the permissions 0640 are used, be sure that only trusted users belong
+to the group assigned to those files. Otherwise, files should not even
+be group readable. As of sendmail 8.12.4, the permissions shown above
+are the default permissions for newly created files.
+
+Note that the denial of service on the plain text aliases file
+(/etc/mail/aliases) only prevents newaliases from rebuilding the
+aliases file. The same is true for the database files on systems which
+use fcntl() style locking. Since it does not interfere with normal
+operations, sites may chose to leave these files readable. Also, it is
+not necessary to protect the text files associated with map databases
+as makemap does not lock those files.
+
+
+-----------------------+
| RELATED DOCUMENTATION |
+-----------------------+
@@ -400,4 +448,4 @@ sendmail Source for the sendmail program itself.
test Some test scripts (currently only for compilation aids).
vacation Source for the vacation program. NOT PART OF SENDMAIL!
-$Revision: 1.7 $, Last updated $Date: 2001/10/01 17:18:28 $
+$Revision: 1.8 $, Last updated $Date: 2002/06/03 17:25:45 $
diff --git a/gnu/usr.sbin/sendmail/RELEASE_NOTES b/gnu/usr.sbin/sendmail/RELEASE_NOTES
index 9b80c193037..15ad3a2bff3 100644
--- a/gnu/usr.sbin/sendmail/RELEASE_NOTES
+++ b/gnu/usr.sbin/sendmail/RELEASE_NOTES
@@ -1,11 +1,104 @@
SENDMAIL RELEASE NOTES
- $Sendmail: RELEASE_NOTES,v 8.1296 2002/04/05 19:17:34 ca Exp $
+ $Sendmail: RELEASE_NOTES,v 8.1336 2002/06/03 13:21:25 ca Exp $
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.12.4/8.12.4 2002/06/03
+ SECURITY: Inherent limitations in the UNIX file locking model
+ can leave systems open to a local denial of service
+ attack. Be sure to read the "FILE AND MAP PERMISSIONS"
+ section of the top level README for more information.
+ Problem noted by lumpy.
+ Use TempFileMode (defaults to 0600) for the permissions of PidFile
+ instead of 0644.
+ Change the default file permissions for new alias database files
+ from 0644 to 0640. This can be overridden at compile time
+ by setting the DBMMODE macro.
+ Fix a potential core dump problem if the environment variable
+ NAME is set. Problem noted by Beth A. Chaney of
+ Purdue University.
+ Expand macros before passing them to libmilter. Problem noted
+ by Jose Marcio Martins da Cruz of Ecole Nationale
+ Superieure des Mines de Paris.
+ Rewind the df (message body) before truncating it when libmilter
+ replaces the body of a message. Problem noted by Gisle Aas
+ of Active State.
+ Change SMTP reply code for AUTH failure from 500 to 535 and the
+ initial zero-length response to "=" per RFC 2554. Patches
+ from Kenneth Murchison of Oceana Matrix Ltd.
+ Do not try to fix broken message/rfc822 MIME attachments by
+ inserting a MIME-Version: header when MaxMimeHeaderLength
+ is set and no 8 to 7 bit conversion is needed. Based on
+ patch from Rehor Petr of ICZ (Czech Republic).
+ Do not log "did not issue MAIL/EXPN/VRFY/ETRN" if the connection
+ is rejected anyway. Noted by Chris Loelke.
+ Mention the submission mail queue in the mailq man page. Requested
+ by Bill Fenner of AT&T.
+ Set ${msg_size} macro when reading a message from the command line
+ or the queue.
+ Detach from shared memory before dropping privileges back to
+ user who started sendmail.
+ If AllowBogusHELO is set to false (default) then also complain if
+ the argument to HELO/EHLO contains white space. Suggested
+ by Seva Gluschenko of Cronyx Plus.
+ Allow symbolicly linked forward files in writable directory paths
+ if both ForwardFileInUnsafeDirPath and
+ LinkedForwardFileInWritableDir DontBlameSendmail options
+ are set. Problem noted by Werner Spirk of
+ Leibniz-Rechenzentrum Munich.
+ Portability:
+ Operating systems that lack the ftruncate() call will not
+ be able to use Milter's body replacement feature.
+ This only affects Altos, Maxion, and MPE/iX.
+ Digital UNIX 5.0 has changed flock() semantics to be
+ non-compliant. Problem noted by Martin Mokrejs of
+ Charles University in Prague.
+ The sparc64 port of FreeBSD 5.0 now supports shared
+ memory.
+ CONFIG: FEATURE(`preserve_luser_host') needs the macro map.
+ Problem noted by Andrzej Filip.
+ CONFIG: Using 'local:' as a mailertable value with
+ FEATURE(`preserve_luser_host') and LUSER_RELAY caused mail
+ to be misaddressed. Problem noted by Andrzej Filip.
+ CONFIG: Provide a workaround for DNS based rejection lists that
+ fail for AAAA queries. Problem noted by Chris Boyd.
+ CONFIG: Accept the machine's hostname as resolvable when checking
+ the sender address. This allows locally submitted mail to
+ be accepted if the machine isn't connected to a nameserver
+ and doesn't have an /etc/hosts entry for itself. Problem
+ noted by Robert Watson of the TrustedBSD Project.
+ CONFIG: Use deferred expansion for checking the ${deliveryMode}
+ macro in case the SMTP VERB command is used. Problem
+ noted by Bryan Costales.
+ CONFIG: Avoid a duplicate '@domain' virtusertable lookup if no
+ matches are found. Fix from Andrzej Filip.
+ CONFIG: Fix wording in default dnsbl rejection message. Suggested
+ by Lou Katz of Metron Computerware, Ltd.
+ CONFIG: Add mailer cyrusv2 for Cyrus V2. Contributed by
+ Kenneth Murchison of Oceana Matrix Ltd.
+ CONTRIB: Fix wording in default dnsblaccess rejection message to
+ match dnsbl change.
+ DEVTOOLS: Add new option for access mode of statistics file,
+ confSTMODE, which specifies the permissions when initially
+ installing the sendmail statistics file.
+ LIBMILTER: Mark the listening socket as close-on-exec in case
+ a user's filter starts other applications.
+ LIBSM: Allow the MBDB initialize, lookup, and/or terminate
+ functions in SmMbdbTypes to be set to NULL.
+ MAKEMAP: Change the default file permissions for new databases from
+ 0644 to 0640. This can be overridden at compile time
+ by setting the DBMMODE macro.
+ SMRSH: Fix man page bug: replace SMRSH_CMDBIN with SMRSH_CMDDIR.
+ Problem noted by Dave Alden of Ohio State University.
+ VACATION: When listing the vacation database (-l), don't show
+ bogus timestamps for excluded (-x) addresses. Problem
+ noted by Bryan Costales.
+ New Files:
+ cf/mailer/cyrusv2.m4
+
8.12.3/8.12.3 2002/04/05
NOTICE: In general queue files should not be moved if queue groups
are used. In previous versions this could cause mail
@@ -110,7 +203,7 @@ summary of the changes in that release.
command).
Portability:
Check LDAP_API_VERSION to determine if ldap_memfree() is
- availble.
+ available.
Define HPUX10 when building on HP-UX 10.X. That platform
now gets the proper _PATH_SENDMAIL and SMRSH_CMDDIR
settings. Patch from Elias Halldor Agustsson of
@@ -159,8 +252,8 @@ summary of the changes in that release.
DEVTOOLS: Add dependency generation for test programs.
LIBMILTER: Remove conversion of port number for the socket
structure that is passed to xxfi_connect(). Notice:
- this fix requires that sendmail and libmilter have both
- this change, mixing versions may lead to wrong port
+ this fix requires that sendmail and libmilter both have
+ this change; mixing versions may lead to wrong port
values depending on the endianness of the involved systems.
Problem noted by Gisle Aas of ActiveState.
LIBMILTER: If smfi_setreply() sets a custom reply code of '4XX' but
diff --git a/gnu/usr.sbin/sendmail/cf/README b/gnu/usr.sbin/sendmail/cf/README
index 62c9bae1873..91d5290f405 100644
--- a/gnu/usr.sbin/sendmail/cf/README
+++ b/gnu/usr.sbin/sendmail/cf/README
@@ -453,6 +453,19 @@ CYRUS_BB_MAILER_FLAGS [u] The flags used by the cyrusbb mailer.
The flags lsDFMnP are always included.
CYRUS_BB_MAILER_ARGS [deliver -e -m $u] The arguments passed
to deliver cyrusbb mail.
+CYRUSV2_MAILER_FLAGS [A@/:|m] The flags used by the cyrusv2 mailer. The
+ flags lsDFMnqXz are always included.
+CYRUSV2_MAILER_MAXMSGS [undefined] If defined, the maximum number of
+ messages to deliver in a single connection for the
+ cyrusv2 mailer.
+CYRUSV2_MAILER_MAXRCPTS [undefined] If defined, the maximum number of
+ recipients to deliver in a single connection for the
+ cyrusv2 mailer.
+CYRUSV2_MAILER_ARGS [FILE /var/imap/socket/lmtp] The arguments passed
+ to the cyrusv2 mailer. This can be used to
+ change the name of the Unix domain socket, or
+ to switch to delivery via TCP (e.g., `TCP $h lmtp')
+CYRUSV2_MAILER_QGRP [undefined] The queue group for the cyrusv2 mailer.
confEBINDIR [/usr/libexec] The directory for executables.
Currently used for FEATURE(`local_lmtp') and
FEATURE(`smrsh').
@@ -634,6 +647,14 @@ cyrus The cyrus and cyrusbb mailers. The cyrus mailer delivers to
cyrus mailbox if the mailbox's ACL permits. The cyrus
mailer must be defined after the local mailer.
+cyrusv2 The mailer for Cyrus v2.x. The cyrusv2 mailer delivers to
+ local cyrus users via LMTP. This mailer can make use of the
+ "user+detail@local.host" syntax (see
+ FEATURE(`preserve_local_plus_detail')); it will deliver the
+ mail to the user's "detail" mailbox if the mailbox's ACL
+ permits. The cyrusv2 mailer must be defined after the
+ local mailer.
+
qpage A mailer for QuickPage, a pager interface. See
http://www.qpage.org/ for further information.
@@ -1084,16 +1105,15 @@ promiscuous_relay
MASQUERADE_DOMAIN_FILE, see below).
relay_entire_domain
- By default, only hosts listed as RELAY in the access db
- will be allowed to relay. This option also allows any
- host in your domain as defined by class {m}.
- Notice: make sure that your domain is not just a top level
- domain, e.g., com. This can happen if you give your
- host a name like example.com instead of host.example.com.
+ This option allows any host in your domain as defined by
+ class {m} to use your server for relaying. Notice: make
+ sure that your domain is not just a top level domain,
+ e.g., com. This can happen if you give your host a name
+ like example.com instead of host.example.com.
relay_hosts_only
By default, names that are listed as RELAY in the access
- db and class {R} are domain names, not host names.
+ db and class {R} are treated as domain names, not host names.
For example, if you specify ``foo.com'', then mail to or
from foo.com, abc.foo.com, or a.very.deep.domain.foo.com
will all be accepted for relaying. This feature changes
@@ -1120,8 +1140,8 @@ relay_mail_from
relaying can be allowed just based on the domain portion
of the sender address. This feature should only be used if
absolutely necessary as the sender address can be easily
- forged. Use of this feature requires the "From:" tag be
- prepended to the key in the access map; see the discussion
+ forged. Use of this feature requires the "From:" tag to
+ be used for the key in the access map; see the discussion
of tags and FEATURE(`relay_mail_from') in the section on
anti-spam configuration control.
@@ -1203,6 +1223,16 @@ dnsbl Turns on rejection of hosts found in an DNS based rejection
to query different DNS based rejection lists. See also
enhdnsbl for an enhanced version.
+ Some DNS based rejection lists cause failures if asked
+ for AAAA records. If your sendmail version is compiled
+ with IPv6 support (NETINET6) and you experience this
+ problem, add
+
+ define(`DNSBL_MAP', `dns -R A')
+
+ before the first use of this feature. Alternatively you
+ can use enhdnsbl instead (see below).
+
NOTE: The default DNS blacklist, blackholes.mail-abuse.org,
is a service offered by the Mail Abuse Prevention System
(MAPS). As of July 31, 2001, MAPS is a subscription
@@ -1293,6 +1323,15 @@ msp Defines config file for Message Submission Program.
Some more hints about possible changes can be found below
in the section MESSAGE SUBMISSION PROGRAM.
+ Note: if localhost doesn't resolve to the IP address
+ of your local system (127.0.0.1 or ::1 for IPv6),
+ then you either need to fix your hostname resolution
+ (localhost and localhost.YOUR.DOMAIN should resolve
+ to that address by convention) or you need to specify
+ the IP address as argument, e.g.,
+
+ FEATURE(`msp', `[127.0.0.1]')
+
queuegroup A simple example how to select a queue group based
on the full e-mail address or the domain of the
recipient. Selection is done via entries in the
@@ -3212,7 +3251,7 @@ more careful about checking for security problems than previous
versions, but there are some things that you still need to watch
for. In particular:
-* Make sure the aliases file isn't writable except by trusted
+* Make sure the aliases file is not writable except by trusted
system personnel. This includes both the text and database
version.
@@ -3517,18 +3556,18 @@ confTO_HOSTSTATUS Timeout.hoststatus
information (see below).
confTO_RESOLVER_RETRANS Timeout.resolver.retrans
[varies] Sets the resolver's
- retransmition time interval (in
+ retransmission time interval (in
seconds). Sets both
Timeout.resolver.retrans.first and
Timeout.resolver.retrans.normal.
confTO_RESOLVER_RETRANS_FIRST Timeout.resolver.retrans.first
[varies] Sets the resolver's
- retransmition time interval (in
+ retransmission time interval (in
seconds) for the first attempt to
deliver a message.
confTO_RESOLVER_RETRANS_NORMAL Timeout.resolver.retrans.normal
[varies] Sets the resolver's
- retransmition time interval (in
+ retransmission time interval (in
seconds) for all resolver lookups
except the first delivery attempt.
confTO_RESOLVER_RETRY Timeout.resolver.retry
@@ -4018,10 +4057,24 @@ absolutely sure you need them. Options you may want to change
include:
- confTRUSTED_USERS, FEATURE(`use_ct_file'), and confCT_FILE for
- avoiding X-Authorization warnings.
+ avoiding X-Authentication warnings.
- confTIME_ZONE to change it from the default `USE_TZ'.
- confDELIVERY_MODE is set to interactive in msp.m4 instead
of the default background mode.
+- FEATURE(stickyhost) and LOCAL_RELAY to send unqualified addresses
+ to the LOCAL_RELAY instead of the default relay.
+- confRAND_FILE if you use STARTTLS and sendmail is not compiled with
+ the flag HASURANDOM.
+
+The MSP performs hostname canonicalization by default. As also
+explained in sendmail/SECURITY, mail may end up for various DNS
+related reasons in the MSP queue. This problem can be minimized by
+using
+
+ FEATURE(`nocanonify', `canonify_hosts')
+ define(`confDIRECT_SUBMISSION_MODIFIERS', `C')
+
+See the discussion about nocanonify for possible side effects.
Some things are not intended to work with the MSP. These include
features that influence the delivery process (e.g., mailertable,
@@ -4258,4 +4311,4 @@ M4 DIVERSIONS
8 DNS based blacklists
9 special local rulesets (1 and 2)
-$Revision: 1.12 $, Last updated $Date: 2002/04/18 00:49:26 $
+$Revision: 1.13 $, Last updated $Date: 2002/06/03 17:25:45 $
diff --git a/gnu/usr.sbin/sendmail/cf/feature/dnsbl.m4 b/gnu/usr.sbin/sendmail/cf/feature/dnsbl.m4
index cd869c04359..ab4c5b79e30 100644
--- a/gnu/usr.sbin/sendmail/cf/feature/dnsbl.m4
+++ b/gnu/usr.sbin/sendmail/cf/feature/dnsbl.m4
@@ -1,6 +1,6 @@
divert(-1)
#
-# Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+# Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
@@ -9,16 +9,18 @@ divert(-1)
#
#
+dnl 8.13: ifdef(`DNSBL_MAP', `', `define(`DNSBL_MAP', `dns -R A')')
+ifdef(`DNSBL_MAP', `', `define(`DNSBL_MAP', `host')')
divert(0)
ifdef(`_DNSBL_R_',`dnl',`dnl
-VERSIONID(`$Sendmail: dnsbl.m4,v 8.26 2001/11/12 16:04:14 ca Exp $')
+VERSIONID(`$Sendmail: dnsbl.m4,v 8.28 2002/05/19 21:22:40 gshapiro Exp $')
define(`_DNSBL_R_',`')
LOCAL_CONFIG
# map for DNS based blacklist lookups
-Kdnsbl host -T<TMP>ifdef(`DNSBL_MAP_OPT',` DNSBL_MAP_OPT')')
+Kdnsbl DNSBL_MAP -T<TMP>ifdef(`DNSBL_MAP_OPT',` DNSBL_MAP_OPT')')
divert(-1)
define(`_DNSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`blackholes.mail-abuse.org',_ARG_)')dnl
-define(`_DNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Mail from " $`'&{client_addr} " refused by blackhole site '_DNSBL_SRV_`"',`_ARG2_')')dnl
+define(`_DNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Rejected: " $`'&{client_addr} " listed at '_DNSBL_SRV_`"',`_ARG2_')')dnl
define(`_DNSBL_MSG_TMP_', `ifelse(_ARG3_,`t',`"451 Temporary lookup failure of " $`'&{client_addr} " at '_DNSBL_SRV_`"',`_ARG3_')')dnl
divert(8)
# DNS based IP address spam list _DNSBL_SRV_
diff --git a/gnu/usr.sbin/sendmail/cf/feature/enhdnsbl.m4 b/gnu/usr.sbin/sendmail/cf/feature/enhdnsbl.m4
index 6f807c06a87..86b03a3e6df 100644
--- a/gnu/usr.sbin/sendmail/cf/feature/enhdnsbl.m4
+++ b/gnu/usr.sbin/sendmail/cf/feature/enhdnsbl.m4
@@ -1,6 +1,6 @@
divert(-1)
#
-# Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+# Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
@@ -11,7 +11,7 @@ divert(-1)
divert(0)
ifdef(`_EDNSBL_R_',`dnl',`dnl
-VERSIONID(`$Sendmail: enhdnsbl.m4,v 1.7 2001/07/22 18:02:52 ca Exp $')
+VERSIONID(`$Sendmail: enhdnsbl.m4,v 1.9 2002/05/19 21:27:29 gshapiro Exp $')
LOCAL_CONFIG
define(`_EDNSBL_R_',`')dnl
# map for enhanced DNS based blacklist lookups
@@ -19,7 +19,7 @@ Kednsbl dns -R A -a. -T<TMP> -r`'ifdef(`EDNSBL_TO',`EDNSBL_TO',`5')
')
divert(-1)
define(`_EDNSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`blackholes.mail-abuse.org',_ARG_)')dnl
-define(`_EDNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Mail from " $`'&{client_addr} " refused by blackhole site '_EDNSBL_SRV_`"',`_ARG2_')')dnl
+define(`_EDNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Rejected: " $`'&{client_addr} " listed at '_EDNSBL_SRV_`"',`_ARG2_')')dnl
define(`_EDNSBL_MSG_TMP_', `ifelse(_ARG3_,`t',`"451 Temporary lookup failure of " $`'&{client_addr} " at '_EDNSBL_SRV_`"',`_ARG3_')')dnl
define(`_EDNSBL_MATCH_', `ifelse(len(X`'_ARG4_),`1',`$`'+',_ARG4_)')dnl
divert(8)
diff --git a/gnu/usr.sbin/sendmail/cf/feature/preserve_luser_host.m4 b/gnu/usr.sbin/sendmail/cf/feature/preserve_luser_host.m4
index 6f67c266b81..600a0894bb5 100644
--- a/gnu/usr.sbin/sendmail/cf/feature/preserve_luser_host.m4
+++ b/gnu/usr.sbin/sendmail/cf/feature/preserve_luser_host.m4
@@ -1,6 +1,6 @@
divert(-1)
#
-# Copyright (c) 2000 Sendmail, Inc. and its suppliers.
+# Copyright (c) 2000, 2002 Sendmail, Inc. and its suppliers.
# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
@@ -10,10 +10,11 @@ divert(-1)
#
divert(0)
-VERSIONID(`$Sendmail: preserve_luser_host.m4,v 1.2 2000/11/10 18:50:30 ca Exp $')
+VERSIONID(`$Sendmail: preserve_luser_host.m4,v 1.3 2002/04/14 13:22:58 ca Exp $')
divert(-1)
ifdef(`LUSER_RELAY', `',
`errprint(`*** LUSER_RELAY should be defined before FEATURE(`preserve_luser_host')
')')
define(`_PRESERVE_LUSER_HOST_', `1')
+define(`_NEED_MACRO_MAP_', `1')
diff --git a/gnu/usr.sbin/sendmail/cf/m4/proto.m4 b/gnu/usr.sbin/sendmail/cf/m4/proto.m4
index 08b887b7ec8..66578994f11 100644
--- a/gnu/usr.sbin/sendmail/cf/m4/proto.m4
+++ b/gnu/usr.sbin/sendmail/cf/m4/proto.m4
@@ -13,7 +13,7 @@ divert(-1)
#
divert(0)
-VERSIONID(`$Sendmail: proto.m4,v 8.639 2002/04/02 23:42:42 gshapiro Exp $')
+VERSIONID(`$Sendmail: proto.m4,v 8.646 2002/05/19 21:22:40 gshapiro Exp $')
# level CF_LEVEL config file format
V`'CF_LEVEL/ifdef(`VENDOR_NAME', `VENDOR_NAME', `Berkeley')
@@ -1057,8 +1057,9 @@ R<@> $+ + $+ < @ $+ . > $: < $(virtuser + + @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1
dnl +*@domain
R<@> $+ + $* < @ $+ . > $: < $(virtuser + * @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
dnl @domain if +detail exists
-R<@> $+ + $* < @ $+ . > $: < $(virtuser @ $3 $@ $1 $@ $2 $@ +$2 $: @ $) > $1 + $2 < @ $3 . >
-dnl without +detail (or no match)
+dnl if no match, change marker to prevent a second @domain lookup
+R<@> $+ + $* < @ $+ . > $: < $(virtuser @ $3 $@ $1 $@ $2 $@ +$2 $: ! $) > $1 + $2 < @ $3 . >
+dnl without +detail
R<@> $+ < @ $+ . > $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
dnl no match
R<@> $+ $: $1
@@ -1178,6 +1179,7 @@ R$+ $: $1 $| $&h $| $&{Host} check h and {Host}
R$+ $| $| $: $(macro {Host} $@ $) $1 no h or {Host}
R$+ $| $| $+ $: $1 h not set, {Host} set
R$+ $| +$* $| $* $: $1 h is +detail, {Host} set
+R$+ $| $* @ $+ $| $* $: $(macro {Host} $@ @$3 $) $1 set {Host} to host in h
R$+ $| $+ $| $* $: $(macro {Host} $@ @$2 $) $1 set {Host} to h
')dnl
@@ -1433,6 +1435,7 @@ R<$+@$+> <> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1 $5 @ $2')
R<$+> <$=w> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1
R<$+> <> <$+> <$+> <$*> $@ $>Parse0 $>canonify $1
+
# if mailRoutingAddress and non-local mailHost,
# relay to mailHost with new mailRoutingAddress
ifelse(_LDAP_ROUTE_DETAIL_, `_PRESERVE_', `dnl
@@ -1449,6 +1452,7 @@ R<$+> <$+> <$+> <$+> <$*> $>LDAPMailertable <$2> $>canonify $1',
# return original address
R<> <$=w> <$+> <$+> <$*> $@ $2
+
# if no mailRoutingAddress and non-local mailHost,
# relay to mailHost with original address
ifdef(`_MAILER_TABLE_', `dnl
@@ -1685,7 +1689,7 @@ R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
SBasic_check_relay
# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
+R$* $: < $&{deliveryMode} > $1
R< d > $* $@ deferred
R< $* > $* $: $2
@@ -1715,7 +1719,7 @@ dnl workspace: ignored...
R$* $: $&{client_addr}
R$-.$-.$-.$- $: <?> $(host $4.$3.$2.$1._RBL_. $: OK $)
R<?>OK $: OKSOFAR
-R<?>$+ $#error $@ 5.7.1 $: "550 Mail from " $&{client_addr} " refused by blackhole site _RBL_"',
+R<?>$+ $#error $@ 5.7.1 $: "550 Rejected: " $&{client_addr} " listed at _RBL_"',
`dnl')
undivert(8)
@@ -1731,7 +1735,7 @@ R$* $| $* $@ $>"Basic_check_mail" $1
SBasic_check_mail
# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
+R$* $: < $&{deliveryMode} > $1
R< d > $* $@ deferred
R< $* > $* $: $2
@@ -1798,6 +1802,8 @@ R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
R<?> $* < @ $* $=P > $: <OK> $1 < @ $2 $3 >
dnl workspace <mark> CanonicalAddress where mark is ? or OK
+dnl A sender address with my local host name ($j) is safe
+R<?> $* < @ $j > $: <OK> $1 < @ $j >
ifdef(`_ACCEPT_UNRESOLVABLE_DOMAINS_',
`R<?> $* < @ $+ > $: <_RES_OK_> $1 < @ $2 > ... unresolvable OK',
`R<?> $* < @ $+ > $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 >
@@ -1873,7 +1879,7 @@ SBasic_check_rcpt
R<> $#error $@ nouser $: "553 User address required"
R$@ $#error $@ nouser $: "553 User address required"
# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
+R$* $: < $&{deliveryMode} > $1
R< d > $* $@ deferred
R< $* > $* $: $2
@@ -2096,6 +2102,7 @@ R$=R $* $@ RELAY relayable IP address
ifdef(`_ACCESS_TABLE_', `dnl
R$* $: $>A <$1> <?> <+ Connect> <$1>
R<RELAY> $* $@ RELAY relayable IP address
+R<REJECT> $* $@ REJECT rejected IP address
ifdef(`_ATMPF_', `R<_ATMPF_> $* $#TEMP $@ 4.3.0 $: "451 Temporary system failure. Please try again later."', `dnl')
R<$*> <$*> $: $2', `dnl')
R$* $: [ $1 ] put brackets around it...
diff --git a/gnu/usr.sbin/sendmail/cf/m4/version.m4 b/gnu/usr.sbin/sendmail/cf/m4/version.m4
index 2500d095340..57fc892012d 100644
--- a/gnu/usr.sbin/sendmail/cf/m4/version.m4
+++ b/gnu/usr.sbin/sendmail/cf/m4/version.m4
@@ -11,8 +11,8 @@ divert(-1)
# the sendmail distribution.
#
#
-VERSIONID(`$Sendmail: version.m4,v 8.89 2002/04/04 22:20:08 ca Exp $')
+VERSIONID(`$Sendmail: version.m4,v 8.92 2002/05/31 18:53:59 ca Exp $')
#
divert(0)
# Configuration version number
-DZ8.12.3`'ifdef(`confCF_VERSION', `/confCF_VERSION')
+DZ8.12.4`'ifdef(`confCF_VERSION', `/confCF_VERSION')
diff --git a/gnu/usr.sbin/sendmail/contrib/dnsblaccess.m4 b/gnu/usr.sbin/sendmail/contrib/dnsblaccess.m4
index fc56e7bca53..c03b9274c0c 100644
--- a/gnu/usr.sbin/sendmail/contrib/dnsblaccess.m4
+++ b/gnu/usr.sbin/sendmail/contrib/dnsblaccess.m4
@@ -1,6 +1,6 @@
divert(-1)
#
-# Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+# Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers.
# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
@@ -37,7 +37,7 @@ dnl ##
dnl ## and suppose that your access map contains the entries
dnl ##
dnl ## bogus.tag:127.0.0.2 REJECT
-dnl ## bogus.tag:127.0.0.3 error:dialup mail from %1 rejected by %2
+dnl ## bogus.tag:127.0.0.3 error:dialup mail from %1: listed at %2
dnl ## bogus.tag:127.0.0.4 OK
dnl ## bogus.tag:127 REJECT
dnl ## bogus.tag: OK
@@ -50,7 +50,7 @@ dnl ## A-record for this lookup, then the mail is treated as if the
dnl ## HACK line were not present. If the lookup returns 127.0.0.2,
dnl ## then a default message rejects the mail. If it returns
dnl ## 127.0.0.3, then the message
-dnl ## "dialup mail from 123.45.6.7 rejected by rbl.bogus.org"
+dnl ## "dialup mail from 123.45.6.7: listed at rbl.bogus.org"
dnl ## is used to reject the mail. If it returns 127.0.0.4, the
dnl ## mail is processed as if there were no HACK line. If the
dnl ## address returned is something else beginning with 127.*, the
@@ -59,7 +59,7 @@ dnl ## address returned does not begin 127, then the mail is
dnl ## processed as if the HACK line were not present.
divert(0)
-VERSIONID(`$Sendmail: dnsblaccess.m4,v 1.2 2001/07/23 00:24:04 ca Exp $')
+VERSIONID(`$Sendmail: dnsblaccess.m4,v 1.5 2002/05/19 21:30:06 gshapiro Exp $')
ifdef(`_ACCESS_TABLE_', `dnl',
`errprint(`*** ERROR: dnsblaccess requires FEATURE(`access_db')
')')
@@ -71,7 +71,7 @@ Kednsbl dns -R A -a. -T<TMP> -r`'ifdef(`EDNSBL_TO',`EDNSBL_TO',`5')
')
divert(-1)
define(`_EDNSBL_SRV_', `ifelse(len(X`'_ARG_),`1',`blackholes.mail-abuse.org',_ARG_)')dnl
-define(`_EDNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Mail from " $`'&{client_addr} " refused by blackhole site '_EDNSBL_SRV_`"',`_ARG2_')')dnl
+define(`_EDNSBL_MSG_', `ifelse(len(X`'_ARG2_),`1',`"550 Rejected: " $`'&{client_addr} " listed at '_EDNSBL_SRV_`"',`_ARG2_')')dnl
define(`_EDNSBL_MSG_TMP_', `ifelse(_ARG3_,`t',`"451 Temporary lookup failure of " $`'&{client_addr} " at '_EDNSBL_SRV_`"',`_ARG3_')')dnl
define(`_EDNSBL_KEY_', `ifelse(len(X`'_ARG4_),`1',`dnsblaccess',_ARG4_)')dnl
divert(8)
diff --git a/gnu/usr.sbin/sendmail/contrib/smcontrol.pl b/gnu/usr.sbin/sendmail/contrib/smcontrol.pl
index a69fb278ea4..4987460e4d4 100644
--- a/gnu/usr.sbin/sendmail/contrib/smcontrol.pl
+++ b/gnu/usr.sbin/sendmail/contrib/smcontrol.pl
@@ -379,6 +379,22 @@ elsif (lc($command) eq "help")
{
$status = &help($control);
}
+elsif (lc($command) eq "mstat")
+{
+ $status = &do_command($control, "mstat");
+ if (not defined $status)
+ {
+ # Not responding on control channel, query via SMTP
+ if (&sendmail_running)
+ {
+ $daemonStatus = "Sendmail is running but not answering status queries.";
+ }
+ else
+ {
+ $daemonStatus = "Sendmail does not appear to be running.";
+ }
+ }
+}
else
{
die "Unrecognized command $command\n";
diff --git a/gnu/usr.sbin/sendmail/doc/op/op.me b/gnu/usr.sbin/sendmail/doc/op/op.me
index b50e26a4e92..02a64852b87 100644
--- a/gnu/usr.sbin/sendmail/doc/op/op.me
+++ b/gnu/usr.sbin/sendmail/doc/op/op.me
@@ -9,7 +9,7 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Sendmail: op.me,v 8.600 2002/03/06 16:00:27 ca Exp $
+.\" $Sendmail: op.me,v 8.607 2002/05/22 19:58:33 gshapiro Exp $
.\"
.\" eqn op.me | pic | troff -me
.\"
@@ -88,7 +88,7 @@ Sendmail, Inc.
.de Ve
Version \\$2
..
-.Ve $Revision: 1.12 $
+.Ve $Revision: 1.13 $
.rm Ve
.sp
For Sendmail Version 8.12
@@ -597,7 +597,7 @@ It should be set-group-ID smmsp as described in
sendmail/SECURITY.
For security reasons,
/, /usr, and /usr/\*(SD
-should be owned by root, mode 755\**.
+should be owned by root, mode 0755\**.
.(f
\**Some vendors ship them owned by bin;
this creates a security hole that is not actually related to
@@ -707,7 +707,7 @@ tree.
The directory
.i /var/spool/mqueue
should be created to hold the mail queue.
-This directory should be mode 700
+This directory should be mode 0700
and owned by root.
.pp
The actual path of this directory
@@ -758,7 +758,7 @@ or different queue group declarations.
The directory
.i /var/spool/clientmqueue
should be created to hold the mail queue.
-This directory should be mode 770
+This directory should be mode 0770
and owned by user smmsp, group smmsp.
.pp
The actual path of this directory
@@ -807,6 +807,15 @@ is defined in the
option of the
.i sendmail.cf
file.
+.pp
+The permissions of the alias file and the database versions
+should be 0640 to prevent local denial of service attacks
+as explained in the top level
+.b README
+in the sendmail distribution.
+If the permissions 0640 are used, be sure that only trusted users belong
+to the group assigned to those files. Otherwise, files should not even
+be group readable.
.sh 3 "/etc/rc or /etc/init.d/sendmail"
.pp
It will be necessary to start up the
@@ -933,7 +942,7 @@ you should create the file
.q /etc/mail/statistics :
.(b
cp /dev/null /etc/mail/statistics
-chmod 644 /etc/mail/statistics
+chmod 0600 /etc/mail/statistics
.)b
This file does not grow.
It is printed with the program
@@ -958,6 +967,43 @@ flag
will print the contents of the mail queue;
see below).
This should be a link to /usr/\*(SD/sendmail.
+.sh 3 "sendmail.pid"
+.pp
+.i sendmail
+stores its current pid in the file specifed by the
+.b PidFile
+option (default is _PATH_SENDMAILPID).
+.i sendmail
+uses
+.b TempFileMode
+(which defaults to 0600) as
+the permissions of that file
+to prevent local denial of service attacks
+as explained in the top level
+.b README
+in the sendmail distribution.
+If the file already exists, then it might be necessary to
+change the permissions accordingly, e.g.,
+.(b
+chmod 0600 /var/run/sendmail.pid
+.)b
+.sh 3 "Map Files"
+.pp
+To prevent local denial of service attacks
+as explained in the top level
+.b README
+in the sendmail distribution,
+the permissions of map files created by
+.i makemap
+should be 0640.
+The use of 0640 implies that only trusted users belong to the group
+assigned to those files.
+If those files already exist, then it might be necessary to
+change the permissions accordingly, e.g.,
+.(b
+cd /etc/mail
+chmod 0640 *.db *.pag *.dir
+.)b
.sh 1 "NORMAL OPERATIONS"
.sh 2 "The System Log"
.pp
@@ -1162,7 +1208,7 @@ recipients.
Notice: if multiple queue groups are used, do
.b not
move queue files around, e.g., into a different queue directory.
-This may have wierd effects and can cause mail not to be delivered.
+This may have weird effects and can cause mail not to be delivered.
Queue files and directories should be treated as opaque
and should not be manipulated directly.
.sh 3 "Queue Runs"
@@ -1279,7 +1325,7 @@ To do this,
it is acceptable to move the entire queue directory:
.(b
cd /var/spool
-mv mqueue omqueue; mkdir mqueue; chmod 700 mqueue
+mv mqueue omqueue; mkdir mqueue; chmod 0700 mqueue
.)b
You should then kill the existing daemon
(since it will still be processing in the old queue directory)
@@ -3325,7 +3371,7 @@ by using $r, $s, or $f.
If you create a directory such as /var/forward,
it should be mode 1777
(that is, the sticky bit should be set).
-Users should create the files mode 644.
+Users should create the files mode 0644.
Note that you must use the
ForwardFileInUnsafeDirPath and
ForwardFileInUnsafeDirPathSafe
@@ -3336,10 +3382,10 @@ This might also be used as a denial of service attack
(users could create forward files for other users);
a better approach might be to create
/var/forward
-mode 755
+mode 0755
and create empty files for each user,
owned by that user,
-mode 644.
+mode 0644.
If you do this, you don't have to set the DontBlameSendmail options
indicated above.
.sh 2 "Free Space"
@@ -7580,8 +7626,10 @@ Currently there are no other flags available.
[F]
The file mode for transcript files, files to which
.i sendmail
-delivers directly, and files in the
-.b HostStatusDirectory .
+delivers directly, files in the
+.b HostStatusDirectory ,
+and
+.b StatusFile .
It is interpreted in octal by default.
Defaults to 0600.
.ip Timeout.\fItype\fP=\|\fItimeout\fP
@@ -10579,7 +10627,7 @@ replace it with a blank sheet for double-sided output.
.\".sz 10
.\"Eric Allman
.\".sp
-.\"Version $Revision: 1.12 $
+.\"Version $Revision: 1.13 $
.\".ce 0
.bp 3
.ce
diff --git a/gnu/usr.sbin/sendmail/include/libmilter/mfapi.h b/gnu/usr.sbin/sendmail/include/libmilter/mfapi.h
index 5a6fa5a5044..2c9df203497 100644
--- a/gnu/usr.sbin/sendmail/include/libmilter/mfapi.h
+++ b/gnu/usr.sbin/sendmail/include/libmilter/mfapi.h
@@ -7,7 +7,7 @@
* the sendmail distribution.
*
*
- * $Sendmail: mfapi.h,v 8.41 2002/03/22 21:36:12 gshapiro Exp $
+ * $Sendmail: mfapi.h,v 8.42 2002/04/30 23:52:23 msk Exp $
*/
/*
@@ -106,6 +106,9 @@ struct smfiDesc
sfsistat (*xxfi_close) SM__P((SMFICTX *));
};
+#if _FFR_SMFI_OPENSOCKET
+LIBMILTER_API int smfi_opensocket __P((void));
+#endif /* _FFR_SMFI_OPENSOCKET */
LIBMILTER_API int smfi_register __P((struct smfiDesc));
LIBMILTER_API int smfi_main __P((void));
LIBMILTER_API int smfi_setbacklog __P((int));
diff --git a/gnu/usr.sbin/sendmail/include/libsmdb/smdb.h b/gnu/usr.sbin/sendmail/include/libsmdb/smdb.h
index 488b1c94ab3..93abc1c0246 100644
--- a/gnu/usr.sbin/sendmail/include/libsmdb/smdb.h
+++ b/gnu/usr.sbin/sendmail/include/libsmdb/smdb.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $Sendmail: smdb.h,v 8.38 2001/11/19 19:30:03 gshapiro Exp $
+ * $Sendmail: smdb.h,v 8.40 2002/05/24 23:20:14 gshapiro Exp $
*
*/
@@ -34,7 +34,6 @@
*/
#define SMDB_MAX_USER_NAME_LEN 1024
-#define SMDB_MAX_NAME_LEN 1024
/*
** This file defines the abstraction for database lookups. It is pretty
diff --git a/gnu/usr.sbin/sendmail/include/sendmail/pathnames.h b/gnu/usr.sbin/sendmail/include/sendmail/pathnames.h
index 361b4b7e4d2..66dfb31b5cc 100644
--- a/gnu/usr.sbin/sendmail/include/sendmail/pathnames.h
+++ b/gnu/usr.sbin/sendmail/include/sendmail/pathnames.h
@@ -9,7 +9,7 @@
* the sendmail distribution.
*
*
- * $Sendmail: pathnames.h,v 8.35 2001/03/23 22:09:44 ca Exp $
+ * $Sendmail: pathnames.h,v 8.36 2002/04/09 22:40:26 gshapiro Exp $
*/
#ifndef SM_PATHNAMES_H
@@ -37,7 +37,7 @@
# endif /* ! _PATH_SENDMAIL */
# ifndef _PATH_MAILDIR
-# define _PATH_MAILDIR "/var/spool/mail"
+# define _PATH_MAILDIR "/var/spool/mail"
# endif /* ! _PATH_MAILDIR */
# ifndef _PATH_LOCTMP
diff --git a/gnu/usr.sbin/sendmail/include/sm/conf.h b/gnu/usr.sbin/sendmail/include/sm/conf.h
index d6d5a6252a3..bf96ba93dde 100644
--- a/gnu/usr.sbin/sendmail/include/sm/conf.h
+++ b/gnu/usr.sbin/sendmail/include/sm/conf.h
@@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
- * $Sendmail: conf.h,v 1.87 2002/04/02 08:11:52 gshapiro Exp $
+ * $Sendmail: conf.h,v 1.88 2002/05/01 16:09:41 gshapiro Exp $
*/
/*
@@ -609,7 +609,12 @@ extern long dgux_inet_addr();
# define GIDSET_T gid_t
# define SM_INT32 int /* 32bit integer */
# ifndef HASFLOCK
-# define HASFLOCK 1 /* has flock(2) call */
+# include <standards.h>
+# if _XOPEN_SOURCE+0 >= 400
+# define HASFLOCK 0 /* 5.0 and later has bad flock(2) call */
+# else /* _XOPEN_SOURCE+0 >= 400 */
+# define HASFLOCK 1 /* has flock(2) call */
+# endif /* _XOPEN_SOURCE+0 >= 400 */
# endif /* ! HASFLOCK */
# define LA_TYPE LA_ALPHAOSF
# define SFS_TYPE SFS_STATVFS /* use <sys/statvfs.h> statfs() impl */
diff --git a/gnu/usr.sbin/sendmail/include/sm/mbdb.h b/gnu/usr.sbin/sendmail/include/sm/mbdb.h
index f25d85c713d..975b4b64482 100644
--- a/gnu/usr.sbin/sendmail/include/sm/mbdb.h
+++ b/gnu/usr.sbin/sendmail/include/sm/mbdb.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $Sendmail: mbdb.h,v 1.4 2001/03/08 03:23:08 ca Exp $
+ * $Sendmail: mbdb.h,v 1.6 2002/05/24 20:50:14 gshapiro Exp $
*/
#ifndef SM_MBDB_H
@@ -30,8 +30,8 @@ typedef struct
gid_t mbdb_gid;
char mbdb_name[MBDB_MAXNAME];
char mbdb_fullname[MBDB_MAXNAME];
- char mbdb_homedir[PATH_MAX + 1];
- char mbdb_shell[PATH_MAX + 1];
+ char mbdb_homedir[PATH_MAX];
+ char mbdb_shell[PATH_MAX];
} SM_MBDB_T;
extern int sm_mbdb_initialize __P((char *));
diff --git a/gnu/usr.sbin/sendmail/include/sm/os/sm_os_freebsd.h b/gnu/usr.sbin/sendmail/include/sm/os/sm_os_freebsd.h
index 282607773f2..994742448ae 100644
--- a/gnu/usr.sbin/sendmail/include/sm/os/sm_os_freebsd.h
+++ b/gnu/usr.sbin/sendmail/include/sm/os/sm_os_freebsd.h
@@ -6,7 +6,7 @@
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $Sendmail: sm_os_freebsd.h,v 1.10 2002/03/10 22:41:03 gshapiro Exp $
+ * $Sendmail: sm_os_freebsd.h,v 1.11 2002/04/15 17:17:05 gshapiro Exp $
*/
/*
@@ -31,11 +31,7 @@
#endif
#ifndef SM_CONF_SHM
-# ifdef __sparc64__
-# define SM_CONF_SHM 0
-# else /* __sparc64__ */
-# define SM_CONF_SHM 1
-# endif /* __sparc64__ */
+# define SM_CONF_SHM 1
#endif /* SM_CONF_SHM */
#ifndef SM_CONF_SEM
# define SM_CONF_SEM 1
diff --git a/gnu/usr.sbin/sendmail/include/sm/shm.h b/gnu/usr.sbin/sendmail/include/sm/shm.h
index 6efbfbc57e6..7fdbbaf0e8b 100644
--- a/gnu/usr.sbin/sendmail/include/sm/shm.h
+++ b/gnu/usr.sbin/sendmail/include/sm/shm.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $Sendmail: shm.h,v 1.7 2001/04/20 15:21:55 ca Exp $
+ * $Sendmail: shm.h,v 1.8 2002/04/10 23:11:35 ca Exp $
*/
#ifndef SM_SHM_H
@@ -24,8 +24,7 @@
/* return value for failed shmget() */
# define SM_SHM_NULL ((void *) -1)
-# define SM_SHM_NO_ID (-1)
-# define SM_NO_SHM(id) ((id) < 0)
+# define SM_SHM_NO_ID (-2)
extern void *sm_shmstart __P((key_t, int , int , int *, bool));
extern int sm_shmstop __P((void *, int, bool));
diff --git a/gnu/usr.sbin/sendmail/libmilter/docs/sample.html b/gnu/usr.sbin/sendmail/libmilter/docs/sample.html
index 7e997040832..879258c39df 100644
--- a/gnu/usr.sbin/sendmail/libmilter/docs/sample.html
+++ b/gnu/usr.sbin/sendmail/libmilter/docs/sample.html
@@ -18,397 +18,461 @@ options:
</center>
<hr>
<pre>
-#include "mfapi.h"
-
+#include &lt;sys/types.h&gt;
+#include &lt;sys/stat.h&gt;
+#include &lt;errno.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
-#include &lt;sys/types.h&gt;
-#include &lt;sys/stat.h&gt;
#include &lt;sysexits.h&gt;
#include &lt;unistd.h&gt;
-#ifndef bool
-#define bool char
-#define TRUE 1
-#define FALSE 0
-#endif
-extern int errno;
+#include "libmilter/mfapi.h"
+
+#ifndef bool
+# define bool int
+# define TRUE 1
+# define FALSE 0
+#endif /* ! bool */
struct mlfiPriv
{
- char *mlfi_fname;
- char *mlfi_connectfrom;
- char *mlfi_helofrom;
- FILE *mlfi_fp;
+ char *mlfi_fname;
+ char *mlfi_connectfrom;
+ char *mlfi_helofrom;
+ FILE *mlfi_fp;
};
-#define MLFIPRIV ((struct mlfiPriv *) <a href="smfi_getpriv.html">smfi_getpriv</a>(ctx))
+#define MLFIPRIV ((struct mlfiPriv *) <a href="smfi_getpriv.html">smfi_getpriv</a>(ctx))
+
+extern sfsistat mlfi_cleanup(SMFICTX *, bool);
-extern sfsistat mlfi_cleanup(SMFICTX *, bool);
/* recipients to add and reject (set with -a and -r options) */
-char *add, *reject;
+char *add = NULL;
+char *reject = NULL;
sfsistat
<a href="xxfi_connect.html">mlfi_connect</a>(ctx, hostname, hostaddr)
- SMFICTX *ctx;
- char *hostname;
- _SOCK_ADDR *hostaddr;
+ SMFICTX *ctx;
+ char *hostname;
+ _SOCK_ADDR *hostaddr;
{
- struct mlfiPriv *priv;
- char *ident;
-
- /* allocate some private memory */
- priv = malloc(sizeof *priv);
- if (priv == NULL)
- {
- /* can't accept this message right now */
- return SMFIS_TEMPFAIL;
- }
- memset(priv, '\0', sizeof *priv);
-
- /* save the private data */
- <a href="smfi_setpriv.html">smfi_setpriv</a>(ctx, priv);
-
- ident = <a href="smfi_getsymval.html">smfi_getsymval</a>(ctx, "_");
- if(!ident) ident = "???";
- if(!(priv-&gt;mlfi_connectfrom = strdup(ident))) {
- return SMFIS_TEMPFAIL;
- }
- /* Continue processing. */
- return SMFIS_CONTINUE;
+ struct mlfiPriv *priv;
+ char *ident;
+
+ /* allocate some private memory */
+ priv = malloc(sizeof *priv);
+ if (priv == NULL)
+ {
+ /* can't accept this message right now */
+ return SMFIS_TEMPFAIL;
+ }
+ memset(priv, '\0', sizeof *priv);
+
+ /* save the private data */
+ <a href="smfi_setpriv.html">smfi_setpriv</a>(ctx, priv);
+
+ ident = <a href="smfi_getsymval.html">smfi_getsymval</a>(ctx, "_");
+ if (ident == NULL)
+ ident = "???";
+ if ((priv-&gt;mlfi_connectfrom = strdup(ident)) == NULL)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
+
+ /* continue processing */
+ return SMFIS_CONTINUE;
}
sfsistat
<a href="xxfi_helo.html">mlfi_helo</a>(ctx, helohost)
- SMFICTX *ctx;
- char *helohost;
+ SMFICTX *ctx;
+ char *helohost;
{
- char *tls;
- char *buf;
- struct mlfiPriv *priv = MLFIPRIV;
- tls = <a href="smfi_getsymval.html">smfi_getsymval</a>(ctx, "{tls_version}");
- if(!tls) tls = "No TLS";
- if(!helohost) helohost = "???";
- if(!(buf = (char*)malloc(strlen(tls) + strlen(helohost) + 3))) {
- return SMFIS_TEMPFAIL;
- }
- sprintf(buf, "%s, %s", helohost, tls);
- if(priv-&gt;mlfi_helofrom)
- free(priv-&gt;mlfi_helofrom);
- priv-&gt;mlfi_helofrom = buf;
- /* Continue processing. */
- return SMFIS_CONTINUE;
+ size_t len;
+ char *tls;
+ char *buf;
+ struct mlfiPriv *priv = MLFIPRIV;
+
+ tls = <a href="smfi_getsymval.html">smfi_getsymval</a>(ctx, "{tls_version}");
+ if (tls == NULL)
+ tls = "No TLS";
+ if (helohost == NULL)
+ helohost = "???";
+ len = strlen(tls) + strlen(helohost) + 3;
+ if ((buf = (char*) malloc(len)) == NULL)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
+ snprintf(buf, len, "%s, %s", helohost, tls);
+ if (priv-&gt;mlfi_helofrom != NULL)
+ free(priv-&gt;mlfi_helofrom);
+ priv-&gt;mlfi_helofrom = buf;
+
+ /* continue processing */
+ return SMFIS_CONTINUE;
}
sfsistat
<a href="xxfi_envfrom.html">mlfi_envfrom</a>(ctx, argv)
- SMFICTX *ctx;
- char **argv;
+ SMFICTX *ctx;
+ char **argv;
{
- struct mlfiPriv *priv = MLFIPRIV;
- char *mailaddr = <a href="smfi_getsymval.html">smfi_getsymval</a>(ctx, "{mail_addr}");
- int argc = 0;
-
- /* open a file to store this message */
- priv-&gt;mlfi_fname = strdup("/tmp/msg.XXXXXX");
- mkstemp(priv-&gt;mlfi_fname);
- if (priv-&gt;mlfi_fname == NULL)
- return SMFIS_TEMPFAIL;
- if ((priv-&gt;mlfi_fp = fopen(priv-&gt;mlfi_fname, "w+")) == NULL)
- {
- free(priv-&gt;mlfi_fname);
- return SMFIS_TEMPFAIL;
- }
-
- /* count the arguments */
- while(*argv++) ++argc;
- /* log the connection information we stored earlier: */
- if(fprintf(priv-&gt;mlfi_fp, "Connect from %s (%s)\n\n",
- priv-&gt;mlfi_helofrom, priv-&gt;mlfi_connectfrom) == EOF) {
- (void) mlfi_cleanup(ctx, FALSE);
- return SMFIS_TEMPFAIL;
- }
- /* log the sender */
- if(fprintf(priv-&gt;mlfi_fp, "FROM %s (%d argument%s)\n",
- mailaddr?mailaddr:"???", argc,
- (argc == 1)?"":"s")
- == EOF) {
- (void) mlfi_cleanup(ctx, FALSE);
- return SMFIS_TEMPFAIL;
- }
- /* continue processing */
- return SMFIS_CONTINUE;
+ struct mlfiPriv *priv = MLFIPRIV;
+ char *mailaddr = <a href="smfi_getsymval.html">smfi_getsymval</a>(ctx, "{mail_addr}");
+ int argc = 0;
+
+ /* open a file to store this message */
+ if ((priv-&gt;mlfi_fname = strdup("/tmp/msg.XXXXXX")) == NULL)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
+
+ if (mkstemp(priv-&gt;mlfi_fname) == -1)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
+
+ if ((priv-&gt;mlfi_fp = fopen(priv-&gt;mlfi_fname, "w+")) == NULL)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
+
+ /* count the arguments */
+ while (*argv++ != NULL)
+ ++argc;
+
+ /* log the connection information we stored earlier: */
+ if (fprintf(priv-&gt;mlfi_fp, "Connect from %s (%s)\n\n",
+ priv-&gt;mlfi_helofrom, priv-&gt;mlfi_connectfrom) == EOF)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
+ /* log the sender */
+ if (fprintf(priv-&gt;mlfi_fp, "FROM %s (%d argument%s)\n",
+ mailaddr ? mailaddr : "???", argc,
+ (argc == 1) ? "" : "s") == EOF)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
+
+ /* continue processing */
+ return SMFIS_CONTINUE;
}
sfsistat
<a href="xxfi_envrcpt.html">mlfi_envrcpt</a>(ctx, argv)
- SMFICTX *ctx;
- char **argv;
+ SMFICTX *ctx;
+ char **argv;
{
- struct mlfiPriv *priv = MLFIPRIV;
- char *rcptaddr = <a href="smfi_getsymval.html">smfi_getsymval</a>(ctx, "{rcpt_addr}");
- int argc = 0;
- /* count the arguments */
- while(*argv++) ++argc;
- /* log this recipient */
- if(reject && rcptaddr && (strcmp(rcptaddr, reject) == 0)) {
- if(fprintf(priv-&gt;mlfi_fp, "RCPT %s -- REJECTED\n", rcptaddr)
- == EOF) {
- (void) mlfi_cleanup(ctx, FALSE);
- return SMFIS_TEMPFAIL;
+ struct mlfiPriv *priv = MLFIPRIV;
+ char *rcptaddr = <a href="smfi_getsymval.html">smfi_getsymval</a>(ctx, "{rcpt_addr}");
+ int argc = 0;
+
+ /* count the arguments */
+ while (*argv++ != NULL)
+ ++argc;
+
+ /* log this recipient */
+ if (reject != NULL && rcptaddr != NULL &&
+ (strcasecmp(rcptaddr, reject) == 0))
+ {
+ if (fprintf(priv-&gt;mlfi_fp, "RCPT %s -- REJECTED\n",
+ rcptaddr) == EOF)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
+ return SMFIS_REJECT;
+ }
+ if (fprintf(priv-&gt;mlfi_fp, "RCPT %s (%d argument%s)\n",
+ rcptaddr ? rcptaddr : "???", argc,
+ (argc == 1) ? "" : "s") == EOF)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
}
- return SMFIS_REJECT;
- }
- if(fprintf(priv-&gt;mlfi_fp, "RCPT %s (%d argument%s)\n",
- rcptaddr?rcptaddr:"???", argc,
- (argc == 1)?"":"s")
- == EOF) {
- (void) mlfi_cleanup(ctx, FALSE);
- return SMFIS_TEMPFAIL;
- }
- /* continue processing */
- return SMFIS_CONTINUE;
+
+ /* continue processing */
+ return SMFIS_CONTINUE;
}
sfsistat
<a href="xxfi_header.html">mlfi_header</a>(ctx, headerf, headerv)
- SMFICTX *ctx;
- char *headerf;
- unsigned char *headerv;
+ SMFICTX *ctx;
+ char *headerf;
+ unsigned char *headerv;
{
- /* write the header to the log file */
- fprintf(MLFIPRIV-&gt;mlfi_fp, "%s: %s\n", headerf, headerv);
+ /* write the header to the log file */
+ if (fprintf(MLFIPRIV-&gt;mlfi_fp, "%s: %s\n", headerf, headerv) == EOF)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
- /* continue processing */
- return SMFIS_CONTINUE;
+ /* continue processing */
+ return SMFIS_CONTINUE;
}
sfsistat
<a href="xxfi_eoh.html">mlfi_eoh</a>(ctx)
- SMFICTX *ctx;
+ SMFICTX *ctx;
{
- /* output the blank line between the header and the body */
- fprintf(MLFIPRIV-&gt;mlfi_fp, "\n");
+ /* output the blank line between the header and the body */
+ if (fprintf(MLFIPRIV-&gt;mlfi_fp, "\n") == EOF)
+ {
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
- /* continue processing */
- return SMFIS_CONTINUE;
+ /* continue processing */
+ return SMFIS_CONTINUE;
}
sfsistat
<a href="xxfi_body.html">mlfi_body</a>(ctx, bodyp, bodylen)
- SMFICTX *ctx;
- unsigned char *bodyp;
- size_t bodylen;
+ SMFICTX *ctx;
+ unsigned char *bodyp;
+ size_t bodylen;
{
- /* output body block to log file */
- int nwritten;
- if ((nwritten = fwrite(bodyp, bodylen, 1, MLFIPRIV-&gt;mlfi_fp)) != 1)
- {
- /* write failed */
- perror("error logging body");
- (void) mlfi_cleanup(ctx, FALSE);
- return SMFIS_TEMPFAIL;
- }
-
- /* continue processing */
- return SMFIS_CONTINUE;
+ struct mlfiPriv *priv = MLFIPRIV;
+
+ /* output body block to log file */
+ if (fwrite(bodyp, bodylen, 1, priv-&gt;mlfi_fp) != 1)
+ {
+ /* write failed */
+ fprintf(stderr, "Couldn't write file %s: %s\n",
+ priv-&gt;mlfi_fname, strerror(errno));
+ (void) mlfi_cleanup(ctx, FALSE);
+ return SMFIS_TEMPFAIL;
+ }
+
+ /* continue processing */
+ return SMFIS_CONTINUE;
}
sfsistat
<a href="xxfi_eom.html">mlfi_eom</a>(ctx)
- SMFICTX *ctx;
+ SMFICTX *ctx;
{
- bool ok = TRUE;
- /* change recipients, if requested */
- if(add)
- ok = ok && (<a href="smfi_addrcpt.html">smfi_addrcpt</a>(ctx, add) == MI_SUCCESS);
- return mlfi_cleanup(ctx, ok);
+ bool ok = TRUE;
+
+ /* change recipients, if requested */
+ if (add != NULL)
+ ok = (<a href="smfi_addrcpt.html">smfi_addrcpt</a>(ctx, add) == MI_SUCCESS);
+ return mlfi_cleanup(ctx, ok);
}
sfsistat
<a href="xxfi_abort.html">mlfi_abort</a>(ctx)
- SMFICTX *ctx;
+ SMFICTX *ctx;
{
- return mlfi_cleanup(ctx, FALSE);
+ return mlfi_cleanup(ctx, FALSE);
}
sfsistat
mlfi_cleanup(ctx, ok)
- SMFICTX *ctx;
- bool ok;
+ SMFICTX *ctx;
+ bool ok;
{
- sfsistat rstat = SMFIS_CONTINUE;
- struct mlfiPriv *priv = MLFIPRIV;
- char *p;
- char host[512];
- char hbuf[1024];
+ sfsistat rstat = SMFIS_CONTINUE;
+ struct mlfiPriv *priv = MLFIPRIV;
+ char *p;
+ char host[512];
+ char hbuf[1024];
- if (priv == NULL)
- return rstat;
+ if (priv == NULL)
+ return rstat;
- /* close the archive file */
- if (priv-&gt;mlfi_fp != NULL && fclose(priv-&gt;mlfi_fp) == EOF)
- {
- /* failed; we have to wait until later */
- fprintf(stderr, "Couldn't close archive file %s: %s\n",
- priv-&gt;mlfi_fname, strerror(errno));
- rstat = SMFIS_TEMPFAIL;
- (void) unlink(priv-&gt;mlfi_fname);
- }
- else if (ok)
- {
- /* add a header to the message announcing our presence */
- if (gethostname(host, sizeof host) &lt; 0)
- strncpy(host, "localhost", sizeof host);
- p = strrchr(priv-&gt;mlfi_fname, '/');
- if (p == NULL)
- p = priv-&gt;mlfi_fname;
+ /* close the archive file */
+ if (priv-&gt;mlfi_fp != NULL && fclose(priv-&gt;mlfi_fp) == EOF)
+ {
+ /* failed; we have to wait until later */
+ fprintf(stderr, "Couldn't close archive file %s: %s\n",
+ priv-&gt;mlfi_fname, strerror(errno));
+ rstat = SMFIS_TEMPFAIL;
+ (void) unlink(priv-&gt;mlfi_fname);
+ }
+ else if (ok)
+ {
+ /* add a header to the message announcing our presence */
+ if (gethostname(host, sizeof host) &lt; 0)
+ snprintf(host, sizeof host, "localhost");
+ p = strrchr(priv-&gt;mlfi_fname, '/');
+ if (p == NULL)
+ p = priv-&gt;mlfi_fname;
+ else
+ p++;
+ snprintf(hbuf, sizeof hbuf, "%s@%s", p, host);
+ if (<a href="smfi_addheader.html">smfi_addheader</a>(ctx, "X-Archived", hbuf) != MI_SUCCESS)
+ {
+ /* failed; we have to wait until later */
+ fprintf(stderr,
+ "Couldn't add header: X-Archived: %s\n",
+ hbuf);
+ ok = FALSE;
+ rstat = SMFIS_TEMPFAIL;
+ (void) unlink(priv-&gt;mlfi_fname);
+ }
+ }
else
- p++;
- snprintf(hbuf, sizeof hbuf, "%s@%s", p, host);
- <a href="smfi_addheader.html">smfi_addheader</a>(ctx, "X-Archived", hbuf);
- }
- else
- {
- /* message was aborted -- delete the archive file */
- fprintf(stderr, "Message aborted. Removing %s\n",
- priv-&gt;mlfi_fname);
- rstat = SMFIS_TEMPFAIL;
- (void) unlink(priv-&gt;mlfi_fname);
- }
-
- /* release private memory */
- free(priv-&gt;mlfi_fname);
-
- /* return status */
- return rstat;
+ {
+ /* message was aborted -- delete the archive file */
+ fprintf(stderr, "Message aborted. Removing %s\n",
+ priv-&gt;mlfi_fname);
+ rstat = SMFIS_TEMPFAIL;
+ (void) unlink(priv-&gt;mlfi_fname);
+ }
+
+ /* release private memory */
+ if (priv-&gt;mlfi_fname != NULL)
+ free(priv-&gt;mlfi_fname);
+
+ /* return status */
+ return rstat;
}
sfsistat
<a href="xxfi_close.html">mlfi_close</a>(ctx)
- SMFICTX *ctx;
+ SMFICTX *ctx;
{
- struct mlfiPriv *priv = MLFIPRIV;
- if(priv-&gt;mlfi_connectfrom)
- free(priv-&gt;mlfi_connectfrom);
- if(priv-&gt;mlfi_helofrom)
- free(priv-&gt;mlfi_helofrom);
- free(priv);
- <a href="smfi_setpriv.html">smfi_setpriv</a>(ctx, NULL);
- return SMFIS_CONTINUE;
+ struct mlfiPriv *priv = MLFIPRIV;
+
+ if (priv == NULL)
+ return SMFIS_CONTINUE;
+ if (priv-&gt;mlfi_connectfrom != NULL)
+ free(priv-&gt;mlfi_connectfrom);
+ if (priv-&gt;mlfi_helofrom != NULL)
+ free(priv-&gt;mlfi_helofrom);
+ free(priv);
+ <a href="smfi_setpriv.html">smfi_setpriv</a>(ctx, NULL);
+ return SMFIS_CONTINUE;
}
struct smfiDesc smfilter =
{
- "SampleFilter", /* filter name */
- SMFI_VERSION, /* version code -- do not change */
- SMFIF_ADDHDRS, /* flags */
- <a href="xxfi_connect.html">mlfi_connect</a>, /* connection info filter */
- <a href="xxfi_helo.html">mlfi_helo</a>, /* SMTP HELO command filter */
- <a href="xxfi_envfrom.html">mlfi_envfrom</a>, /* envelope sender filter */
- <a href="xxfi_envrcpt.html">mlfi_envrcpt</a>, /* envelope recipient filter */
- <a href="xxfi_header.html">mlfi_header</a>, /* header filter */
- <a href="xxfi_eoh.html">mlfi_eoh</a>, /* end of header */
- <a href="xxfi_body.html">mlfi_body</a>, /* body block filter */
- <a href="xxfi_eom.html">mlfi_eom</a>, /* end of message */
- <a href="xxfi_abort.html">mlfi_abort</a>, /* message aborted */
- <a href="xxfi_close.html">mlfi_close</a>, /* connection cleanup */
+ "SampleFilter", /* filter name */
+ SMFI_VERSION, /* version code -- do not change */
+ SMFIF_ADDHDRS, /* flags */
+ <a href="xxfi_connect.html">mlfi_connect</a>, /* connection info filter */
+ <a href="xxfi_helo.html">mlfi_helo</a>, /* SMTP HELO command filter */
+ <a href="xxfi_envfrom.html">mlfi_envfrom</a>, /* envelope sender filter */
+ <a href="xxfi_envrcpt.html">mlfi_envrcpt</a>, /* envelope recipient filter */
+ <a href="xxfi_header.html">mlfi_header</a>, /* header filter */
+ <a href="xxfi_eoh.html">mlfi_eoh</a>, /* end of header */
+ <a href="xxfi_body.html">mlfi_body</a>, /* body block filter */
+ <a href="xxfi_eom.html">mlfi_eom</a>, /* end of message */
+ <a href="xxfi_abort.html">mlfi_abort</a>, /* message aborted */
+ <a href="xxfi_close.html">mlfi_close</a>, /* connection cleanup */
};
-static void
-usage()
+static void
+usage(prog)
+ char *prog;
{
- fprintf(stderr,
- "Usage: sample [-p socket-addr] [-t timeout] [-r reject-addr] \n\
-\t[-a accept-addr]\n");
+ fprintf(stderr,
+ "Usage: %s [-p socket-addr] [-t timeout] [-r reject-addr] [-a add-addr]\n",
+ prog);
}
int
main(argc, argv)
- int argc;
- char *argv[];
+ int argc;
+ char **argv;
{
- int retval;
- char c;
- const char *args = "p:t:r:a:h";
- extern char *optarg;
-
- /* Process command line options */
- while ((c = getopt(argc, argv, args)) != (char)EOF)
- {
- switch (c)
+ int c;
+ const char *args = "p:t:r:a:h";
+ extern char *optarg;
+
+ /* Process command line options */
+ while ((c = getopt(argc, argv, args)) != -1)
+ {
+ switch (c)
+ {
+ case 'p':
+ if (optarg == NULL || *optarg == '\0')
+ {
+ (void) fprintf(stderr, "Illegal conn: %s\n",
+ optarg);
+ exit(EX_USAGE);
+ }
+ if (<a href="smfi_setconn.html">smfi_setconn</a>(optarg) == MI_FAILURE)
+ {
+ (void) fprintf(stderr,
+ "smfi_setconn failed\n");
+ exit(EX_SOFTWARE);
+ }
+
+ /*
+ ** If we're using a local socket, make sure it
+ ** doesn't already exist. Don't ever run this
+ ** code as root!!
+ */
+
+ if (strncasecmp(optarg, "unix:", 5) == 0)
+ unlink(optarg + 5);
+ else if (strncasecmp(optarg, "local:", 6) == 0)
+ unlink(optarg + 6);
+ break;
+
+ case 't':
+ if (optarg == NULL || *optarg == '\0')
+ {
+ (void) fprintf(stderr, "Illegal timeout: %s\n",
+ optarg);
+ exit(EX_USAGE);
+ }
+ if (<a href="smfi_settimeout.html">smfi_settimeout</a>(atoi(optarg)) == MI_FAILURE)
+ {
+ (void) fprintf(stderr,
+ "smfi_settimeout failed\n");
+ exit(EX_SOFTWARE);
+ }
+ break;
+
+ case 'r':
+ if (optarg == NULL)
+ {
+ (void) fprintf(stderr,
+ "Illegal reject rcpt: %s\n",
+ optarg);
+ exit(EX_USAGE);
+ }
+ reject = optarg;
+ break;
+
+ case 'a':
+ if (optarg == NULL)
+ {
+ (void) fprintf(stderr,
+ "Illegal add rcpt: %s\n",
+ optarg);
+ exit(EX_USAGE);
+ }
+ add = optarg;
+ smfilter.xxfi_flags |= SMFIF_ADDRCPT;
+ break;
+
+ case 'h':
+ default:
+ usage(argv[0]);
+ exit(EX_USAGE);
+ }
+ }
+ if (<a href="smfi_register.html">smfi_register</a>(smfilter) == MI_FAILURE)
{
- case 'p':
- if (optarg == NULL || *optarg == '\0')
- {
- (void) fprintf(stderr, "Illegal conn: %s\n",
- optarg);
- exit(EX_USAGE);
- }
- if(<a href="smfi_setconn.html">smfi_setconn</a>(optarg) == MI_FAILURE)
- {
- (void) fputs("smfi_setconn failed", stderr);
- exit(EX_SOFTWARE);
- }
- /*
- ** If we're using a local socket, make sure it doesn't
- ** already exist.
- */
- if(strncmp(optarg, "unix:", 5) == 0)
- unlink(optarg + 5);
- else if(strncmp(optarg, "local:", 6) == 0)
- unlink(optarg + 6);
- break;
-
- case 't':
- if (optarg == NULL || *optarg == '\0')
- {
- (void) fprintf(stderr, "Illegal timeout: %s\n",
- optarg);
- exit(EX_USAGE);
- }
- if(<a href="smfi_settimeout.html">smfi_settimeout</a>(atoi(optarg)) == MI_FAILURE)
- {
- (void) fputs("smfi_settimeout failed", stderr);
- exit(EX_SOFTWARE);
- }
- break;
-
- case 'r':
- if (optarg == NULL)
- {
- (void) fprintf(stderr, "Illegal reject rcpt: %s\n",
- optarg);
- exit(EX_USAGE);
- }
- reject = optarg;
- break;
-
- case 'a':
- if (optarg == NULL)
- {
- (void) fprintf(stderr, "Illegal add rcpt: %s\n",
- optarg);
- exit(EX_USAGE);
- }
- add = optarg;
- smfilter.xxfi_flags |= SMFIF_ADDRCPT;
- break;
- case 'h':
- default:
- usage();
- exit(0);
+ fprintf(stderr, "smfi_register failed\n");
+ exit(EX_UNAVAILABLE);
}
- }
- if (<a href="smfi_register.html">smfi_register</a>(smfilter) == MI_FAILURE)
- {
- fprintf(stderr, "smfi_register failed\n");
- exit(EX_UNAVAILABLE);
- }
- retval = <a href="smfi_main.html">smfi_main</a>();
- return retval;
+ return <a href="smfi_main.html">smfi_main</a>();
}
/* eof */
@@ -416,7 +480,7 @@ main(argc, argv)
</pre>
<hr size="1">
<font size="-1">
-Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
All rights reserved.
<br>
By using this file, you agree to the terms and conditions set
diff --git a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_addheader.html b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_addheader.html
index c6417e26f66..6f852aebf6e 100644
--- a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_addheader.html
+++ b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_addheader.html
@@ -73,18 +73,39 @@ href="smfi_chgheader.html">smfi_chgheader</a>.
<li>Neither the name nor the value of the header is checked for
standards compliance. However, each line of the header must be under
2048 characters and should be under 998 characters. If longer headers
- are needed, make them multiline.
+ are needed, make them multi-line. To make a multi-line header, insert
+ a line feed (ASCII 0x0a, or <tt>\n</tt> in C) followed by at least
+ one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09,
+ or <tt>\t</tt> in C). The line feed should NOT be preceded by a
+ carriage return (ASCII 0x0d); the MTA will add this automatically.
<b>It is the filter writer's responsibility to ensure that no standards
are violated.</b>
</ul>
</td>
</tr>
+<!----------- Example code ---------->
+<tr>
+<th valign="top" align=left>EXAMPLE</th>
+
+<td>
+ <pre>
+ int ret;
+ SMFICTX *ctx;
+
+ ...
+
+ ret = smfi_addheader(ctx, "Content-Type",
+ "multipart/mixed;\n\tboundary=\"foobar\"");
+ </pre>
+</td>
+</tr>
+
</table>
<hr size="1">
<font size="-1">
-Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
All rights reserved.
<br>
By using this file, you agree to the terms and conditions set
diff --git a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_chgheader.html b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_chgheader.html
index 4969674fb80..89ce6f26ebf 100644
--- a/gnu/usr.sbin/sendmail/libmilter/docs/smfi_chgheader.html
+++ b/gnu/usr.sbin/sendmail/libmilter/docs/smfi_chgheader.html
@@ -75,18 +75,39 @@ Otherwise, it returns MI_SUCCESS.
<li>Neither the name nor the value of the header is checked for
standards compliance. However, each line of the header must be under
2048 characters and should be under 998 characters. If longer headers
- are needed, make them multiline.
+ are needed, make them multi-line. To make a multi-line header, insert
+ a line feed (ASCII 0x0a, or <tt>\n</tt> in C) followed by at least
+ one whitespace character such as a space (ASCII 0x20) or tab (ASCII 0x09,
+ or <tt>\t</tt> in C). The line feed should NOT be preceded by a
+ carriage return (ASCII 0x0d); the MTA will add this automatically.
<b>It is the filter writer's responsibility to ensure that no standards
are violated.</b>
</ul>
</td>
</tr>
+<!----------- Example code ---------->
+<tr>
+<th valign="top" align=left>EXAMPLE</th>
+
+<td>
+ <pre>
+ int ret;
+ SMFICTX *ctx;
+
+ ...
+
+ ret = smfi_chgheader(ctx, "Content-Type",
+ "multipart/mixed;\n\tboundary=\"foobar\"");
+ </pre>
+</td>
+</tr>
+
</table>
<hr size="1">
<font size="-1">
-Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
All rights reserved.
<br>
By using this file, you agree to the terms and conditions set
diff --git a/gnu/usr.sbin/sendmail/libmilter/handler.c b/gnu/usr.sbin/sendmail/libmilter/handler.c
index ab5c4f110ad..ba3c5f1211b 100644
--- a/gnu/usr.sbin/sendmail/libmilter/handler.c
+++ b/gnu/usr.sbin/sendmail/libmilter/handler.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: handler.c,v 8.29 2001/11/15 00:17:15 msk Exp $")
+SM_RCSID("@(#)$Sendmail: handler.c,v 8.30 2002/04/29 15:06:48 ca Exp $")
#include "libmilter.h"
@@ -38,9 +38,11 @@ mi_handle_session(ctx)
** detach so resources are free when the thread returns
** if we ever "wait" for threads, this call must be removed
*/
+
if (pthread_detach(ctx->ctx_id) != 0)
- return MI_FAILURE;
- ret = mi_engine(ctx);
+ ret = MI_FAILURE;
+ else
+ ret = mi_engine(ctx);
if (ValidSocket(ctx->ctx_sd))
{
(void) closesocket(ctx->ctx_sd);
diff --git a/gnu/usr.sbin/sendmail/libmilter/libmilter.h b/gnu/usr.sbin/sendmail/libmilter/libmilter.h
index 207ae1f876d..3c6931c79d8 100644
--- a/gnu/usr.sbin/sendmail/libmilter/libmilter.h
+++ b/gnu/usr.sbin/sendmail/libmilter/libmilter.h
@@ -19,7 +19,7 @@
#ifdef _DEFINE
# define EXTERN
# define INIT(x) = x
-SM_IDSTR(MilterlId, "@(#)$Sendmail: libmilter.h,v 8.32 2001/11/29 02:21:02 ca Exp $")
+SM_IDSTR(MilterlId, "@(#)$Sendmail: libmilter.h,v 8.33 2002/04/30 23:52:24 msk Exp $")
#else /* _DEFINE */
# define EXTERN extern
# define INIT(x)
@@ -110,6 +110,7 @@ extern void mi_clean_signals __P((void));
extern struct hostent *mi_gethostbyname __P((char *, int));
extern int mi_inet_pton __P((int, const char *, void *));
extern void mi_closener __P((void));
+extern int mi_opensocket __P((char *, int, int, smfiDesc_ptr));
/* communication functions */
extern char *mi_rd_cmd __P((socket_t, struct timeval *, char *, size_t *, char *));
diff --git a/gnu/usr.sbin/sendmail/libmilter/listener.c b/gnu/usr.sbin/sendmail/libmilter/listener.c
index 2a1fbaaa3fd..30a020ce734 100644
--- a/gnu/usr.sbin/sendmail/libmilter/listener.c
+++ b/gnu/usr.sbin/sendmail/libmilter/listener.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: listener.c,v 8.82 2002/01/22 18:46:47 ca Exp $")
+SM_RCSID("@(#)$Sendmail: listener.c,v 8.85 2002/05/28 18:17:41 gshapiro Exp $")
/*
** listener.c -- threaded network listener
@@ -24,6 +24,58 @@ SM_RCSID("@(#)$Sendmail: listener.c,v 8.82 2002/01/22 18:46:47 ca Exp $")
# endif /* NETINET || NETINET6 */
static smutex_t L_Mutex;
+static int L_family;
+static SOCKADDR_LEN_T L_socksize;
+static socket_t listenfd = INVALID_SOCKET;
+
+static socket_t mi_milteropen __P((char *, int, char *));
+
+/*
+** MI_OPENSOCKET -- create the socket where this filter and the MTA will meet
+**
+** Parameters:
+** conn -- connection description
+** backlog -- listen backlog
+** dbg -- debug level
+** smfi -- filter structure to use
+**
+** Return value:
+** MI_SUCCESS/MI_FAILURE
+*/
+
+int
+mi_opensocket(conn, backlog, dbg, smfi)
+ char *conn;
+ int backlog;
+ int dbg;
+ smfiDesc_ptr smfi;
+{
+ if (smfi == NULL || conn == NULL)
+ return MI_FAILURE;
+
+ if (ValidSocket(listenfd))
+ return MI_SUCCESS;
+
+ if (dbg > 0)
+ {
+ smi_log(SMI_LOG_DEBUG,
+ "%s: Opening listen socket on conn %s",
+ smfi->xxfi_name, conn);
+ }
+ (void) smutex_init(&L_Mutex);
+ (void) smutex_lock(&L_Mutex);
+ listenfd = mi_milteropen(conn, backlog, smfi->xxfi_name);
+ if (!ValidSocket(listenfd))
+ {
+ smi_log(SMI_LOG_FATAL,
+ "%s: Unable to create listening socket on conn %s",
+ smfi->xxfi_name, conn);
+ (void) smutex_unlock(&L_Mutex);
+ return MI_FAILURE;
+ }
+
+ return MI_SUCCESS;
+}
/*
** MI_MILTEROPEN -- setup socket to listen on
@@ -31,8 +83,6 @@ static smutex_t L_Mutex;
** Parameters:
** conn -- connection description
** backlog -- listen backlog
-** socksize -- socksize of created socket
-** family -- family of created socket
** name -- name for logging
**
** Returns:
@@ -47,15 +97,14 @@ static char *sockpath = NULL;
#endif /* NETUNIX */
static socket_t
-mi_milteropen(conn, backlog, socksize, family, name)
+mi_milteropen(conn, backlog, name)
char *conn;
int backlog;
- SOCKADDR_LEN_T *socksize;
- int *family;
char *name;
{
socket_t sock;
int sockopt = 1;
+ int fdflags;
size_t len = 0;
char *p;
char *colon;
@@ -82,17 +131,17 @@ mi_milteropen(conn, backlog, socksize, family, name)
#if NETUNIX
/* default to AF_UNIX */
addr.sa.sa_family = AF_UNIX;
- *socksize = sizeof (struct sockaddr_un);
+ L_socksize = sizeof (struct sockaddr_un);
#else /* NETUNIX */
# if NETINET
/* default to AF_INET */
addr.sa.sa_family = AF_INET;
- *socksize = sizeof addr.sin;
+ L_socksize = sizeof addr.sin;
# else /* NETINET */
# if NETINET6
/* default to AF_INET6 */
addr.sa.sa_family = AF_INET6;
- *socksize = sizeof addr.sin6;
+ L_socksize = sizeof addr.sin6;
# else /* NETINET6 */
/* no protocols available */
smi_log(SMI_LOG_ERR,
@@ -108,21 +157,21 @@ mi_milteropen(conn, backlog, socksize, family, name)
strcasecmp(p, "local") == 0)
{
addr.sa.sa_family = AF_UNIX;
- *socksize = sizeof (struct sockaddr_un);
+ L_socksize = sizeof (struct sockaddr_un);
}
#endif /* NETUNIX */
#if NETINET
else if (strcasecmp(p, "inet") == 0)
{
addr.sa.sa_family = AF_INET;
- *socksize = sizeof addr.sin;
+ L_socksize = sizeof addr.sin;
}
#endif /* NETINET */
#if NETINET6
else if (strcasecmp(p, "inet6") == 0)
{
addr.sa.sa_family = AF_INET6;
- *socksize = sizeof addr.sin6;
+ L_socksize = sizeof addr.sin6;
}
#endif /* NETINET6 */
else
@@ -139,17 +188,17 @@ mi_milteropen(conn, backlog, socksize, family, name)
#if NETUNIX
/* default to AF_UNIX */
addr.sa.sa_family = AF_UNIX;
- *socksize = sizeof (struct sockaddr_un);
+ L_socksize = sizeof (struct sockaddr_un);
#else /* NETUNIX */
# if NETINET
/* default to AF_INET */
addr.sa.sa_family = AF_INET;
- *socksize = sizeof addr.sin;
+ L_socksize = sizeof addr.sin;
# else /* NETINET */
# if NETINET6
/* default to AF_INET6 */
addr.sa.sa_family = AF_INET6;
- *socksize = sizeof addr.sin6;
+ L_socksize = sizeof addr.sin6;
# else /* NETINET6 */
smi_log(SMI_LOG_ERR, "%s: unknown socket type %s",
name, p);
@@ -380,6 +429,16 @@ mi_milteropen(conn, backlog, socksize, family, name)
return INVALID_SOCKET;
}
+ if ((fdflags = fcntl(sock, F_GETFD, 0)) == -1 ||
+ fcntl(sock, F_SETFD, fdflags | FD_CLOEXEC) == -1)
+ {
+ smi_log(SMI_LOG_ERR,
+ "%s: Unable to set close-on-exec: %s", name,
+ sm_errstring(errno));
+ (void) closesocket(sock);
+ return INVALID_SOCKET;
+ }
+
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (void *) &sockopt,
sizeof(sockopt)) == -1)
{
@@ -390,7 +449,7 @@ mi_milteropen(conn, backlog, socksize, family, name)
return INVALID_SOCKET;
}
- if (bind(sock, &addr.sa, *socksize) < 0)
+ if (bind(sock, &addr.sa, L_socksize) < 0)
{
smi_log(SMI_LOG_ERR,
"%s: Unable to bind to port %s: %s",
@@ -429,7 +488,7 @@ mi_milteropen(conn, backlog, socksize, family, name)
}
}
#endif /* NETUNIX */
- *family = addr.sa.sa_family;
+ L_family = addr.sa.sa_family;
return sock;
}
/*
@@ -449,8 +508,6 @@ mi_thread_handle_wrapper(arg)
return (void *) mi_handle_session(arg);
}
-static socket_t listenfd = INVALID_SOCKET;
-
/*
** MI_CLOSENER -- close listen socket
**
@@ -528,6 +585,7 @@ mi_closener()
** dbg -- debug level
** smfi -- filter structure to use
** timeout -- timeout for reads/writes
+** backlog -- listen queue backlog size
**
** Returns:
** MI_SUCCESS -- Exited normally
@@ -584,7 +642,6 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
int backlog;
{
socket_t connfd = INVALID_SOCKET;
- int family = AF_UNSPEC;
int sockopt = 1;
int r;
int ret = MI_SUCCESS;
@@ -595,29 +652,15 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
int save_errno = 0;
sthread_t thread_id;
_SOCK_ADDR cliaddr;
- SOCKADDR_LEN_T socksize;
SOCKADDR_LEN_T clilen;
SMFICTX_PTR ctx;
fd_set readset, excset;
struct timeval chktime;
- if (dbg > 0)
- smi_log(SMI_LOG_DEBUG,
- "%s: Opening listen socket on conn %s",
- smfi->xxfi_name, conn);
- (void) smutex_init(&L_Mutex);
- (void) smutex_lock(&L_Mutex);
- listenfd = mi_milteropen(conn, backlog, &socksize, &family,
- smfi->xxfi_name);
- if (!ValidSocket(listenfd))
- {
- smi_log(SMI_LOG_FATAL,
- "%s: Unable to create listening socket on conn %s",
- smfi->xxfi_name, conn);
- (void) smutex_unlock(&L_Mutex);
+ if (mi_opensocket(conn, backlog, dbg, smfi) == MI_FAILURE)
return MI_FAILURE;
- }
- clilen = socksize;
+
+ clilen = L_socksize;
if (listenfd >= FD_SETSIZE)
{
@@ -698,7 +741,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
# ifdef BSD4_4_SOCKADDR
cliaddr.sa.sa_len == 0 ||
# endif /* BSD4_4_SOCKADDR */
- cliaddr.sa.sa_family != family))
+ cliaddr.sa.sa_family != L_family))
{
(void) closesocket(connfd);
connfd = INVALID_SOCKET;
diff --git a/gnu/usr.sbin/sendmail/libmilter/main.c b/gnu/usr.sbin/sendmail/libmilter/main.c
index 2c843e91402..9573785ed01 100644
--- a/gnu/usr.sbin/sendmail/libmilter/main.c
+++ b/gnu/usr.sbin/sendmail/libmilter/main.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: main.c,v 8.55 2002/02/25 17:54:41 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: main.c,v 8.63 2002/04/30 23:52:24 msk Exp $")
#define _DEFINE 1
#include "libmilter.h"
@@ -93,7 +93,29 @@ smfi_stop()
static int dbg = 0;
static char *conn = NULL;
static int timeout = MI_TIMEOUT;
-static int backlog= MI_SOMAXCONN;
+static int backlog = MI_SOMAXCONN;
+
+#if _FFR_SMFI_OPENSOCKET
+/*
+** SMFI_OPENSOCKET -- try the socket setup to make sure we'll be
+** able to start up
+**
+** Parameters:
+** None.
+**
+** Return:
+** MI_SUCCESS/MI_FAILURE
+*/
+
+int
+smfi_opensocket()
+{
+ if (smfi == NULL || conn == NULL)
+ return MI_FAILURE;
+
+ return mi_opensocket(conn, backlog, dbg, smfi);
+}
+#endif /* _FFR_SMFI_OPENSOCKET */
/*
** SMFI_SETDBG -- set debug level.
diff --git a/gnu/usr.sbin/sendmail/libmilter/smfi.c b/gnu/usr.sbin/sendmail/libmilter/smfi.c
index 5d52fc08db0..5290fe56b01 100644
--- a/gnu/usr.sbin/sendmail/libmilter/smfi.c
+++ b/gnu/usr.sbin/sendmail/libmilter/smfi.c
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: smfi.c,v 8.63 2002/02/07 01:16:13 msk Exp $")
+SM_RCSID("@(#)$Sendmail: smfi.c,v 8.64 2002/04/30 22:22:02 msk Exp $")
#include <sm/varargs.h>
#include "libmilter.h"
@@ -267,6 +267,7 @@ smfi_quarantine(ctx, reason)
** Side Effects:
** none.
*/
+
static int
myisenhsc(s, delim)
const char *s;
diff --git a/gnu/usr.sbin/sendmail/libsm/Makefile b/gnu/usr.sbin/sendmail/libsm/Makefile
index c9f0bd07416..d6737747e49 100644
--- a/gnu/usr.sbin/sendmail/libsm/Makefile
+++ b/gnu/usr.sbin/sendmail/libsm/Makefile
@@ -1,8 +1,8 @@
-# $OpenBSD: Makefile,v 1.2 2001/09/11 19:02:49 millert Exp $
+# $OpenBSD: Makefile,v 1.3 2002/06/03 17:25:46 millert Exp $
LIB= sm
SRCS= assert.c debug.c errstring.c exc.c heap.c match.c rpool.c strdup.c \
- strerror.c strl.c clrerr.c fclose.c feof.c ferror.c fflush.c fget.c \
+ strl.c clrerr.c fclose.c feof.c ferror.c fflush.c fget.c \
fpos.c findfp.c flags.c fopen.c fprintf.c fpurge.c fput.c fread.c \
fscanf.c fseek.c fvwrite.c fwalk.c fwrite.c get.c makebuf.c put.c \
refill.c rewind.c setvbuf.c smstdio.c snprintf.c sscanf.c stdio.c \
diff --git a/gnu/usr.sbin/sendmail/libsm/mbdb.c b/gnu/usr.sbin/sendmail/libsm/mbdb.c
index 20da4410ca3..32f3ebe6b44 100644
--- a/gnu/usr.sbin/sendmail/libsm/mbdb.c
+++ b/gnu/usr.sbin/sendmail/libsm/mbdb.c
@@ -8,7 +8,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: mbdb.c,v 1.36 2002/03/25 18:08:20 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: mbdb.c,v 1.38 2002/04/05 22:59:56 gshapiro Exp $")
#include <sys/param.h>
@@ -113,7 +113,9 @@ sm_mbdb_initialize(mbdb)
if (strlen(t->mbdb_typename) == namelen &&
strncmp(name, t->mbdb_typename, namelen) == 0)
{
- err = t->mbdb_initialize(arg);
+ err = EX_OK;
+ if (t->mbdb_initialize != NULL)
+ err = t->mbdb_initialize(arg);
if (err == EX_OK)
SmMbdbType = t;
return err;
@@ -140,7 +142,8 @@ sm_mbdb_initialize(mbdb)
void
sm_mbdb_terminate()
{
- SmMbdbType->mbdb_terminate();
+ if (SmMbdbType->mbdb_terminate != NULL)
+ SmMbdbType->mbdb_terminate();
}
/*
@@ -162,7 +165,11 @@ sm_mbdb_lookup(name, user)
char *name;
SM_MBDB_T *user;
{
- return SmMbdbType->mbdb_lookup(name, user);
+ int ret = EX_NOUSER;
+
+ if (SmMbdbType->mbdb_lookup != NULL)
+ ret = SmMbdbType->mbdb_lookup(name, user);
+ return ret;
}
/*
diff --git a/gnu/usr.sbin/sendmail/libsm/mpeix.c b/gnu/usr.sbin/sendmail/libsm/mpeix.c
index fbd973f28ee..995834c87e6 100644
--- a/gnu/usr.sbin/sendmail/libsm/mpeix.c
+++ b/gnu/usr.sbin/sendmail/libsm/mpeix.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2001-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: mpeix.c,v 1.4 2001/12/14 23:54:18 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: mpeix.c,v 1.6 2002/05/24 20:50:14 gshapiro Exp $")
#ifdef MPE
/*
@@ -607,7 +607,7 @@ sendmail_mpe_setuid(uid)
uid_t uid;
{
char *cwd;
- char cwd_buf[PATH_MAX+1];
+ char cwd_buf[PATH_MAX + 1];
int result;
extern void GETPRIVMODE __P((void));
extern void GETUSERMODE __P((void));
diff --git a/gnu/usr.sbin/sendmail/libsm/t-event.c b/gnu/usr.sbin/sendmail/libsm/t-event.c
index d45a0e92fea..5fab1aa2d70 100644
--- a/gnu/usr.sbin/sendmail/libsm/t-event.c
+++ b/gnu/usr.sbin/sendmail/libsm/t-event.c
@@ -8,7 +8,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: t-event.c,v 1.9 2002/03/19 00:26:21 ca Exp $")
+SM_RCSID("@(#)$Sendmail: t-event.c,v 1.11 2002/04/25 01:50:25 ca Exp $")
#include <stdio.h>
diff --git a/gnu/usr.sbin/sendmail/libsmdb/smdb.c b/gnu/usr.sbin/sendmail/libsmdb/smdb.c
index 83c1c79b3a4..1d277a0b218 100644
--- a/gnu/usr.sbin/sendmail/libsmdb/smdb.c
+++ b/gnu/usr.sbin/sendmail/libsmdb/smdb.c
@@ -1,5 +1,5 @@
/*
-** Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
+** Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
** All rights reserved.
**
** By using this file, you agree to the terms and conditions set
@@ -8,7 +8,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: smdb.c,v 8.54 2002/04/04 21:32:14 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: smdb.c,v 8.57 2002/05/24 23:09:11 gshapiro Exp $")
#include <fcntl.h>
#include <stdlib.h>
@@ -319,14 +319,14 @@ smdb_lock_file(lock_fd, db_name, mode, sff, extension)
char *extension;
{
int result;
- char file_name[SMDB_MAX_NAME_LEN];
+ char file_name[MAXPATHLEN];
- result = smdb_add_extension(file_name, SMDB_MAX_NAME_LEN, db_name,
+ result = smdb_add_extension(file_name, sizeof file_name, db_name,
extension);
if (result != SMDBE_OK)
return result;
- *lock_fd = safeopen(file_name, mode & ~O_TRUNC, 0644, sff);
+ *lock_fd = safeopen(file_name, mode & ~O_TRUNC, DBMMODE, sff);
if (*lock_fd < 0)
return errno;
@@ -435,9 +435,9 @@ smdb_setup_file(db_name, extension, mode_mask, sff, user_info, stat_info)
{
int st;
int result;
- char db_file_name[SMDB_MAX_NAME_LEN];
+ char db_file_name[MAXPATHLEN];
- result = smdb_add_extension(db_file_name, SMDB_MAX_NAME_LEN, db_name,
+ result = smdb_add_extension(db_file_name, sizeof db_file_name, db_name,
extension);
if (result != SMDBE_OK)
return result;
@@ -474,9 +474,9 @@ smdb_filechanged(db_name, extension, db_fd, stat_info)
struct stat *stat_info;
{
int result;
- char db_file_name[SMDB_MAX_NAME_LEN];
+ char db_file_name[MAXPATHLEN];
- result = smdb_add_extension(db_file_name, SMDB_MAX_NAME_LEN, db_name,
+ result = smdb_add_extension(db_file_name, sizeof db_file_name, db_name,
extension);
if (result != SMDBE_OK)
return result;
diff --git a/gnu/usr.sbin/sendmail/libsmdb/smdb1.c b/gnu/usr.sbin/sendmail/libsmdb/smdb1.c
index 9e9eb7622f9..8aa924c8756 100644
--- a/gnu/usr.sbin/sendmail/libsmdb/smdb1.c
+++ b/gnu/usr.sbin/sendmail/libsmdb/smdb1.c
@@ -8,7 +8,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: smdb1.c,v 8.56 2002/01/21 04:10:44 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: smdb1.c,v 8.58 2002/05/24 23:09:11 gshapiro Exp $")
#include <unistd.h>
#include <stdlib.h>
@@ -446,14 +446,14 @@ smdb_db_open(database, db_name, mode, mode_mask, sff, type, user_info,
BTREEINFO btree_info;
DBTYPE db_type;
struct stat stat_info;
- char db_file_name[SMDB_MAX_NAME_LEN];
+ char db_file_name[MAXPATHLEN];
if (type == NULL ||
(strncmp(SMDB_TYPE_HASH, type, SMDB_TYPE_HASH_LEN) != 0 &&
strncmp(SMDB_TYPE_BTREE, type, SMDB_TYPE_BTREE_LEN) != 0))
return SMDBE_UNKNOWN_DB_TYPE;
- result = smdb_add_extension(db_file_name, SMDB_MAX_NAME_LEN,
+ result = smdb_add_extension(db_file_name, sizeof db_file_name,
db_name, SMDB1_FILE_EXTENSION);
if (result != SMDBE_OK)
return result;
@@ -508,7 +508,7 @@ smdb_db_open(database, db_name, mode, mode_mask, sff, type, user_info,
}
db_type = smdb_type_to_db1_type(type);
- db = dbopen(db_file_name, mode, 0644, db_type, params);
+ db = dbopen(db_file_name, mode, DBMMODE, db_type, params);
if (db != NULL)
{
db_fd = db->fd(db);
diff --git a/gnu/usr.sbin/sendmail/libsmdb/smdb2.c b/gnu/usr.sbin/sendmail/libsmdb/smdb2.c
index 57f58d1fe61..933aa97e61c 100644
--- a/gnu/usr.sbin/sendmail/libsmdb/smdb2.c
+++ b/gnu/usr.sbin/sendmail/libsmdb/smdb2.c
@@ -1,5 +1,5 @@
/*
-** Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
+** Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
** All rights reserved.
**
** By using this file, you agree to the terms and conditions set
@@ -8,7 +8,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: smdb2.c,v 8.69 2001/09/12 21:19:12 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: smdb2.c,v 8.72 2002/05/24 23:09:11 gshapiro Exp $")
#include <fcntl.h>
#include <stdlib.h>
@@ -472,7 +472,7 @@ smdb_db_open_internal(db_name, db_type, db_flags, db_params, db)
db_info.flags |= DB_DUP;
params = &db_info;
}
- return db_open(db_name, db_type, db_flags, 0644, NULL, params, db);
+ return db_open(db_name, db_type, db_flags, DBMMODE, NULL, params, db);
}
# endif /* DB_VERSION_MAJOR == 2 */
@@ -523,7 +523,7 @@ smdb_db_open_internal(db_name, db_type, db_flags, db_params, db)
}
}
- result = (*db)->open(*db, db_name, NULL, db_type, db_flags, 0644);
+ result = (*db)->open(*db, db_name, NULL, db_type, db_flags, DBMMODE);
if (result != 0)
{
(void) (*db)->close(*db, 0);
@@ -581,11 +581,11 @@ smdb_db_open(database, db_name, mode, mode_mask, sff, type, user_info, db_params
DB *db;
DBTYPE db_type;
struct stat stat_info;
- char db_file_name[SMDB_MAX_NAME_LEN];
+ char db_file_name[MAXPATHLEN];
*database = NULL;
- result = smdb_add_extension(db_file_name, SMDB_MAX_NAME_LEN,
+ result = smdb_add_extension(db_file_name, sizeof db_file_name,
db_name, SMDB2_FILE_EXTENSION);
if (result != SMDBE_OK)
return result;
diff --git a/gnu/usr.sbin/sendmail/libsmdb/smndbm.c b/gnu/usr.sbin/sendmail/libsmdb/smndbm.c
index 274f79e1921..6e5a8fdc75b 100644
--- a/gnu/usr.sbin/sendmail/libsmdb/smndbm.c
+++ b/gnu/usr.sbin/sendmail/libsmdb/smndbm.c
@@ -8,7 +8,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: smndbm.c,v 8.51 2002/01/21 04:10:44 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: smndbm.c,v 8.52 2002/05/21 22:30:30 gshapiro Exp $")
#include <fcntl.h>
#include <stdlib.h>
@@ -560,7 +560,7 @@ smdb_ndbm_open(database, db_name, mode, mode_mask, sff, type, user_info,
db->smndbm_lock_fd = lock_fd;
errno = 0;
- dbm = dbm_open(db_name, mode, 0644);
+ dbm = dbm_open(db_name, mode, DBMMODE);
if (dbm == NULL)
{
if (errno == 0)
diff --git a/gnu/usr.sbin/sendmail/libsmutil/cf.c b/gnu/usr.sbin/sendmail/libsmutil/cf.c
index 337ac80e8ae..47ca64c9485 100644
--- a/gnu/usr.sbin/sendmail/libsmutil/cf.c
+++ b/gnu/usr.sbin/sendmail/libsmutil/cf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 2000-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: cf.c,v 8.16 2001/09/11 04:04:55 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: cf.c,v 8.18 2002/05/25 00:09:16 gshapiro Exp $")
#include <sendmail/pathnames.h>
/*
@@ -60,7 +60,7 @@ getcfname(opmode, submitmode, cftype, conffile)
cftype != SM_GET_SENDMAIL_CF))
{
struct stat sbuf;
- static char cf[PATH_MAX];
+ static char cf[MAXPATHLEN];
(void) sm_strlcpyn(cf, sizeof cf, 2, _DIR_SENDMAILCF,
"submit.cf");
diff --git a/gnu/usr.sbin/sendmail/libsmutil/safefile.c b/gnu/usr.sbin/sendmail/libsmutil/safefile.c
index 8da12ea4193..a633d5dadd9 100644
--- a/gnu/usr.sbin/sendmail/libsmutil/safefile.c
+++ b/gnu/usr.sbin/sendmail/libsmutil/safefile.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -15,7 +15,7 @@
#include <sm/io.h>
#include <sm/errstring.h>
-SM_RCSID("@(#)$Sendmail: safefile.c,v 8.121 2001/10/11 21:46:13 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: safefile.c,v 8.124 2002/05/24 20:50:15 gshapiro Exp $")
/*
@@ -58,7 +58,7 @@ safefile(fn, uid, gid, user, flags, mode, st)
bool checkpath;
struct stat stbuf;
struct stat fstbuf;
- char fbuf[MAXPATHLEN + 1];
+ char fbuf[MAXPATHLEN];
if (tTd(44, 4))
sm_dprintf("safefile(%s, uid=%d, gid=%d, flags=%lx, mode=%o):\n",
@@ -406,7 +406,7 @@ safedirpath(fn, uid, gid, user, flags, level, offset)
char *saveptr = NULL;
char *p, *enddir;
register struct group *gr = NULL;
- char s[MAXLINKPATHLEN + 1];
+ char s[MAXLINKPATHLEN];
struct stat stbuf;
/* make sure we aren't in a symlink loop */
@@ -486,15 +486,23 @@ safedirpath(fn, uid, gid, user, flags, level, offset)
/* Follow symlinks */
if (S_ISLNK(stbuf.st_mode))
{
+ int linklen;
char *target;
- char buf[MAXPATHLEN + 1];
+ char buf[MAXPATHLEN];
memset(buf, '\0', sizeof buf);
- if (readlink(s, buf, sizeof buf) < 0)
+ linklen = readlink(s, buf, sizeof buf);
+ if (linklen < 0)
{
ret = errno;
break;
}
+ if (linklen >= sizeof buf)
+ {
+ /* file name too long for buffer */
+ ret = errno = EINVAL;
+ break;
+ }
offset = 0;
if (*buf == '/')
@@ -536,7 +544,7 @@ safedirpath(fn, uid, gid, user, flags, level, offset)
else
{
char *sptr;
- char fullbuf[MAXLINKPATHLEN + 1];
+ char fullbuf[MAXLINKPATHLEN];
sptr = strrchr(s, '/');
if (sptr != NULL)
diff --git a/gnu/usr.sbin/sendmail/mail.local/mail.local.c b/gnu/usr.sbin/sendmail/mail.local/mail.local.c
index 6201a96a4a2..a1470273b04 100644
--- a/gnu/usr.sbin/sendmail/mail.local/mail.local.c
+++ b/gnu/usr.sbin/sendmail/mail.local/mail.local.c
@@ -18,7 +18,7 @@ SM_IDSTR(copyright,
Copyright (c) 1990, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n")
-SM_IDSTR(id, "@(#)$Sendmail: mail.local.c,v 8.238 2002/03/30 07:43:21 geir Exp $")
+SM_IDSTR(id, "@(#)$Sendmail: mail.local.c,v 8.239 2002/05/24 20:56:32 gshapiro Exp $")
#include <stdlib.h>
#include <sm/errstring.h>
@@ -520,7 +520,7 @@ dolmtp()
"Nested MAIL command");
continue;
}
- if (sm_strncasecmp(buf+5, "from:", 5) != 0 ||
+ if (sm_strncasecmp(buf + 5, "from:", 5) != 0 ||
((return_path = parseaddr(buf + 10,
false)) == NULL))
{
@@ -857,7 +857,7 @@ deliver(fd, name)
off_t headerbytes;
int readamount;
#endif /* CONTENTLENGTH */
- char biffmsg[100], buf[8*1024];
+ char biffmsg[100], buf[8 * 1024];
SM_MBDB_T user;
/*
diff --git a/gnu/usr.sbin/sendmail/mailstats/mailstats.8 b/gnu/usr.sbin/sendmail/mailstats/mailstats.8
index 87690db332d..199cd510b50 100644
--- a/gnu/usr.sbin/sendmail/mailstats/mailstats.8
+++ b/gnu/usr.sbin/sendmail/mailstats/mailstats.8
@@ -6,9 +6,9 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Sendmail: mailstats.8,v 8.28 2002/03/19 00:23:23 gshapiro Exp $
+.\" $Sendmail: mailstats.8,v 8.30 2002/04/12 00:42:33 ca Exp $
.\"
-.Dd April 18, 2001
+.Dd April 12, 2002
.Dt MAILSTATS 1
.Os
.Sh NAME
@@ -16,6 +16,7 @@
.Nd display mail statistics
.Sh SYNOPSIS
.Nm mailstats
+.Op Fl c
.Op Fl o
.Op Fl p
.Op Fl P
@@ -68,6 +69,10 @@ The options are as follows:
Read the specified file instead of the default
.Nm sendmail
configuration file.
+.It Fl c
+Try to use submit.cf instead of the default
+.Nm sendmail
+configuration file.
.It Fl f
Read the specified statistics file instead of the statistics file
specified in the
diff --git a/gnu/usr.sbin/sendmail/mailstats/mailstats.c b/gnu/usr.sbin/sendmail/mailstats/mailstats.c
index 3d07d02eab0..05ee3a3f7b5 100644
--- a/gnu/usr.sbin/sendmail/mailstats/mailstats.c
+++ b/gnu/usr.sbin/sendmail/mailstats/mailstats.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -20,7 +20,7 @@ SM_IDSTR(copyright,
Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n")
-SM_IDSTR(id, "@(#)$Sendmail: mailstats.c,v 8.95 2001/12/30 04:59:40 gshapiro Exp $")
+SM_IDSTR(id, "@(#)$Sendmail: mailstats.c,v 8.98 2002/05/24 23:10:15 gshapiro Exp $")
#include <unistd.h>
#include <stddef.h>
@@ -64,7 +64,7 @@ main(argc, argv)
#endif /* _FFR_QUARANTINE */
time_t now;
char mtable[MAXMAILERS][MNAMELEN + 1];
- char sfilebuf[MAXLINE];
+ char sfilebuf[MAXPATHLEN];
char buf[MAXLINE];
struct statistics stats;
extern char *ctime();
@@ -108,7 +108,7 @@ main(argc, argv)
default:
usage:
(void) sm_io_fputs(smioerr, SM_TIME_DEFAULT,
- "usage: mailstats [-C cffile] [-P] [-f stfile] [-o] [-p]\n");
+ "usage: mailstats [-C cffile] [-c] [-P] [-f stfile] [-o] [-p]\n");
exit(EX_USAGE);
}
}
@@ -139,6 +139,15 @@ main(argc, argv)
char *s;
register char *m;
+ b = strchr(buf, '#');
+ if (b == NULL)
+ b = strchr(buf, '\n');
+ if (b == NULL)
+ b = &buf[strlen(buf)];
+ while (isascii(*--b) && isspace(*b))
+ continue;
+ *++b = '\0';
+
b = buf;
switch (*b++)
{
@@ -171,14 +180,6 @@ main(argc, argv)
b);
exit(EX_CONFIG);
}
- b = strchr(sfilebuf, '#');
- if (b == NULL)
- b = strchr(sfilebuf, '\n');
- if (b == NULL)
- b = &sfilebuf[strlen(sfilebuf)];
- while (isascii(*--b) && isspace(*b))
- continue;
- *++b = '\0';
if (sfile == NULL)
sfile = sfilebuf;
@@ -215,10 +216,10 @@ main(argc, argv)
{
(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
"mailstats: no statistics file located\n");
- exit (EX_OSFILE);
+ exit(EX_OSFILE);
}
- fd = open(sfile, O_RDONLY);
+ fd = open(sfile, O_RDONLY, 0600);
if ((fd < 0) || (i = read(fd, &stats, sizeof stats)) < 0)
{
save_errno = errno;
@@ -350,7 +351,7 @@ main(argc, argv)
(void) close(fd);
if (trunc)
{
- fd = open(sfile, O_RDWR | O_TRUNC);
+ fd = open(sfile, O_RDWR | O_TRUNC, 0600);
if (fd >= 0)
(void) close(fd);
}
diff --git a/gnu/usr.sbin/sendmail/sendmail/Makefile b/gnu/usr.sbin/sendmail/sendmail/Makefile
index c1f5de2e080..ab377f29fca 100644
--- a/gnu/usr.sbin/sendmail/sendmail/Makefile
+++ b/gnu/usr.sbin/sendmail/sendmail/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.16 2002/04/18 00:49:28 millert Exp $
+# $OpenBSD: Makefile,v 1.17 2002/06/03 17:25:46 millert Exp $
PROG= sendmail
@@ -30,7 +30,7 @@ ENVDEF+= -D_FFR_USE_SETLOGIN
SRCS= main.c alias.c arpadate.c bf.c collect.c conf.c control.c convtime.c \
daemon.c deliver.c domain.c envelope.c err.c headers.c macro.c map.c \
mci.c milter.c mime.c parseaddr.c queue.c readcf.c recipient.c \
- savemail.c sasl.c sfsasl.c shmticklib.c sm_resolve.c srvrsmtp.c stab.c \
+ sasl.c savemail.c sfsasl.c shmticklib.c sm_resolve.c srvrsmtp.c stab.c \
stats.c sysexits.c timers.c tls.c trace.c udb.c usersmtp.c util.c \
version.c
MAN= aliases.5 mailq.8 newaliases.8 sendmail.8
diff --git a/gnu/usr.sbin/sendmail/sendmail/README b/gnu/usr.sbin/sendmail/sendmail/README
index b7c5b7742a8..a44f048fe94 100644
--- a/gnu/usr.sbin/sendmail/sendmail/README
+++ b/gnu/usr.sbin/sendmail/sendmail/README
@@ -9,7 +9,7 @@
# the sendmail distribution.
#
#
-# $Sendmail: README,v 8.353 2002/04/04 21:39:33 gshapiro Exp $
+# $Sendmail: README,v 8.355 2002/05/22 19:46:26 gshapiro Exp $
#
This directory contains the source files for sendmail(TM).
@@ -601,6 +601,8 @@ REQUIRES_DIR_FSYNC Turn on support for file systems that require to
ReiserFS; it is enabled by default for Linux. An alternative
to this compile time flag is to mount the queue directory
without the -async option, or using chattr +S on Linux.
+DBMMODE The default file permissions to use when creating new
+ database files for maps and aliases. Defaults to 0640.
Generic notice: If you enable a compile time option that needs
libraries or include files that don't come with sendmail or are
@@ -1738,4 +1740,4 @@ util.c Some general purpose routines used by sendmail.
version.c The version number and information about this
version of sendmail.
-(Version $Revision: 1.12 $, last update $Date: 2002/04/18 00:49:28 $ )
+(Version $Revision: 1.13 $, last update $Date: 2002/06/03 17:25:46 $ )
diff --git a/gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS b/gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS
index 3708f99a33a..0ceb8aaf86a 100644
--- a/gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS
+++ b/gnu/usr.sbin/sendmail/sendmail/TRACEFLAGS
@@ -1,5 +1,4 @@
-# $Sendmail: TRACEFLAGS,v 8.35 2001/11/28 01:01:25 gshapiro Exp $
-0, 1 main.c main skip background fork
+# $Sendmail: TRACEFLAGS,v 8.37 2002/05/24 23:37:32 ca Exp $
0, 4 main.c main canonical name, UUCP node name, a.k.a.s
0, 15 main.c main print configuration
0, 44 util.c printav print address of each string
@@ -53,7 +52,7 @@
41 queue.c orderq
42 mci.c mci_get
43 mime.c mime8to7
-44 recipient.c writeable
+44 recipient.c writable
44 safefile.c safefile, safedirpath, filechanged
45 envelope.c setsender
46 envelope.c openxscript
@@ -77,7 +76,6 @@
64 multiple Milter
65 main.c permission checks
66 srvrsmtp.c conformance checks
-67 conf.c signals
69 queue.c scheduling
#if _FFR_QUARANTINE
70 queue.c quarantining
@@ -88,5 +86,7 @@
94,>99 srvrsmtp.c cause commands to fail (for protocol testing)
95 srvrsmtp.c AUTH
95 usersmtp.c AUTH
+96 tls.c Activate SSL_CTX_set_info_callback()
+97 srvrsmtp.c Trace automode settings for I/O
98 * timers
99 main.c avoid backgrounding (no printed output)
diff --git a/gnu/usr.sbin/sendmail/sendmail/alias.c b/gnu/usr.sbin/sendmail/sendmail/alias.c
index 15ac964f444..972ed120f14 100644
--- a/gnu/usr.sbin/sendmail/sendmail/alias.c
+++ b/gnu/usr.sbin/sendmail/sendmail/alias.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: alias.c,v 8.211 2001/11/12 22:52:18 ca Exp $")
+SM_RCSID("@(#)$Sendmail: alias.c,v 8.214 2002/05/24 20:50:16 gshapiro Exp $")
#define SEPARATOR ':'
# define ALIAS_SPEC_SEPARATORS " ,/:"
@@ -393,7 +393,7 @@ aliaswait(map, ext, isopen)
bool attimeout = false;
time_t mtime;
struct stat stb;
- char buf[MAXNAME + 1];
+ char buf[MAXPATHLEN];
if (tTd(27, 3))
sm_dprintf("aliaswait(%s:%s)\n",
@@ -458,8 +458,17 @@ aliaswait(map, ext, isopen)
return isopen;
}
mtime = stb.st_mtime;
- (void) sm_strlcpyn(buf, sizeof buf, 2,
- map->map_file, ext == NULL ? "" : ext);
+ if (sm_strlcpyn(buf, sizeof buf, 2,
+ map->map_file, ext == NULL ? "" : ext) >= sizeof buf)
+ {
+ if (LogLevel > 3)
+ sm_syslog(LOG_INFO, NOQID,
+ "alias database %s%s name too long",
+ map->map_file, ext == NULL ? "" : ext);
+ message("alias database %s%s name too long",
+ map->map_file, ext == NULL ? "" : ext);
+ }
+
if (stat(buf, &stb) < 0 || stb.st_mtime < mtime || attimeout)
{
if (LogLevel > 3)
@@ -913,7 +922,7 @@ forward(user, sendq, aliaslevel, e)
for (pp = ForwardPath; pp != NULL; pp = ep)
{
int err;
- char buf[MAXPATHLEN + 1];
+ char buf[MAXPATHLEN];
struct stat st;
ep = strchr(pp, SEPARATOR);
diff --git a/gnu/usr.sbin/sendmail/sendmail/bf.c b/gnu/usr.sbin/sendmail/sendmail/bf.c
index 0bb5f7b328d..14fbfc00f48 100644
--- a/gnu/usr.sbin/sendmail/sendmail/bf.c
+++ b/gnu/usr.sbin/sendmail/sendmail/bf.c
@@ -18,7 +18,7 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: bf.c,v 8.51 2002/03/04 21:51:25 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: bf.c,v 8.54 2002/04/20 18:03:42 gshapiro Exp $")
#include <sys/types.h>
#include <sys/stat.h>
@@ -202,12 +202,24 @@ sm_bfopen(fp, info, flags, rpool)
** any value of errno specified by sm_io_setinfo()
*/
+#ifdef __STDC__
+/*
+** XXX This is a temporary hack since MODE_T on HP-UX 10.x is short.
+** If we use K&R here, the compiler will complain about
+** Inconsistent parameter list declaration
+** due to the change from short to int.
+*/
+
+SM_FILE_T *
+bfopen(char *filename, MODE_T fmode, size_t bsize, long flags)
+#else /* __STDC__ */
SM_FILE_T *
bfopen(filename, fmode, bsize, flags)
char *filename;
MODE_T fmode;
size_t bsize;
long flags;
+#endif /* __STDC__ */
{
MODE_T omask;
SM_FILE_T SM_IO_SET_TYPE(vector, BF_FILE_TYPE, sm_bfopen, sm_bfclose,
@@ -613,8 +625,8 @@ finished:
** 0 on success, -1 on error
**
** Side Effects:
-** rewinds the SM_FILE_T * and puts it into read mode. Normally one
-** would bfopen() a file, write to it, then bfrewind() and
+** rewinds the SM_FILE_T * and puts it into read mode. Normally
+** one would bfopen() a file, write to it, then bfrewind() and
** fread(). If fp is not a buffered file, this is equivalent to
** rewind().
**
@@ -786,8 +798,7 @@ sm_bftruncate(fp)
return ftruncate(bfp->bf_disk_fd, 0);
#endif /* NOFTRUNCATE */
}
- else
- return 0;
+ return 0;
}
/*
diff --git a/gnu/usr.sbin/sendmail/sendmail/bf.h b/gnu/usr.sbin/sendmail/sendmail/bf.h
index b95fef6628b..21429dc140e 100644
--- a/gnu/usr.sbin/sendmail/sendmail/bf.h
+++ b/gnu/usr.sbin/sendmail/sendmail/bf.h
@@ -1,12 +1,12 @@
/*
- * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the sendmail distribution.
*
- * $Sendmail: bf.h,v 8.15 2001/05/31 21:02:53 ca Exp $
+ * $Sendmail: bf.h,v 8.16 2002/04/15 02:37:09 ca Exp $
*
* Contributed by Exactis.com, Inc.
*
@@ -16,7 +16,6 @@
# define BF_H 1
extern SM_FILE_T *bfopen __P((char *, MODE_T, size_t, long));
-extern SM_FILE_T *bfdup __P((SM_FILE_T *));
extern int bfcommit __P((SM_FILE_T *));
extern int bfrewind __P((SM_FILE_T *));
extern int bftruncate __P((SM_FILE_T *));
diff --git a/gnu/usr.sbin/sendmail/sendmail/collect.c b/gnu/usr.sbin/sendmail/sendmail/collect.c
index b34790be7b3..250ba399565 100644
--- a/gnu/usr.sbin/sendmail/sendmail/collect.c
+++ b/gnu/usr.sbin/sendmail/sendmail/collect.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: collect.c,v 8.241 2002/03/15 01:32:47 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: collect.c,v 8.242 2002/05/10 15:40:09 ca Exp $")
static void collecttimeout __P((time_t));
static void dferror __P((SM_FILE_T *volatile, char *, ENVELOPE *));
@@ -980,7 +980,7 @@ dferror(df, msg, e)
}
else
syserr("421 4.3.0 collect: Cannot write %s (%s, uid=%d, gid=%d)",
- dfname, msg, geteuid(), getegid());
+ dfname, msg, (int) geteuid(), (int) getegid());
if (sm_io_reopen(SmFtStdio, SM_TIME_DEFAULT, SM_PATH_DEVNULL,
SM_IO_WRONLY, NULL, df) == NULL)
sm_syslog(LOG_ERR, e->e_id,
diff --git a/gnu/usr.sbin/sendmail/sendmail/conf.c b/gnu/usr.sbin/sendmail/sendmail/conf.c
index 6ff37298af6..5faf7f1e38c 100644
--- a/gnu/usr.sbin/sendmail/sendmail/conf.c
+++ b/gnu/usr.sbin/sendmail/sendmail/conf.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: conf.c,v 8.961 2002/04/04 21:32:14 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: conf.c,v 8.969 2002/05/24 23:48:55 gshapiro Exp $")
#include <sendmail/pathnames.h>
@@ -2327,6 +2327,25 @@ typedef unsigned int *pt_entry_t;
# define SPT_BUFSIZE MAXLINE
#endif /* ! SPT_BUFSIZE */
+#if _FFR_SPT_ALIGN
+
+/*
+** It looks like the Compaq Tru64 5.1A now aligns argv and envp to
+** 64 bit alignment, so unless each piece of argv and envp is a multiple
+** of 8 bytes (including terminating NULL), initsetproctitle() won't use
+** any of the space beyond argv[0]. Be sure to set SPT_ALIGN_SIZE if
+** you use this FFR.
+*/
+
+# ifdef SPT_ALIGN_SIZE
+# define SPT_ALIGN(x, align) ((((x) + SPT_ALIGN_SIZE) >> (align)) << (align))
+# else /* SPT_ALIGN_SIZE */
+# define SPT_ALIGN(x, align) (x)
+# endif /* SPT_ALIGN_SIZE */
+#else /* _FFR_SPT_ALIGN */
+# define SPT_ALIGN(x, align) (x)
+#endif /* _FFR_SPT_ALIGN */
+
/*
** Pointers for setproctitle.
** This allows "ps" listings to give more useful information.
@@ -2345,6 +2364,7 @@ initsetproctitle(argc, argv, envp)
char **envp;
{
register int i;
+ int align;
extern char **environ;
/*
@@ -2369,15 +2389,24 @@ initsetproctitle(argc, argv, envp)
** Determine how much space we can use for setproctitle.
** Use all contiguous argv and envp pointers starting at argv[0]
*/
+
+ align = -1;
+#if _FFR_SPT_ALIGN
+# ifdef SPT_ALIGN_SIZE
+ for (i = SPT_ALIGN_SIZE; i > 0; i >>= 1)
+ align++;
+# endif /* SPT_ALIGN_SIZE */
+#endif /* _FFR_SPT_ALIGN */
+
for (i = 0; i < argc; i++)
{
if (i == 0 || LastArgv + 1 == argv[i])
- LastArgv = argv[i] + strlen(argv[i]);
+ LastArgv = argv[i] + SPT_ALIGN(strlen(argv[i]), align);
}
for (i = 0; LastArgv != NULL && envp[i] != NULL; i++)
{
if (LastArgv + 1 == envp[i])
- LastArgv = envp[i] + strlen(envp[i]);
+ LastArgv = envp[i] + SPT_ALIGN(strlen(envp[i]), align);
}
}
@@ -2742,7 +2771,8 @@ uname(name)
{
char buf[MAXLINE];
- while (sm_io_fgets(file, SM_TIME_DEFAULT, buf, MAXLINE) != NULL)
+ while (sm_io_fgets(file, SM_TIME_DEFAULT,
+ buf, sizeof buf) != NULL)
{
if (sm_io_sscanf(buf, "#define sysname \"%*[^\"]\"",
NODE_LENGTH, name->nodename) > 0)
@@ -5556,7 +5586,11 @@ char *CompileOptions[] =
"PIPELINING",
#endif /* PIPELINING */
#if SASL
+# if SASL >= 20000
+ "SASLv2",
+# else /* SASL >= 20000 */
"SASL",
+# endif /* SASL >= 20000 */
#endif /* SASL */
#if SCANF
"SCANF",
@@ -5833,6 +5867,9 @@ char *FFRCompileOptions[] =
#if _FFR_CHECK_EOM
"_FFR_CHECK_EOM",
#endif /* _FFR_CHECK_EOM */
+#if _FFR_CHK_QUEUE
+ "_FFR_CHK_QUEUE",
+#endif /* _FFR_CHK_QUEUE */
#if _FFR_CONTROL_MSTAT
"_FFR_CONTROL_MSTAT",
#endif /* _FFR_CONTROL_MSTAT */
@@ -5948,21 +5985,35 @@ char *FFRCompileOptions[] =
#if _FFR_RESET_MACRO_GLOBALS
"_FFR_RESET_MACRO_GLOBALS",
#endif /* _FFR_RESET_MACRO_GLOBALS */
+#if _FFR_RESPOND_ALL
+ /* in vacation */
+ "_FFR_RESPOND_ALL",
+#endif /* _FFR_RESPOND_ALL */
#if _FFR_RHS
"_FFR_RHS",
#endif /* _FFR_RHS */
+#if _FFR_SASL_OPT_M
+ "_FFR_SASL_OPT_M",
+#endif /* _FFR_SASL_OPT_M */
#if _FFR_SELECT_SHM
"_FFR_SELECT_SHM",
#endif /* _FFR_SELECT_SHM */
#if _FFR_SHM_STATUS
"_FFR_SHM_STATUS",
#endif /* _FFR_SHM_STATUS */
+#if _FFR_SMFI_OPENSOCKET
+ "_FFR_SMFI_OPENSOCKET",
+#endif /* _FFR_SMFI_OPENSOCKET */
#if _FFR_SMTP_SSL
"_FFR_SMTP_SSL",
#endif /* _FFR_SMTP_SSL */
#if _FFR_SOFT_BOUNCE
"_FFR_SOFT_BOUNCE",
#endif /* _FFR_SOFT_BOUNCE */
+#if _FFR_SPT_ALIGN
+/* Chris Adams of HiWAAY Informations Services */
+ "_FFR_SPT_ALIGN",
+#endif /* _FFR_SPT_ALIGN */
#if _FFR_TIMERS
"_FFR_TIMERS",
#endif /* _FFR_TIMERS */
diff --git a/gnu/usr.sbin/sendmail/sendmail/conf.h b/gnu/usr.sbin/sendmail/sendmail/conf.h
index 378e343df73..e98d09872de 100644
--- a/gnu/usr.sbin/sendmail/sendmail/conf.h
+++ b/gnu/usr.sbin/sendmail/sendmail/conf.h
@@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
- * $Sendmail: conf.h,v 8.560 2002/03/15 06:01:54 geir Exp $
+ * $Sendmail: conf.h,v 8.562 2002/05/22 19:46:26 gshapiro Exp $
*/
/*
@@ -133,6 +133,16 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */
# endif /* ! AUTH_MECHANISMS */
#endif /* SASL */
+/*
+** Default database permissions (alias, maps, etc.)
+** Used by sendmail and libsmdb
+*/
+
+#ifndef DBMMODE
+# define DBMMODE 0640
+#endif /* ! DBMMODE */
+
+
/**********************************************************************
** Compilation options.
** #define these to 1 if they are available;
diff --git a/gnu/usr.sbin/sendmail/sendmail/daemon.c b/gnu/usr.sbin/sendmail/sendmail/daemon.c
index 2c72d2683db..1d433232fd1 100644
--- a/gnu/usr.sbin/sendmail/sendmail/daemon.c
+++ b/gnu/usr.sbin/sendmail/sendmail/daemon.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: daemon.c,v 8.611 2002/03/18 23:08:50 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: daemon.c,v 8.612 2002/05/02 19:40:52 ca Exp $")
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
# define USE_SOCK_STREAM 1
@@ -2956,6 +2956,9 @@ restart_daemon()
reason == NULL ? "implicit call" : reason);
closecontrolsocket(true);
+#if SM_CONF_SHM
+ cleanup_shm(DaemonPid == getpid());
+#endif /* SM_CONF_SHM */
/*
** Want to drop to the user who started the process in all cases
@@ -2985,9 +2988,6 @@ restart_daemon()
if ((j = fcntl(i, F_GETFD, 0)) != -1)
(void) fcntl(i, F_SETFD, j | FD_CLOEXEC);
}
-#if SM_CONF_SHM
- cleanup_shm(DaemonPid == getpid());
-#endif /* SM_CONF_SHM */
/*
** Need to allow signals before execve() to make them "harmless".
diff --git a/gnu/usr.sbin/sendmail/sendmail/deliver.c b/gnu/usr.sbin/sendmail/sendmail/deliver.c
index 1f6c4d6081a..5ee217b1ed8 100644
--- a/gnu/usr.sbin/sendmail/sendmail/deliver.c
+++ b/gnu/usr.sbin/sendmail/sendmail/deliver.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sys/time.h>
-SM_RCSID("@(#)$Sendmail: deliver.c,v 8.935 2002/03/23 18:30:40 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: deliver.c,v 8.939 2002/05/25 00:46:00 gshapiro Exp $")
#if HASSETUSERCONTEXT
# include <login_cap.h>
@@ -1284,6 +1284,7 @@ deliver(e, firstto)
char *mxhosts[MAXMXHOSTS + 1];
char *pv[MAXPV + 1];
char buf[MAXNAME + 1];
+ char cbuf[MAXPATHLEN];
errno = 0;
if (!QS_IS_OK(to->q_state))
@@ -2450,14 +2451,14 @@ tryhost:
/* change root to some "safe" directory */
if (m->m_rootdir != NULL)
{
- expand(m->m_rootdir, buf, sizeof buf, e);
+ expand(m->m_rootdir, cbuf, sizeof cbuf, e);
if (tTd(11, 20))
sm_dprintf("openmailer: chroot %s\n",
- buf);
- if (chroot(buf) < 0)
+ cbuf);
+ if (chroot(cbuf) < 0)
{
syserr("openmailer: Cannot chroot(%s)",
- buf);
+ cbuf);
exit(EX_TEMPFAIL);
}
if (chdir("/") < 0)
@@ -2584,13 +2585,14 @@ tryhost:
q = strchr(p, ':');
if (q != NULL)
*q = '\0';
- expand(p, buf, sizeof buf, e);
+ expand(p, cbuf, sizeof cbuf, e);
if (q != NULL)
*q++ = ':';
if (tTd(11, 20))
sm_dprintf("openmailer: trydir %s\n",
- buf);
- if (buf[0] != '\0' && chdir(buf) >= 0)
+ cbuf);
+ if (cbuf[0] != '\0' &&
+ chdir(cbuf) >= 0)
break;
}
}
@@ -3029,7 +3031,11 @@ reconnect: /* after switching to an encrypted connection */
/* Get security strength (features) */
result = sasl_getprop(mci->mci_conn, SASL_SSF,
+# if SASL >= 20000
+ (const void **) &ssf);
+# else /* SASL >= 20000 */
(void **) &ssf);
+# endif /* SASL >= 20000 */
/* XXX authid? */
if (LogLevel > 9)
@@ -4974,8 +4980,8 @@ mailfile(filename, mailer, ctladdr, sfflags, e)
char *p;
char *volatile realfile;
SM_EVENT *ev;
- char buf[MAXLINE + 1];
- char targetfile[MAXPATHLEN + 1];
+ char buf[MAXPATHLEN];
+ char targetfile[MAXPATHLEN];
if (tTd(11, 1))
{
diff --git a/gnu/usr.sbin/sendmail/sendmail/domain.c b/gnu/usr.sbin/sendmail/sendmail/domain.c
index a096219d23b..c1fc9bd3a82 100644
--- a/gnu/usr.sbin/sendmail/sendmail/domain.c
+++ b/gnu/usr.sbin/sendmail/sendmail/domain.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1986, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -14,9 +14,9 @@
#include <sendmail.h>
#if NAMED_BIND
-SM_RCSID("@(#)$Sendmail: domain.c,v 8.180 2002/03/05 05:47:12 gshapiro Exp $ (with name server)")
+SM_RCSID("@(#)$Sendmail: domain.c,v 8.181 2002/05/24 23:48:42 gshapiro Exp $ (with name server)")
#else /* NAMED_BIND */
-SM_RCSID("@(#)$Sendmail: domain.c,v 8.180 2002/03/05 05:47:12 gshapiro Exp $ (without name server)")
+SM_RCSID("@(#)$Sendmail: domain.c,v 8.181 2002/05/24 23:48:42 gshapiro Exp $ (without name server)")
#endif /* NAMED_BIND */
#if NAMED_BIND
@@ -810,7 +810,7 @@ dns_getcanonname(host, hbsize, trymx, statp, pttl)
int loopcnt;
char *xp;
char nbuf[SM_MAX(MAXPACKET, MAXDNAME*2+2)];
- char *searchlist[MAXDNSRCH+2];
+ char *searchlist[MAXDNSRCH + 2];
if (tTd(8, 2))
sm_dprintf("dns_getcanonname(%s, trymx=%d)\n", host, trymx);
diff --git a/gnu/usr.sbin/sendmail/sendmail/envelope.c b/gnu/usr.sbin/sendmail/sendmail/envelope.c
index d02e2812f6d..4f926364bd7 100644
--- a/gnu/usr.sbin/sendmail/sendmail/envelope.c
+++ b/gnu/usr.sbin/sendmail/sendmail/envelope.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: envelope.c,v 8.281 2002/02/06 19:54:54 ca Exp $")
+SM_RCSID("@(#)$Sendmail: envelope.c,v 8.282 2002/05/10 15:41:11 ca Exp $")
/*
** NEWENVELOPE -- fill in a new envelope
@@ -518,7 +518,7 @@ simpledrop:
{
syserr("!dropenvelope(%s): cannot commit data file %s, uid=%d",
e->e_id, queuename(e, DATAFL_LETTER),
- geteuid());
+ (int) geteuid());
}
for (ee = e->e_sibling; ee != NULL; ee = ee->e_sibling)
queueup(ee, false, true);
diff --git a/gnu/usr.sbin/sendmail/sendmail/main.c b/gnu/usr.sbin/sendmail/sendmail/main.c
index 46457ba1b27..03643ab54bb 100644
--- a/gnu/usr.sbin/sendmail/sendmail/main.c
+++ b/gnu/usr.sbin/sendmail/sendmail/main.c
@@ -25,7 +25,7 @@ SM_UNUSED(static char copyright[]) =
The Regents of the University of California. All rights reserved.\n";
#endif /* ! lint */
-SM_RCSID("@(#)$Sendmail: main.c,v 8.876 2002/02/27 23:49:52 ca Exp $")
+SM_RCSID("@(#)$Sendmail: main.c,v 8.882 2002/05/10 16:20:55 ca Exp $")
#if NETINET || NETINET6
@@ -642,6 +642,8 @@ main(argc, argv, envp)
(void) sm_signal(SIGPIPE, SIG_IGN);
OldUmask = umask(022);
FullName = getextenv("NAME");
+ if (FullName != NULL)
+ FullName = newstr(FullName);
/*
** Initialize name server if it is going to be used.
@@ -2695,6 +2697,13 @@ main(argc, argv, envp)
/* NOTREACHED */
return -1;
}
+
+ /* set message size */
+ (void) sm_snprintf(buf, sizeof buf, "%ld",
+ MainEnvelope.e_msgsize);
+ macdefine(&MainEnvelope.e_macro, A_TEMP,
+ macid("{msg_size}"), buf);
+
Errors = savederrors;
MainEnvelope.e_flags |= savedflags;
}
@@ -2800,6 +2809,7 @@ finis(drop, cleanup, exitstat)
bool cleanup;
volatile int exitstat;
{
+
/* Still want to process new timeouts added below */
sm_clear_events();
(void) sm_releasesignal(SIGALRM);
diff --git a/gnu/usr.sbin/sendmail/sendmail/map.c b/gnu/usr.sbin/sendmail/sendmail/map.c
index 19f5e87b9b0..0ad3cb0d3a1 100644
--- a/gnu/usr.sbin/sendmail/sendmail/map.c
+++ b/gnu/usr.sbin/sendmail/sendmail/map.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: map.c,v 8.641 2002/03/26 22:56:36 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: map.c,v 8.645 2002/05/24 21:07:36 gshapiro Exp $")
#if LDAPMAP
# include <sm/ldap.h>
@@ -121,8 +121,6 @@ static bool text_getcanonname __P((char *, int, int *));
** to be more properly integrated into the map structure.
*/
-#define DBMMODE 0644
-
#if O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL
# define LOCK_ON_OPEN 1 /* we can open/create a locked file */
#else /* O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL */
@@ -1359,8 +1357,8 @@ ndbm_map_open(map, mode)
long sff;
int ret;
int smode = S_IREAD;
- char dirfile[MAXNAME + 1];
- char pagfile[MAXNAME + 1];
+ char dirfile[MAXPATHLEN];
+ char pagfile[MAXPATHLEN];
struct stat st;
struct stat std, stp;
@@ -1371,8 +1369,17 @@ ndbm_map_open(map, mode)
mode &= O_ACCMODE;
/* do initial file and directory checks */
- (void) sm_strlcpyn(dirfile, sizeof dirfile, 2, map->map_file, ".dir");
- (void) sm_strlcpyn(pagfile, sizeof pagfile, 2, map->map_file, ".pag");
+ if (sm_strlcpyn(dirfile, sizeof dirfile, 2,
+ map->map_file, ".dir") >= sizeof dirfile ||
+ sm_strlcpyn(pagfile, sizeof pagfile, 2,
+ map->map_file, ".pag") >= sizeof pagfile)
+ {
+ errno = 0;
+ if (!bitset(MF_OPTIONAL, map->map_mflags))
+ syserr("dbm map \"%s\": map file %s name too long",
+ map->map_mname, map->map_file);
+ return false;
+ }
sff = SFF_ROOTOK|SFF_REGONLY;
if (mode == O_RDWR)
{
@@ -1944,13 +1951,29 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo)
long sff;
int save_errno;
struct stat st;
- char buf[MAXNAME + 1];
+ char buf[MAXPATHLEN];
/* do initial file and directory checks */
- (void) sm_strlcpy(buf, map->map_file, sizeof buf - 3);
+ if (sm_strlcpy(buf, map->map_file, sizeof buf) >= sizeof buf)
+ {
+ errno = 0;
+ if (!bitset(MF_OPTIONAL, map->map_mflags))
+ syserr("map \"%s\": map file %s name too long",
+ map->map_mname, map->map_file);
+ return false;
+ }
i = strlen(buf);
if (i < 3 || strcmp(&buf[i - 3], ".db") != 0)
- (void) sm_strlcat(buf, ".db", sizeof buf);
+ {
+ if (sm_strlcat(buf, ".db", sizeof buf) >= sizeof buf)
+ {
+ errno = 0;
+ if (!bitset(MF_OPTIONAL, map->map_mflags))
+ syserr("map \"%s\": map file %s name too long",
+ map->map_mname, map->map_file);
+ return false;
+ }
+ }
mode &= O_ACCMODE;
omode = mode;
@@ -2230,7 +2253,7 @@ db_map_lookup(map, name, av, statp)
int fd;
struct stat stbuf;
char keybuf[MAXNAME + 1];
- char buf[MAXNAME + 1];
+ char buf[MAXPATHLEN];
memset(&key, '\0', sizeof key);
memset(&val, '\0', sizeof val);
@@ -2239,10 +2262,15 @@ db_map_lookup(map, name, av, statp)
sm_dprintf("db_map_lookup(%s, %s)\n",
map->map_mname, name);
- i = strlen(map->map_file);
- if (i > MAXNAME)
- i = MAXNAME;
- (void) sm_strlcpy(buf, map->map_file, i + 1);
+ if (sm_strlcpy(buf, map->map_file, sizeof buf) >= sizeof buf)
+ {
+ errno = 0;
+ if (!bitset(MF_OPTIONAL, map->map_mflags))
+ syserr("map \"%s\": map file %s name too long",
+ map->map_mname, map->map_file);
+ return NULL;
+ }
+ i = strlen(buf);
if (i > 3 && strcmp(&buf[i - 3], ".db") == 0)
buf[i - 3] = '\0';
@@ -4540,10 +4568,16 @@ ldapmap_parseargs(map, args)
ldapmap_dequote(lmap->ldap_secret));
return false;
}
- lmap->ldap_secret = sfgets(m_tmp, LDAPMAP_MAX_PASSWD,
+ lmap->ldap_secret = sfgets(m_tmp, sizeof m_tmp,
sfd, TimeOuts.to_fileopen,
"ldapmap_parseargs");
(void) sm_io_close(sfd, SM_TIME_DEFAULT);
+ if (strlen(m_tmp) > LDAPMAP_MAX_PASSWD)
+ {
+ syserr("LDAP map: secret in %s too long",
+ ldapmap_dequote(lmap->ldap_secret));
+ return false;
+ }
if (lmap->ldap_secret != NULL &&
strlen(m_tmp) > 0)
{
@@ -4563,8 +4597,7 @@ ldapmap_parseargs(map, args)
** stashed
*/
- (void) sm_snprintf(m_tmp,
- MAXPATHLEN + LDAPMAP_MAX_PASSWD,
+ (void) sm_snprintf(m_tmp, sizeof m_tmp,
"KRBTKFILE=%s",
ldapmap_dequote(lmap->ldap_secret));
lmap->ldap_secret = m_tmp;
@@ -5833,7 +5866,8 @@ text_map_lookup(map, name, av, statp)
}
key_idx = map->map_keycolno;
delim = map->map_coldelim;
- while (sm_io_fgets(f, SM_TIME_DEFAULT, linebuf, MAXLINE) != NULL)
+ while (sm_io_fgets(f, SM_TIME_DEFAULT,
+ linebuf, sizeof linebuf) != NULL)
{
char *p;
@@ -5906,7 +5940,8 @@ text_getcanonname(name, hbsize, statp)
}
found = false;
while (!found &&
- sm_io_fgets(f, SM_TIME_DEFAULT, linebuf, MAXLINE) != NULL)
+ sm_io_fgets(f, SM_TIME_DEFAULT,
+ linebuf, sizeof linebuf) != NULL)
{
char *p = strpbrk(linebuf, "#\n");
@@ -7200,7 +7235,8 @@ nsd_map_lookup(map, name, av, statp)
*statp = EX_UNAVAILABLE;
return NULL;
}
- r = ns_lookup(ns_map, NULL, map->map_file, keybuf, NULL, buf, MAXLINE);
+ r = ns_lookup(ns_map, NULL, map->map_file, keybuf, NULL,
+ buf, sizeof buf);
if (r == NS_UNAVAIL || r == NS_TRYAGAIN)
{
*statp = EX_TEMPFAIL;
diff --git a/gnu/usr.sbin/sendmail/sendmail/mci.c b/gnu/usr.sbin/sendmail/sendmail/mci.c
index 4fc5115794e..270878c673d 100644
--- a/gnu/usr.sbin/sendmail/sendmail/mci.c
+++ b/gnu/usr.sbin/sendmail/sendmail/mci.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: mci.c,v 8.204 2002/02/22 18:24:57 ca Exp $")
+SM_RCSID("@(#)$Sendmail: mci.c,v 8.205 2002/05/24 18:53:48 gshapiro Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -654,7 +654,7 @@ mci_lock_host_statfile(mci)
{
int save_errno = errno;
int retVal = EX_OK;
- char fname[MAXPATHLEN + 1];
+ char fname[MAXPATHLEN];
if (HostStatDir == NULL || mci->mci_host == NULL)
return EX_OK;
@@ -773,7 +773,7 @@ mci_load_persistent(mci)
int save_errno = errno;
bool locked = true;
SM_FILE_T *fp;
- char fname[MAXPATHLEN + 1];
+ char fname[MAXPATHLEN];
if (mci == NULL)
{
@@ -1060,7 +1060,7 @@ mci_traverse_persistent(action, pathname)
size_t len;
char *newptr;
struct dirent *e;
- char newpath[MAXPATHLEN + 1];
+ char newpath[MAXPATHLEN];
if ((d = opendir(pathname)) == NULL)
{
diff --git a/gnu/usr.sbin/sendmail/sendmail/milter.c b/gnu/usr.sbin/sendmail/sendmail/milter.c
index 836a01ecdc8..7cc27f9d3cc 100644
--- a/gnu/usr.sbin/sendmail/sendmail/milter.c
+++ b/gnu/usr.sbin/sendmail/sendmail/milter.c
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: milter.c,v 8.194 2002/03/05 00:23:47 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: milter.c,v 8.196 2002/04/14 03:55:07 gshapiro Exp $")
#if MILTER
# include <libmilter/mfapi.h>
@@ -1732,6 +1732,7 @@ milter_send_macros(m, macros, cmd, e)
int mid;
char *v;
char *buf, *bp;
+ char exp[MAXLINE];
ssize_t s;
/* sanity check */
@@ -1748,7 +1749,8 @@ milter_send_macros(m, macros, cmd, e)
v = macvalue(mid, e);
if (v == NULL)
continue;
- s += strlen(macros[i]) + 1 + strlen(v) + 1;
+ expand(v, exp, sizeof(exp), e);
+ s += strlen(macros[i]) + 1 + strlen(exp) + 1;
}
if (s < 0)
@@ -1765,14 +1767,15 @@ milter_send_macros(m, macros, cmd, e)
v = macvalue(mid, e);
if (v == NULL)
continue;
+ expand(v, exp, sizeof(exp), e);
if (tTd(64, 10))
sm_dprintf("milter_send_macros(%s, %c): %s=%s\n",
- m->mf_name, cmd, macros[i], v);
+ m->mf_name, cmd, macros[i], exp);
(void) sm_strlcpy(bp, macros[i], s - (bp - buf));
bp += strlen(bp) + 1;
- (void) sm_strlcpy(bp, v, s - (bp - buf));
+ (void) sm_strlcpy(bp, exp, s - (bp - buf));
bp += strlen(bp) + 1;
}
(void) milter_write(m, SMFIC_MACRO, buf, s,
@@ -2895,8 +2898,6 @@ milter_replbody(response, rlen, newfilter, e)
{
int err;
-# if NOFTRUNCATE
- /* XXX: Not much we can do except rewind it */
err = sm_io_error(e->e_dfp);
(void) sm_io_flush(e->e_dfp, SM_TIME_DEFAULT);
@@ -2912,16 +2913,26 @@ milter_replbody(response, rlen, newfilter, e)
/* errno is set implicitly by fseek() before return */
err = sm_io_seek(e->e_dfp, SM_TIME_DEFAULT,
0, SEEK_SET);
+ if (err < 0)
+ {
+ MILTER_DF_ERROR("milter_replbody: sm_io_seek %s: %s");
+ return -1;
+ }
+# if NOFTRUNCATE
+ /* XXX: Not much we can do except rewind it */
+ errno = EINVAL;
+ MILTER_DF_ERROR("milter_replbody: ftruncate not available on this platform (%s:%s)");
+ return -1;
# else /* NOFTRUNCATE */
err = ftruncate(sm_io_getinfo(e->e_dfp,
SM_IO_WHAT_FD, NULL),
0);
-# endif /* NOFTRUNCATE */
if (err < 0)
{
MILTER_DF_ERROR("milter_replbody: sm_io ftruncate %s: %s");
return -1;
}
+# endif /* NOFTRUNCATE */
}
if (prevsize > e->e_msgsize)
diff --git a/gnu/usr.sbin/sendmail/sendmail/mime.c b/gnu/usr.sbin/sendmail/sendmail/mime.c
index 6830aba40b5..68e325c799e 100644
--- a/gnu/usr.sbin/sendmail/sendmail/mime.c
+++ b/gnu/usr.sbin/sendmail/sendmail/mime.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <string.h>
-SM_RCSID("@(#)$Sendmail: mime.c,v 8.129 2002/03/13 07:28:05 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: mime.c,v 8.130 2002/05/21 03:39:34 ca Exp $")
/*
** MIME support.
@@ -377,7 +377,8 @@ mime8to7(mci, header, e, boundaries, flags)
putheader(mci, hdr, e, flags);
if (tTd(43, 101))
putline("+++after putheader", mci);
- if (hvalue("MIME-Version", hdr) == NULL)
+ if (hvalue("MIME-Version", hdr) == NULL &&
+ !bitset(M87F_NO8TO7, flags))
putline("MIME-Version: 1.0", mci);
bt = mime8to7(mci, hdr, e, boundaries, flags);
mci->mci_flags &= ~MCIF_INMIME;
diff --git a/gnu/usr.sbin/sendmail/sendmail/queue.c b/gnu/usr.sbin/sendmail/sendmail/queue.c
index 740c1f1e2fa..98cfdd7ba97 100644
--- a/gnu/usr.sbin/sendmail/sendmail/queue.c
+++ b/gnu/usr.sbin/sendmail/sendmail/queue.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: queue.c,v 8.857 2002/04/02 16:43:25 ca Exp $")
+SM_RCSID("@(#)$Sendmail: queue.c,v 8.862 2002/05/09 23:51:53 ca Exp $")
#include <dirent.h>
@@ -369,7 +369,7 @@ queueup(e, announce, msync)
if (LogLevel > 0 && (i % 32) == 0)
sm_syslog(LOG_ALERT, e->e_id,
"queueup: cannot create %s, uid=%d: %s",
- tf, geteuid(),
+ tf, (int) geteuid(),
sm_errstring(errno));
}
}
@@ -405,7 +405,7 @@ queueup(e, announce, msync)
printopenfds(true);
errno = save_errno;
syserr("!queueup: cannot create queue temp file %s, uid=%d",
- tf, geteuid());
+ tf, (int) geteuid());
}
}
@@ -449,7 +449,7 @@ queueup(e, announce, msync)
errno != EINVAL)
{
syserr("!queueup: cannot commit data file %s, uid=%d",
- queuename(e, DATAFL_LETTER), geteuid());
+ queuename(e, DATAFL_LETTER), (int) geteuid());
}
if (e->e_dfp != NULL &&
SuperSafe == SAFE_INTERACTIVE && msync)
@@ -490,7 +490,7 @@ queueup(e, announce, msync)
(void *) &dfd, SM_IO_WRONLY,
NULL)) == NULL)
syserr("!queueup: cannot create data temp file %s, uid=%d",
- df, geteuid());
+ df, (int) geteuid());
if (fstat(dfd, &stbuf) < 0)
e->e_dfino = -1;
else
@@ -524,7 +524,7 @@ queueup(e, announce, msync)
if (sm_io_close(dfp, SM_TIME_DEFAULT) < 0)
syserr("!queueup: cannot save data temp file %s, uid=%d",
- df, geteuid());
+ df, (int) geteuid());
e->e_putbody = putbody;
}
@@ -831,7 +831,7 @@ queueup(e, announce, msync)
sizeof qf);
if (rename(tf, qf) < 0)
syserr("cannot rename(%s, %s), uid=%d",
- tf, qf, geteuid());
+ tf, qf, (int) geteuid());
# if _FFR_QUARANTINE
else
{
@@ -4391,6 +4391,10 @@ readqf(e, openonly)
e->e_msgsize = st.st_size + hdrsize;
e->e_dfdev = st.st_dev;
e->e_dfino = ST_INODE(st);
+ (void) sm_snprintf(buf, sizeof buf, "%ld",
+ e->e_msgsize);
+ macdefine(&e->e_macro, A_TEMP, macid("{msg_size}"),
+ buf);
}
}
@@ -5402,7 +5406,7 @@ loseqfile(e, why)
p = queuename(e, LOSEQF_LETTER);
if (rename(buf, p) < 0)
syserr("cannot rename(%s, %s), uid=%d",
- buf, p, geteuid());
+ buf, p, (int) geteuid());
else if (LogLevel > 0)
sm_syslog(LOG_ALERT, e->e_id,
"Losing %s: %s", buf, why);
@@ -5742,9 +5746,18 @@ chkqdir(name, sff)
/* Print a warning if unsafe (but still use it) */
/* XXX do this only if we want the warning? */
i = safedirpath(name, RunAsUid, RunAsGid, NULL, sff, 0, 0);
- if (i != 0 && tTd(41, 2))
- sm_dprintf("chkqdir: \"%s\": Not safe: %s\n",
- name, sm_errstring(i));
+ if (i != 0)
+ {
+ if (tTd(41, 2))
+ sm_dprintf("chkqdir: \"%s\": Not safe: %s\n",
+ name, sm_errstring(i));
+#if _FFR_CHK_QUEUE
+ if (LogLevel > 8)
+ sm_syslog(LOG_WARNING, NOQID,
+ "queue directory \"%s\": Not safe: %s",
+ name, sm_errstring(i));
+#endif /* _FFR_CHK_QUEUE */
+ }
return true;
}
/*
@@ -5809,6 +5822,11 @@ multiqueue_cache(basedir, blen, qg, qn, phash)
/* If running as root, allow safedirpath() checks to use privs */
if (RunAsUid == 0)
sff |= SFF_ROOTOK;
+#if _FFR_CHK_QUEUE
+ sff |= SFF_SAFEDIRPATH|SFF_NOWWFILES;
+ if (!UseMSP)
+ sff |= SFF_NOGWFILES;
+#endif /* _FFR_CHK_QUEUE */
if (!SM_IS_DIR_START(qg->qg_qdir))
{
@@ -6825,7 +6843,7 @@ cleanup_shm(owner)
if (ShmId != SM_SHM_NO_ID)
{
if (sm_shmstop(Pshm, ShmId, owner) < 0 && LogLevel > 8)
- sm_syslog(LOG_INFO, NOQID, "sh_shmstop failed=%s",
+ sm_syslog(LOG_INFO, NOQID, "sm_shmstop failed=%s",
sm_errstring(errno));
Pshm = NULL;
ShmId = SM_SHM_NO_ID;
@@ -8246,7 +8264,7 @@ quarantine_queue_item(qgrp, qdir, e, reason)
}
break;
- case 'R':
+ case 'S':
/*
** If we are quarantining an unquarantined item,
** need to put in a new 'q' line before it's
diff --git a/gnu/usr.sbin/sendmail/sendmail/readcf.c b/gnu/usr.sbin/sendmail/sendmail/readcf.c
index 26be853782e..599d8c59b55 100644
--- a/gnu/usr.sbin/sendmail/sendmail/readcf.c
+++ b/gnu/usr.sbin/sendmail/sendmail/readcf.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: readcf.c,v 8.604 2002/04/02 16:43:25 ca Exp $")
+SM_RCSID("@(#)$Sendmail: readcf.c,v 8.606 2002/05/09 21:09:01 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -3350,6 +3350,14 @@ setoption(opt, val, safe, sticky, e)
case 'f':
SASLOpts |= SASL_SEC_FORWARD_SECRECY;
break;
+# if _FFR_SASL_OPT_M
+/* to be activated in 8.13 */
+# if SASL >= 20101
+ case 'm':
+ SASLOpts |= SASL_SEC_MUTUAL_AUTH;
+ break;
+# endif /* SASL >= 20101 */
+# endif /* _FFR_SASL_OPT_M */
case 'p':
SASLOpts |= SASL_SEC_NOPLAINTEXT;
break;
diff --git a/gnu/usr.sbin/sendmail/sendmail/recipient.c b/gnu/usr.sbin/sendmail/sendmail/recipient.c
index 71987aab4dd..2cd99bca64e 100644
--- a/gnu/usr.sbin/sendmail/sendmail/recipient.c
+++ b/gnu/usr.sbin/sendmail/sendmail/recipient.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: recipient.c,v 8.327 2001/11/20 13:59:53 ca Exp $")
+SM_RCSID("@(#)$Sendmail: recipient.c,v 8.330 2002/05/29 18:20:03 gshapiro Exp $")
static void includetimeout __P((void));
static ADDRESS *self_reference __P((ADDRESS *));
@@ -1419,7 +1419,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
if (forwarding)
{
- sfflags |= SFF_MUSTOWN|SFF_ROOTOK|SFF_NOWLINK;
+ sfflags |= SFF_MUSTOWN|SFF_ROOTOK;
if (!bitnset(DBS_GROUPWRITABLEFORWARDFILE, DontBlameSendmail))
sfflags |= SFF_NOGWFILES;
if (!bitnset(DBS_WORLDWRITABLEFORWARDFILE, DontBlameSendmail))
@@ -1502,7 +1502,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
{
rval = EAGAIN;
syserr("seteuid(%d) failure (real=%d, eff=%d)",
- uid, getuid(), geteuid());
+ uid, (int) getuid(), (int) geteuid());
goto resetuid;
}
# endif /* MAILER_SETUID_METHOD == USE_SETEUID */
@@ -1511,7 +1511,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
{
rval = EAGAIN;
syserr("setreuid(0, %d) failure (real=%d, eff=%d)",
- uid, getuid(), geteuid());
+ uid, (int) getuid(), (int) geteuid());
goto resetuid;
}
# endif /* MAILER_SETUID_METHOD == USE_SETREUID */
@@ -1831,7 +1831,7 @@ resetuid:
#endif /* 0 */
syserr("Attempt to forward to more than %d addresses (in %s)!",
- MaxForwardEntries,fname);
+ MaxForwardEntries, fname);
maxreached = true;
}
}
diff --git a/gnu/usr.sbin/sendmail/sendmail/sasl.c b/gnu/usr.sbin/sendmail/sendmail/sasl.c
index ab27cb918e1..ec6550af96e 100644
--- a/gnu/usr.sbin/sendmail/sendmail/sasl.c
+++ b/gnu/usr.sbin/sendmail/sendmail/sasl.c
@@ -9,13 +9,12 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: sasl.c,v 8.12 2002/01/21 02:28:05 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: sasl.c,v 8.18 2002/05/25 00:26:42 gshapiro Exp $")
#if SASL
# include <stdlib.h>
# include <sendmail.h>
# include <errno.h>
-# include <sasl.h>
/*
** In order to ensure that storage leaks are tracked, and to prevent
@@ -31,12 +30,12 @@ static void *sm_sasl_realloc __P((void *, unsigned long));
void sm_sasl_free __P((void *));
/*
+** SASLv1:
** We can't use an rpool for Cyrus-SASL memory management routines,
** since the encryption/decryption routines in Cyrus-SASL
** allocate/deallocate a buffer each time. Since rpool
** don't release memory until the very end, memory consumption is
** proportional to the size of an e-mail, which is unacceptable.
-**
*/
/*
@@ -206,4 +205,79 @@ intersect(s1, s2, rpool)
}
return res;
}
+# if SASL >= 20000
+/*
+** IPTOSTRING -- create string for SASL_IP*PORT property
+** (borrowed from lib/iptostring.c in Cyrus-IMAP)
+**
+** Parameters:
+** addr -- (pointer to) socket address
+** addrlen -- length of socket address
+** out -- output string (result)
+** outlen -- maximum length of output string
+**
+** Returns:
+** true iff successful.
+**
+** Side Effects:
+** creates output string if successful.
+** sets errno if unsuccessful.
+*/
+
+# include <arpa/inet.h>
+
+# ifndef NI_WITHSCOPEID
+# define NI_WITHSCOPEID 0
+# endif
+# ifndef NI_MAXHOST
+# define NI_MAXHOST 1025
+# endif
+# ifndef NI_MAXSERV
+# define NI_MAXSERV 32
+# endif
+
+bool
+iptostring(addr, addrlen, out, outlen)
+ SOCKADDR *addr;
+ SOCKADDR_LEN_T addrlen;
+ char *out;
+ unsigned outlen;
+{
+ char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
+
+ if (addr == NULL || out == NULL)
+ {
+ errno = EINVAL;
+ return false;
+ }
+
+# if NETINET6
+ if (getnameinfo((struct sockaddr *) addr, addrlen,
+ hbuf, sizeof hbuf, pbuf, sizeof pbuf,
+ NI_NUMERICHOST | NI_WITHSCOPEID | NI_NUMERICSERV) != 0)
+ return false;
+# else /* NETINET6 */
+ if (addr->sa.sa_family != AF_INET)
+ {
+ errno = EINVAL;
+ return false;
+ }
+ if (inet_ntop(AF_INET, &(addr->sin.sin_addr),
+ hbuf, sizeof hbuf) == NULL)
+ {
+ errno = EINVAL;
+ return false;
+ }
+ sm_snprintf(pbuf, sizeof pbuf, "%d", ntohs(addr->sin.sin_port));
+# endif /* NETINET6 */
+
+ if (outlen < strlen(hbuf) + strlen(pbuf) + 2)
+ {
+ errno = ENOMEM;
+ return false;
+ }
+ sm_snprintf(out, outlen, "%s;%s", hbuf, pbuf);
+ return true;
+}
+# endif /* SASL >= 20000 */
#endif /* SASL */
diff --git a/gnu/usr.sbin/sendmail/sendmail/savemail.c b/gnu/usr.sbin/sendmail/sendmail/savemail.c
index 34e5c84b547..40d155be450 100644
--- a/gnu/usr.sbin/sendmail/sendmail/savemail.c
+++ b/gnu/usr.sbin/sendmail/sendmail/savemail.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: savemail.c,v 8.297 2001/12/28 22:32:19 ca Exp $")
+SM_RCSID("@(#)$Sendmail: savemail.c,v 8.299 2002/05/24 20:50:17 gshapiro Exp $")
static void errbody __P((MCI *, ENVELOPE *, char *));
static bool pruneroute __P((char *));
@@ -65,6 +65,7 @@ savemail(e, sendbody)
int flags;
long sff;
char buf[MAXLINE + 1];
+ char dlbuf[MAXPATHLEN];
SM_MBDB_T user;
@@ -365,20 +366,20 @@ savemail(e, sendbody)
p = macvalue('g', e);
macdefine(&e->e_macro, A_PERM, 'g', e->e_sender);
- expand("\201z/dead.letter", buf, sizeof buf, e);
+ expand("\201z/dead.letter", dlbuf, sizeof dlbuf, e);
sff = SFF_CREAT|SFF_REGONLY|SFF_RUNASREALUID;
if (RealUid == 0)
sff |= SFF_ROOTOK;
- e->e_to = buf;
- if (writable(buf, NULL, sff) &&
- mailfile(buf, FileMailer, NULL, sff, e) == EX_OK)
+ e->e_to = dlbuf;
+ if (writable(dlbuf, NULL, sff) &&
+ mailfile(dlbuf, FileMailer, NULL, sff, e) == EX_OK)
{
int oldverb = Verbose;
if (OpMode != MD_DAEMON && OpMode != MD_SMTP)
Verbose = 1;
if (Verbose > 0)
- message("Saved message in %s", buf);
+ message("Saved message in %s", dlbuf);
Verbose = oldverb;
macdefine(&e->e_macro, A_PERM, 'g', p);
state = ESM_DONE;
diff --git a/gnu/usr.sbin/sendmail/sendmail/sendmail.8 b/gnu/usr.sbin/sendmail/sendmail/sendmail.8
index d814b256248..6f7afb25f3e 100644
--- a/gnu/usr.sbin/sendmail/sendmail/sendmail.8
+++ b/gnu/usr.sbin/sendmail/sendmail/sendmail.8
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+.\" Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1988, 1991, 1993
@@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Sendmail: sendmail.8,v 8.49 2001/03/23 22:10:00 ca Exp $
+.\" $Sendmail: sendmail.8,v 8.51 2002/05/24 15:42:13 ca Exp $
.\"
-.Dd March 23, 2001
+.Dd May 24, 2002
.Dt SENDMAIL 8
.Os
.Sh NAME
@@ -86,8 +86,7 @@ Also,
the ``From:'' and ``Sender:''
fields are examined for the name of the sender.
.It Fl bd
-Run as a daemon. This requires Berkeley
-.Tn IPC .
+Run as a daemon.
.Nm Sendmail
will fork and run in background
listening on socket 25 for incoming
diff --git a/gnu/usr.sbin/sendmail/sendmail/sendmail.h b/gnu/usr.sbin/sendmail/sendmail/sendmail.h
index a95e15e399b..e763efee9b8 100644
--- a/gnu/usr.sbin/sendmail/sendmail/sendmail.h
+++ b/gnu/usr.sbin/sendmail/sendmail/sendmail.h
@@ -48,7 +48,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Sendmail: sendmail.h,v 8.912 2002/04/02 16:43:26 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Sendmail: sendmail.h,v 8.918 2002/05/23 20:01:56 gshapiro Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -124,18 +124,26 @@ SM_UNUSED(static char SmailId[]) = "@(#)$Sendmail: sendmail.h,v 8.912 2002/04/02
#endif /* STARTTLS */
#if SASL /* include the sasl include files if we have them */
-# include <sasl.h>
+
+
+# if SASL == 2 || SASL >= 20000
+# include <sasl/sasl.h>
+# include <sasl/saslutil.h>
+# else /* SASL == 2 || SASL >= 20000 */
+# include <sasl.h>
+# include <saslutil.h>
+# endif /* SASL == 2 || SASL >= 20000 */
# if defined(SASL_VERSION_MAJOR) && defined(SASL_VERSION_MINOR) && defined(SASL_VERSION_STEP)
# define SASL_VERSION (SASL_VERSION_MAJOR * 10000) + (SASL_VERSION_MINOR * 100) + SASL_VERSION_STEP
-# if SASL == 1
+# if SASL == 1 || SASL == 2
# undef SASL
# define SASL SASL_VERSION
-# else /* SASL == 1 */
+# else /* SASL == 1 || SASL == 2 */
# if SASL != SASL_VERSION
ERROR README: -DSASL (SASL) does not agree with the version of the CYRUS_SASL library (SASL_VERSION)
ERROR README: see README!
# endif /* SASL != SASL_VERSION */
-# endif /* SASL == 1 */
+# endif /* SASL == 1 || SASL == 2 */
# else /* defined(SASL_VERSION_MAJOR) && defined(SASL_VERSION_MINOR) && defined(SASL_VERSION_STEP) */
# if SASL == 1
ERROR README: please set -DSASL to the version of the CYRUS_SASL library
@@ -559,8 +567,11 @@ extern bool filesys_free __P((long));
/* SASL options */
# define SASL_AUTH_AUTH 0x1000 /* use auth= only if authenticated */
-# define SASL_SEC_MASK 0x0fff /* mask for SASL_SEC_* values: sasl.h */
-# if (SASL_SEC_NOPLAINTEXT & SASL_SEC_MASK) == 0 || \
+# if SASL >= 20101
+# define SASL_SEC_MASK SASL_SEC_MAXIMUM /* mask for SASL_SEC_* values: sasl.h */
+# else /* SASL >= 20101 */
+# define SASL_SEC_MASK 0x0fff /* mask for SASL_SEC_* values: sasl.h */
+# if (SASL_SEC_NOPLAINTEXT & SASL_SEC_MASK) == 0 || \
(SASL_SEC_NOACTIVE & SASL_SEC_MASK) == 0 || \
(SASL_SEC_NODICTIONARY & SASL_SEC_MASK) == 0 || \
(SASL_SEC_FORWARD_SECRECY & SASL_SEC_MASK) == 0 || \
@@ -568,19 +579,23 @@ extern bool filesys_free __P((long));
(SASL_SEC_PASS_CREDENTIALS & SASL_SEC_MASK) == 0
ERROR: change SASL_SEC_MASK_ notify sendmail.org!
# endif /* SASL_SEC_NOPLAINTEXT & SASL_SEC_MASK) == 0 ... */
+# endif /* SASL >= 20101 */
# define MAXOUTLEN 1024 /* length of output buffer */
/* functions */
extern char *intersect __P((char *, char *, SM_RPOOL_T *));
extern char *iteminlist __P((char *, char *, char *));
+# if SASL >= 20000
+extern int proxy_policy __P((sasl_conn_t *, void *, const char *, unsigned, const char *, unsigned, const char *, unsigned, struct propctx *));
+extern int safesaslfile __P((void *, const char *, sasl_verify_type_t));
+# else /* SASL >= 20000 */
extern int proxy_policy __P((void *, const char *, const char *, const char **, const char **));
-# if SASL > 10515
+# if SASL > 10515
extern int safesaslfile __P((void *, char *, int));
-# else /* SASL > 10515 */
+# else /* SASL > 10515 */
extern int safesaslfile __P((void *, char *));
-# endif /* SASL > 10515 */
-extern int sasl_decode64 __P((const char *, unsigned, char *, unsigned *));
-extern int sasl_encode64 __P((const char *, unsigned, char *, unsigned, unsigned *));
+# endif /* SASL > 10515 */
+# endif /* SASL >= 20000 */
extern void stop_sasl_client __P((void));
/* structure to store authinfo */
@@ -1611,6 +1626,9 @@ extern int anynet_pton __P((int, const char *, void *));
# endif /* NETINET6 */
extern char *hostnamebyanyaddr __P((SOCKADDR *));
extern char *validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
+# if SASL >= 20000
+extern bool iptostring __P((SOCKADDR *, SOCKADDR_LEN_T, char *, unsigned));
+# endif /* SASL >= 20000 */
#endif /* NETINET || NETINET6 || NETUNIX || NETISO || NETNS || NETX25 */
diff --git a/gnu/usr.sbin/sendmail/sendmail/sfsasl.c b/gnu/usr.sbin/sendmail/sendmail/sfsasl.c
index 392d66b5897..a4274cdbbaf 100644
--- a/gnu/usr.sbin/sendmail/sendmail/sfsasl.c
+++ b/gnu/usr.sbin/sendmail/sendmail/sfsasl.c
@@ -9,12 +9,11 @@
*/
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: sfsasl.c,v 8.89 2002/02/22 04:41:28 ca Exp $")
+SM_RCSID("@(#)$Sendmail: sfsasl.c,v 8.90 2002/05/09 20:44:11 ca Exp $")
#include <stdlib.h>
#include <sendmail.h>
#include <errno.h>
#if SASL
-# include <sasl.h>
# include "sfsasl.h"
/* Structure used by the "sasl" file type */
@@ -177,7 +176,11 @@ sasl_read(fp, buf, size)
{
int result;
ssize_t len;
+# if SASL >= 20000
+ const char *outbuf = NULL;
+# else /* SASL >= 20000 */
static char *outbuf = NULL;
+# endif /* SASL >= 20000 */
static unsigned int outlen = 0;
static unsigned int offset = 0;
struct sasl_obj *so = (struct sasl_obj *) fp->f_cookie;
@@ -225,7 +228,9 @@ sasl_read(fp, buf, size)
/* return the rest of the buffer */
len = outlen - offset;
(void) memcpy(buf, outbuf + offset, (size_t) len);
+# if SASL < 20000
SASL_DEALLOC(outbuf);
+# endif /* SASL < 20000 */
outbuf = NULL;
offset = 0;
outlen = 0;
@@ -255,7 +260,11 @@ sasl_write(fp, buf, size)
size_t size;
{
int result;
+# if SASL >= 20000
+ const char *outbuf;
+# else /* SASL >= 20000 */
char *outbuf;
+# endif /* SASL >= 20000 */
unsigned int outlen;
size_t ret = 0, total = 0;
struct sasl_obj *so = (struct sasl_obj *) fp->f_cookie;
@@ -276,7 +285,9 @@ sasl_write(fp, buf, size)
outlen -= ret;
total += ret;
}
+# if SASL < 20000
SASL_DEALLOC(outbuf);
+# endif /* SASL < 20000 */
}
return size;
}
diff --git a/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c b/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c
index cbcd4279089..876e38b9876 100644
--- a/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c
+++ b/gnu/usr.sbin/sendmail/sendmail/srvrsmtp.c
@@ -16,7 +16,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Sendmail: srvrsmtp.c,v 8.819 2002/04/02 03:51:02 ca Exp $")
+SM_RCSID("@(#)$Sendmail: srvrsmtp.c,v 8.827 2002/05/28 14:29:57 ca Exp $")
#if SASL || STARTTLS
# include <sys/time.h>
@@ -380,17 +380,24 @@ smtp(nullserver, d_flags, e)
int result;
volatile int authenticating;
char *user;
- char *in, *out, *out2;
+ char *in, *out2;
+# if SASL >= 20000
+ char *auth_id;
+ const char *out;
+ sasl_ssf_t ext_ssf;
+# else /* SASL >= 20000 */
+ char *out;
const char *errstr;
+ sasl_external_properties_t ext_ssf;
+# endif /* SASL >= 20000 */
+ sasl_security_properties_t ssp;
+ sasl_ssf_t *ssf;
unsigned int inlen, out2len;
unsigned int outlen;
char *volatile auth_type;
char *mechlist;
volatile unsigned int n_mechs;
unsigned int len;
- sasl_security_properties_t ssp;
- sasl_external_properties_t ext_ssf;
- sasl_ssf_t *ssf;
#endif /* SASL */
#if STARTTLS
int r;
@@ -507,14 +514,17 @@ smtp(nullserver, d_flags, e)
/* SASL server new connection */
if (sasl_ok)
{
-# if SASL > 10505
+# if SASL >= 20000
+ result = sasl_server_new("smtp", hostname, NULL, NULL, NULL,
+ NULL, 0, &conn);
+# elif SASL > 10505
/* use empty realm: only works in SASL > 1.5.5 */
result = sasl_server_new("smtp", hostname, "", NULL, 0, &conn);
-# else /* SASL > 10505 */
+# else /* SASL >= 20000 */
/* use no realm -> realm is set to hostname by SASL lib */
result = sasl_server_new("smtp", hostname, NULL, NULL, 0,
&conn);
-# endif /* SASL > 10505 */
+# endif /* SASL >= 20000 */
sasl_ok = result == SASL_OK;
if (!sasl_ok)
{
@@ -529,13 +539,59 @@ smtp(nullserver, d_flags, e)
/*
** SASL set properties for sasl
** set local/remote IP
- ** XXX only IPv4: Cyrus SASL doesn't support anything else
+ ** XXX Cyrus SASL v1 only supports IPv4
**
** XXX where exactly are these used/required?
** Kerberos_v4
*/
-# if NETINET
+# if SASL >= 20000
+# if NETINET || NETINET6
+ in = macvalue(macid("{daemon_family}"), e);
+ if (in != NULL && (
+# if NETINET6
+ strcmp(in, "inet6") == 0 ||
+# endif /* NETINET6 */
+ strcmp(in, "inet") == 0))
+ {
+ SOCKADDR_LEN_T addrsize;
+ SOCKADDR saddr_l;
+ SOCKADDR saddr_r;
+ char localip[60], remoteip[60];
+
+ addrsize = sizeof(saddr_r);
+ if (getpeername(sm_io_getinfo(InChannel, SM_IO_WHAT_FD,
+ NULL),
+ (struct sockaddr *) &saddr_r,
+ &addrsize) == 0)
+ {
+ if (iptostring(&saddr_r, addrsize,
+ remoteip, sizeof remoteip))
+ {
+ sasl_setprop(conn, SASL_IPREMOTEPORT,
+ remoteip);
+ }
+ addrsize = sizeof(saddr_l);
+ if (getsockname(sm_io_getinfo(InChannel,
+ SM_IO_WHAT_FD,
+ NULL),
+ (struct sockaddr *) &saddr_l,
+ &addrsize) == 0)
+ {
+ if (iptostring(&saddr_l, addrsize,
+ localip,
+ sizeof localip))
+ {
+ sasl_setprop(conn,
+ SASL_IPLOCALPORT,
+ localip);
+ }
+ }
+ }
+ }
+# endif /* NETINET || NETINET6 */
+# else /* SASL >= 20000 */
+# if NETINET
in = macvalue(macid("{daemon_family}"), e);
if (in != NULL && strcmp(in, "inet") == 0)
{
@@ -560,7 +616,8 @@ smtp(nullserver, d_flags, e)
&saddr_l);
}
}
-# endif /* NETINET */
+# endif /* NETINET */
+# endif /* SASL >= 20000 */
auth_type = NULL;
mechlist = NULL;
@@ -591,10 +648,19 @@ smtp(nullserver, d_flags, e)
** currently we have none so zero
*/
+# if SASL >= 20000
+ ext_ssf = 0;
+ auth_id = NULL;
+ sasl_ok = ((sasl_setprop(conn, SASL_SSF_EXTERNAL,
+ &ext_ssf) == SASL_OK) &&
+ (sasl_setprop(conn, SASL_AUTH_EXTERNAL,
+ auth_id) == SASL_OK));
+# else /* SASL >= 20000 */
ext_ssf.ssf = 0;
ext_ssf.auth_id = NULL;
sasl_ok = sasl_setprop(conn, SASL_SSF_EXTERNAL,
&ext_ssf) == SASL_OK;
+# endif /* SASL >= 20000 */
}
if (sasl_ok)
n_mechs = saslmechs(conn, &mechlist);
@@ -866,8 +932,14 @@ smtp(nullserver, d_flags, e)
}
/* could this be shorter? XXX */
+# if SASL >= 20000
+ in = xalloc(strlen(inp) + 1);
+ result = sasl_decode64(inp, strlen(inp), in,
+ strlen(inp), &inlen);
+# else /* SASL >= 20000 */
out = xalloc(strlen(inp));
result = sasl_decode64(inp, strlen(inp), out, &outlen);
+# endif /* SASL >= 20000 */
if (result != SASL_OK)
{
authenticating = SASL_NOT_AUTH;
@@ -875,11 +947,20 @@ smtp(nullserver, d_flags, e)
/* rfc 2254 4. */
message("501 5.5.4 cannot decode AUTH parameter %s",
inp);
+# if SASL >= 20000
+ sm_free(in);
+# endif /* SASL >= 20000 */
continue;
}
+# if SASL >= 20000
+ result = sasl_server_step(conn, in, inlen,
+ &out, &outlen);
+ sm_free(in);
+# else /* SASL >= 20000 */
result = sasl_server_step(conn, out, outlen,
&out, &outlen, &errstr);
+# endif /* SASL >= 20000 */
/* get an OK if we're done */
if (result == SASL_OK)
@@ -890,6 +971,13 @@ smtp(nullserver, d_flags, e)
macdefine(&BlankEnvelope.e_macro, A_TEMP,
macid("{auth_type}"), auth_type);
+# if SASL >= 20000
+ user = macvalue(macid("{auth_authen}"), e);
+
+ /* get security strength (features) */
+ result = sasl_getprop(conn, SASL_SSF,
+ (const void **) &ssf);
+# else /* SASL >= 20000 */
result = sasl_getprop(conn, SASL_USERNAME,
(void **)&user);
if (result != SASL_OK)
@@ -914,6 +1002,7 @@ smtp(nullserver, d_flags, e)
/* get security strength (features) */
result = sasl_getprop(conn, SASL_SSF,
(void **) &ssf);
+# endif /* SASL >= 20000 */
if (result != SASL_OK)
{
macdefine(&BlankEnvelope.e_macro,
@@ -995,11 +1084,14 @@ smtp(nullserver, d_flags, e)
sm_dprintf("AUTH continue: msg='%s' len=%u\n",
out2, out2len);
}
+# if SASL >= 20000
+ sm_free(out2);
+# endif /* SASL >= 20000 */
}
else
{
/* not SASL_OK or SASL_CONT */
- message("500 5.7.0 authentication failed");
+ message("535 5.7.0 authentication failed");
if (LogLevel > 9)
sm_syslog(LOG_WARNING, e->e_id,
"AUTH failure (%s): %s (%d) %s",
@@ -1007,7 +1099,11 @@ smtp(nullserver, d_flags, e)
sasl_errstring(result, NULL,
NULL),
result,
+# if SASL >= 20000
+ sasl_errdetail(conn));
+# else /* SASL >= 20000 */
errstr == NULL ? "" : errstr);
+# endif /* SASL >= 20000 */
authenticating = SASL_NOT_AUTH;
}
}
@@ -1181,10 +1277,16 @@ smtp(nullserver, d_flags, e)
}
}
+ if (*p == '\0')
+ {
+ message("501 5.5.2 AUTH mechanism must be specified");
+ break;
+ }
+
/* check whether mechanism is available */
if (iteminlist(p, mechlist, " ") == NULL)
{
- message("503 5.3.3 AUTH mechanism %.32s not available",
+ message("504 5.3.3 AUTH mechanism %.32s not available",
p);
break;
}
@@ -1192,9 +1294,15 @@ smtp(nullserver, d_flags, e)
if (ismore)
{
/* could this be shorter? XXX */
+# if SASL >= 20000
+ in = xalloc(strlen(q) + 1);
+ result = sasl_decode64(q, strlen(q), in,
+ strlen(q), &inlen);
+# else /* SASL >= 20000 */
in = sm_rpool_malloc(e->e_rpool, strlen(q));
result = sasl_decode64(q, strlen(q), in,
&inlen);
+# endif /* SASL >= 20000 */
if (result != SASL_OK)
{
message("501 5.5.4 cannot BASE64 decode '%s'",
@@ -1205,6 +1313,9 @@ smtp(nullserver, d_flags, e)
result, q);
/* start over? */
authenticating = SASL_NOT_AUTH;
+# if SASL >= 20000
+ sm_free(in);
+# endif /* SASL >= 20000 */
in = NULL;
inlen = 0;
break;
@@ -1217,12 +1328,19 @@ smtp(nullserver, d_flags, e)
}
/* see if that auth type exists */
+# if SASL >= 20000
+ result = sasl_server_start(conn, p, in, inlen,
+ &out, &outlen);
+ if (in != NULL)
+ sm_free(in);
+# else /* SASL >= 20000 */
result = sasl_server_start(conn, p, in, inlen,
&out, &outlen, &errstr);
+# endif /* SASL >= 20000 */
if (result != SASL_OK && result != SASL_CONTINUE)
{
- message("500 5.7.0 authentication failed");
+ message("535 5.7.0 authentication failed");
if (LogLevel > 9)
sm_syslog(LOG_ERR, e->e_id,
"AUTH failure (%s): %s (%d) %s",
@@ -1230,7 +1348,11 @@ smtp(nullserver, d_flags, e)
sasl_errstring(result, NULL,
NULL),
result,
+# if SASL >= 20000
+ sasl_errdetail(conn));
+# else /* SASL >= 20000 */
errstr);
+# endif /* SASL >= 20000 */
break;
}
auth_type = newstr(p);
@@ -1264,6 +1386,9 @@ smtp(nullserver, d_flags, e)
message("334 %s", out2);
authenticating = SASL_PROC_AUTH;
}
+# if SASL >= 20000
+ sm_free(out2);
+# endif /* SASL >= 20000 */
break;
#endif /* SASL */
@@ -1494,12 +1619,23 @@ smtp(nullserver, d_flags, e)
char *s;
s = macvalue(macid("{cipher_bits}"), e);
+# if SASL >= 20000
+ if (s != NULL && (ext_ssf = atoi(s)) > 0)
+ {
+ auth_id = macvalue(macid("{cert_subject}"),
+ e);
+ sasl_ok = ((sasl_setprop(conn, SASL_SSF_EXTERNAL,
+ &ext_ssf) == SASL_OK) &&
+ (sasl_setprop(conn, SASL_AUTH_EXTERNAL,
+ auth_id) == SASL_OK));
+# else /* SASL >= 20000 */
if (s != NULL && (ext_ssf.ssf = atoi(s)) > 0)
{
ext_ssf.auth_id = macvalue(macid("{cert_subject}"),
e);
sasl_ok = sasl_setprop(conn, SASL_SSF_EXTERNAL,
&ext_ssf) == SASL_OK;
+# endif /* SASL >= 20000 */
mechlist = NULL;
if (sasl_ok)
n_mechs = saslmechs(conn,
@@ -1591,6 +1727,7 @@ smtp(nullserver, d_flags, e)
break;
}
+ ok = true;
for (q = p; *q != '\0'; q++)
{
if (!isascii(*q))
@@ -1600,13 +1737,16 @@ smtp(nullserver, d_flags, e)
if (isspace(*q))
{
*q = '\0';
+
+ /* only complain if strict check */
+ ok = AllowBogusHELO;
break;
}
if (strchr("[].-_#", *q) == NULL)
break;
}
- if (*q == '\0')
+ if (*q == '\0' && ok)
{
q = "pleased to meet you";
sendinghost = sm_strdup_x(p);
@@ -2254,7 +2394,7 @@ smtp(nullserver, d_flags, e)
macdefine(&e->e_macro, A_PERM,
macid("{rcpt_mailer}"), NULL);
macdefine(&e->e_macro, A_PERM,
- macid("{rcpt_relay}"), NULL);
+ macid("{rcpt_host}"), NULL);
macdefine(&e->e_macro, A_PERM,
macid("{rcpt_addr}"), NULL);
macdefine(&e->e_macro, A_PERM,
@@ -2588,7 +2728,8 @@ doquit:
logsender(e, NULL);
e->e_flags &= ~EF_LOGSENDER;
- if (lognullconnection && LogLevel > 5)
+ if (lognullconnection && LogLevel > 5 &&
+ nullserver == NULL)
{
char *d;
@@ -2725,6 +2866,7 @@ smtp_data(smtp, e)
ADDRESS *a;
ENVELOPE *ee;
char *id;
+ char *oldid;
char buf[32];
SmtpPhase = "server DATA";
@@ -2945,8 +3087,13 @@ smtp_data(smtp, e)
ee->e_to = NULL;
}
+ /* put back id for SMTP logging in putoutmsg() */
+ oldid = CurEnv->e_id;
+ CurEnv->e_id = id;
+
/* issue success message */
message("250 2.0.0 %s Message accepted for delivery", id);
+ CurEnv->e_id = oldid;
/* if we just queued, poke it */
if (doublequeue)
@@ -3726,9 +3873,15 @@ saslmechs(conn, mechlist)
int len, num, result;
/* "user" is currently unused */
+# if SASL >= 20000
+ result = sasl_listmech(conn, NULL,
+ "", " ", "", (const char **) mechlist,
+ (unsigned int *)&len, (unsigned int *)&num);
+# else /* SASL >= 20000 */
result = sasl_listmech(conn, "user", /* XXX */
"", " ", "", mechlist,
(unsigned int *)&len, (unsigned int *)&num);
+# endif /* SASL >= 20000 */
if (result != SASL_OK)
{
if (LogLevel > 9)
@@ -3754,6 +3907,52 @@ saslmechs(conn, mechlist)
}
return num;
}
+
+# if SASL >= 20000
+/*
+** PROXY_POLICY -- define proxy policy for AUTH
+**
+** Parameters:
+** conn -- unused.
+** context -- unused.
+** requested_user -- authorization identity.
+** rlen -- authorization identity length.
+** auth_identity -- authentication identity.
+** alen -- authentication identity length.
+** def_realm -- default user realm.
+** urlen -- user realm length.
+** propctx -- unused.
+**
+** Returns:
+** ok?
+**
+** Side Effects:
+** sets {auth_authen} macro.
+*/
+
+int
+proxy_policy(conn, context, requested_user, rlen, auth_identity, alen,
+ def_realm, urlen, propctx)
+ sasl_conn_t *conn;
+ void *context;
+ const char *requested_user;
+ unsigned rlen;
+ const char *auth_identity;
+ unsigned alen;
+ const char *def_realm;
+ unsigned urlen;
+ struct propctx *propctx;
+{
+ if (auth_identity == NULL)
+ return SASL_FAIL;
+
+ macdefine(&BlankEnvelope.e_macro, A_TEMP,
+ macid("{auth_authen}"), (char *) auth_identity);
+
+ return SASL_OK;
+}
+# else /* SASL >= 20000 */
+
/*
** PROXY_POLICY -- define proxy policy for AUTH
**
@@ -3781,6 +3980,7 @@ proxy_policy(context, auth_identity, requested_user, user, errstr)
*user = newstr(auth_identity);
return SASL_OK;
}
+# endif /* SASL >= 20000 */
#endif /* SASL */
#if STARTTLS
diff --git a/gnu/usr.sbin/sendmail/sendmail/stats.c b/gnu/usr.sbin/sendmail/sendmail/stats.c
index 29055d5c442..c153d9b2454 100644
--- a/gnu/usr.sbin/sendmail/sendmail/stats.c
+++ b/gnu/usr.sbin/sendmail/sendmail/stats.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: stats.c,v 8.54 2002/03/19 00:23:28 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: stats.c,v 8.55 2002/05/21 22:28:52 gshapiro Exp $")
#include <sendmail/mailstats.h>
@@ -154,7 +154,7 @@ poststats(sfile)
if (!bitnset(DBS_WRITESTATSTOHARDLINK, DontBlameSendmail))
sff |= SFF_NOHLINK;
- fd = safeopen(sfile, O_RDWR, 0644, sff);
+ fd = safeopen(sfile, O_RDWR, 0600, sff);
if (fd < 0)
{
if (LogLevel > 12)
diff --git a/gnu/usr.sbin/sendmail/sendmail/usersmtp.c b/gnu/usr.sbin/sendmail/sendmail/usersmtp.c
index c389093645a..619d35971d6 100644
--- a/gnu/usr.sbin/sendmail/sendmail/usersmtp.c
+++ b/gnu/usr.sbin/sendmail/sendmail/usersmtp.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: usersmtp.c,v 8.431 2002/04/03 00:23:25 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: usersmtp.c,v 8.437 2002/05/24 18:53:48 gshapiro Exp $")
#include <sysexits.h>
@@ -95,7 +95,7 @@ smtpinit(m, mci, e, onlyhelo)
CurHostName = MyHostName;
SmtpNeedIntro = true;
state = mci->mci_state;
- switch (mci->mci_state)
+ switch (state)
{
case MCIS_MAIL:
case MCIS_RCPT:
@@ -603,7 +603,9 @@ getsasldata(line, firstline, m, mci, e)
{
int len;
int result;
+# if SASL < 20000
char *out;
+# endif /* SASL < 20000 */
/* if not a continue we don't care about it */
len = strlen(line);
@@ -619,9 +621,29 @@ getsasldata(line, firstline, m, mci, e)
/* forget about "334 " */
line += 4;
len -= 4;
+# if SASL >= 20000
+ /* XXX put this into a macro/function? It's duplicated below */
+ if (mci->mci_sasl_string != NULL)
+ {
+ if (mci->mci_sasl_string_len <= len)
+ {
+ sm_free(mci->mci_sasl_string); /* XXX */
+ mci->mci_sasl_string = xalloc(len + 1);
+ }
+ }
+ else
+ mci->mci_sasl_string = xalloc(len + 1);
+ result = sasl_decode64(line, len, mci->mci_sasl_string, len + 1,
+ (unsigned int *) &mci->mci_sasl_string_len);
+ if (result != SASL_OK)
+ {
+ mci->mci_sasl_string_len = 0;
+ *mci->mci_sasl_string = '\0';
+ }
+# else /* SASL >= 20000 */
out = (char *) sm_rpool_malloc_x(mci->mci_rpool, len + 1);
- result = sasl_decode64(line, len, out, (unsigned int *)&len);
+ result = sasl_decode64(line, len, out, (unsigned int *) &len);
if (result != SASL_OK)
{
len = 0;
@@ -648,6 +670,7 @@ getsasldata(line, firstline, m, mci, e)
memcpy(mci->mci_sasl_string, out, len);
mci->mci_sasl_string[len] = '\0';
mci->mci_sasl_string_len = len;
+# endif /* SASL >= 20000 */
return;
}
/*
@@ -894,8 +917,14 @@ getauth(mci, e, sai)
unsigned int len;
/* '=base64' (decode) */
+# if SASL >= 20000
+ r = sasl_decode64(pvp[i + 1] + 3,
+ (unsigned int) l, (*sai)[r],
+ (unsigned int) l + 1, &len);
+# else /* SASL >= 20000 */
r = sasl_decode64(pvp[i + 1] + 3,
(unsigned int) l, (*sai)[r], &len);
+# endif /* SASL >= 20000 */
if (r != SASL_OK)
goto fail;
got |= 1 << r;
@@ -903,7 +932,7 @@ getauth(mci, e, sai)
else
goto fail;
if (tTd(95, 5))
- sm_syslog(LOG_WARNING, NOQID, "getauth %s=%s",
+ sm_syslog(LOG_DEBUG, NOQID, "getauth %s=%s",
sasl_info_name[r], (*sai)[r]);
++i;
}
@@ -949,6 +978,111 @@ getauth(mci, e, sai)
(*sai)[i] = NULL; /* just clear; rpool */
return ret;
}
+
+# if SASL >= 20000
+/*
+** GETSIMPLE -- callback to get userid or authid
+**
+** Parameters:
+** context -- sai
+** id -- what to do
+** result -- (pointer to) result
+** len -- (pointer to) length of result
+**
+** Returns:
+** OK/failure values
+*/
+
+static int
+getsimple(context, id, result, len)
+ void *context;
+ int id;
+ const char **result;
+ unsigned *len;
+{
+ SASL_AI_T *sai;
+
+ if (result == NULL || context == NULL)
+ return SASL_BADPARAM;
+ sai = (SASL_AI_T *) context;
+
+ switch (id)
+ {
+ case SASL_CB_USER:
+ *result = (*sai)[SASL_USER];
+ if (tTd(95, 5))
+ sm_syslog(LOG_DEBUG, NOQID, "AUTH username '%s'",
+ *result);
+ if (len != NULL)
+ *len = *result != NULL ? strlen(*result) : 0;
+ break;
+
+ case SASL_CB_AUTHNAME:
+ *result = (*sai)[SASL_AUTHID];
+ if (tTd(95, 5))
+ sm_syslog(LOG_DEBUG, NOQID, "AUTH authid '%s'",
+ *result);
+ if (len != NULL)
+ *len = *result != NULL ? strlen(*result) : 0;
+ break;
+
+ case SASL_CB_LANGUAGE:
+ *result = NULL;
+ if (len != NULL)
+ *len = 0;
+ break;
+
+ default:
+ return SASL_BADPARAM;
+ }
+ return SASL_OK;
+}
+/*
+** GETSECRET -- callback to get password
+**
+** Parameters:
+** conn -- connection information
+** context -- sai
+** id -- what to do
+** psecret -- (pointer to) result
+**
+** Returns:
+** OK/failure values
+*/
+
+static int
+getsecret(conn, context, id, psecret)
+ sasl_conn_t *conn;
+ SM_UNUSED(void *context);
+ int id;
+ sasl_secret_t **psecret;
+{
+ int len;
+ char *authpass;
+ MCI *mci;
+
+ if (conn == NULL || psecret == NULL || id != SASL_CB_PASS)
+ return SASL_BADPARAM;
+
+ mci = (MCI *) context;
+ authpass = mci->mci_sai[SASL_PASSWORD];
+ len = strlen(authpass);
+
+ /*
+ ** use an rpool because we are responsible for free()ing the secret,
+ ** but we can't free() it until after the auth completes
+ */
+
+ *psecret = (sasl_secret_t *) sm_rpool_malloc(mci->mci_rpool,
+ sizeof(sasl_secret_t) +
+ len + 1);
+ if (*psecret == NULL)
+ return SASL_FAIL;
+ (void) sm_strlcpy((*psecret)->data, authpass, len + 1);
+ (*psecret)->len = (unsigned long) len;
+ return SASL_OK;
+}
+# else /* SASL >= 20000 */
/*
** GETSIMPLE -- callback to get userid or authid
**
@@ -1013,7 +1147,7 @@ getsimple(context, id, result, len)
(void) sm_strlcpy(s, (*sai)[SASL_USER], l);
*result = s;
if (tTd(95, 5))
- sm_syslog(LOG_WARNING, NOQID, "AUTH username '%s'",
+ sm_syslog(LOG_DEBUG, NOQID, "AUTH username '%s'",
*result);
if (len != NULL)
*len = *result != NULL ? strlen(*result) : 0;
@@ -1084,7 +1218,7 @@ getsimple(context, id, result, len)
(void) sm_strlcpy(s, authid, l);
*result = s;
if (tTd(95, 5))
- sm_syslog(LOG_WARNING, NOQID, "AUTH authid '%s'",
+ sm_syslog(LOG_DEBUG, NOQID, "AUTH authid '%s'",
*result);
if (len != NULL)
*len = authid ? strlen(authid) : 0;
@@ -1139,6 +1273,8 @@ getsecret(conn, context, id, psecret)
(*psecret)->len = (unsigned long) len;
return SASL_OK;
}
+# endif /* SASL >= 20000 */
+
/*
** SAFESASLFILE -- callback for sasl: is file safe?
**
@@ -1161,9 +1297,17 @@ safesaslfile(context, file, type)
safesaslfile(context, file)
#endif /* SASL > 10515 */
void *context;
+# if SASL >= 20000
+ const char *file;
+# else /* SASL >= 20000 */
char *file;
+# endif /* SASL >= 20000 */
#if SASL > 10515
+# if SASL >= 20000
+ sasl_verify_type_t type;
+# else /* SASL >= 20000 */
int type;
+# endif /* SASL >= 20000 */
#endif /* SASL > 10515 */
{
long sff;
@@ -1205,7 +1349,7 @@ safesaslfile(context, file)
}
#endif /* SASL <= 10515 */
- p = file;
+ p = (char *) file;
if ((r = safefile(p, RunAsUid, RunAsGid, RunAsUserName, sff,
S_IRUSR, NULL)) == 0)
return SASL_OK;
@@ -1401,16 +1545,22 @@ attemptauth(m, mci, e, sai)
SASL_AI_T *sai;
{
int saslresult, smtpresult;
+# if SASL >= 20000
+ sasl_ssf_t ssf;
+ const char *auth_id;
+ const char *out;
+# else /* SASL >= 20000 */
sasl_external_properties_t ssf;
- sasl_interact_t *client_interact = NULL;
char *out;
+# endif /* SASL >= 20000 */
unsigned int outlen;
+ sasl_interact_t *client_interact = NULL;
char *mechusing;
sasl_security_properties_t ssp;
char in64[MAXOUTLEN];
-#if NETINET
+#if NETINET || (NETINET6 && SASL >= 20000)
extern SOCKADDR CurHostAddr;
-#endif /* NETINET */
+#endif /* NETINET || (NETINET6 && SASL >= 20000) */
/* no mechanism selected (yet) */
(*sai)[SASL_MECH] = NULL;
@@ -1420,9 +1570,16 @@ attemptauth(m, mci, e, sai)
sasl_dispose(&(mci->mci_conn));
/* make a new client sasl connection */
+# if SASL >= 20000
+ saslresult = sasl_client_new(bitnset(M_LMTP, m->m_flags) ? "lmtp"
+ : "smtp",
+ CurHostName, NULL, NULL, NULL, 0,
+ &mci->mci_conn);
+# else /* SASL >= 20000 */
saslresult = sasl_client_new(bitnset(M_LMTP, m->m_flags) ? "lmtp"
: "smtp",
CurHostName, NULL, 0, &mci->mci_conn);
+# endif /* SASL >= 20000 */
if (saslresult != SASL_OK)
return EX_TEMPFAIL;
@@ -1443,22 +1600,96 @@ attemptauth(m, mci, e, sai)
if (saslresult != SASL_OK)
return EX_TEMPFAIL;
+# if SASL >= 20000
+ /* external security strength factor, authentication id */
+ ssf = 0;
+ auth_id = NULL;
+# if STARTTLS
+ out = macvalue(macid("{cert_subject}"), e);
+ if (out != NULL && *out != '\0')
+ auth_id = out;
+ out = macvalue(macid("{cipher_bits}"), e);
+ if (out != NULL && *out != '\0')
+ ssf = atoi(out);
+# endif /* STARTTLS */
+ saslresult = sasl_setprop(mci->mci_conn, SASL_SSF_EXTERNAL, &ssf);
+ if (saslresult != SASL_OK)
+ return EX_TEMPFAIL;
+ saslresult = sasl_setprop(mci->mci_conn, SASL_AUTH_EXTERNAL, auth_id);
+ if (saslresult != SASL_OK)
+ return EX_TEMPFAIL;
+
+# if NETINET || NETINET6
+ /* set local/remote ipv4 addresses */
+ if (mci->mci_out != NULL && (
+# if NETINET6
+ CurHostAddr.sa.sa_family == AF_INET6 ||
+# endif /* NETINET6 */
+ CurHostAddr.sa.sa_family == AF_INET))
+ {
+ SOCKADDR_LEN_T addrsize;
+ SOCKADDR saddr_l;
+ char localip[60], remoteip[60];
+
+ switch (CurHostAddr.sa.sa_family)
+ {
+ case AF_INET:
+ addrsize = sizeof(struct sockaddr_in);
+ break;
+# if NETINET6
+ case AF_INET6:
+ addrsize = sizeof(struct sockaddr_in6);
+ break;
+# endif /* NETINET6 */
+ default:
+ break;
+ }
+ if (iptostring(&CurHostAddr, addrsize,
+ remoteip, sizeof remoteip))
+ {
+ if (sasl_setprop(mci->mci_conn, SASL_IPREMOTEPORT,
+ remoteip) != SASL_OK)
+ return EX_TEMPFAIL;
+ }
+ addrsize = sizeof(saddr_l);
+ if (getsockname(sm_io_getinfo(mci->mci_out, SM_IO_WHAT_FD,
+ NULL),
+ (struct sockaddr *) &saddr_l, &addrsize) == 0)
+ {
+ if (iptostring(&saddr_l, addrsize,
+ localip, sizeof localip))
+ {
+ if (sasl_setprop(mci->mci_conn,
+ SASL_IPLOCALPORT,
+ localip) != SASL_OK)
+ return EX_TEMPFAIL;
+ }
+ }
+ }
+# endif /* NETINET || NETINET6 */
+
+ /* start client side of sasl */
+ saslresult = sasl_client_start(mci->mci_conn, mci->mci_saslcap,
+ &client_interact,
+ &out, &outlen,
+ (const char **) &mechusing);
+# else /* SASL >= 20000 */
/* external security strength factor, authentication id */
ssf.ssf = 0;
ssf.auth_id = NULL;
-#if STARTTLS
+# if STARTTLS
out = macvalue(macid("{cert_subject}"), e);
if (out != NULL && *out != '\0')
ssf.auth_id = out;
out = macvalue(macid("{cipher_bits}"), e);
if (out != NULL && *out != '\0')
ssf.ssf = atoi(out);
-#endif /* STARTTLS */
+# endif /* STARTTLS */
saslresult = sasl_setprop(mci->mci_conn, SASL_SSF_EXTERNAL, &ssf);
if (saslresult != SASL_OK)
return EX_TEMPFAIL;
-#if NETINET
+# if NETINET
/* set local/remote ipv4 addresses */
if (mci->mci_out != NULL && CurHostAddr.sa.sa_family == AF_INET)
{
@@ -1479,13 +1710,14 @@ attemptauth(m, mci, e, sai)
return EX_TEMPFAIL;
}
}
-#endif /* NETINET */
+# endif /* NETINET */
/* start client side of sasl */
saslresult = sasl_client_start(mci->mci_conn, mci->mci_saslcap,
NULL, &client_interact,
&out, &outlen,
- (const char **)&mechusing);
+ (const char **) &mechusing);
+# endif /* SASL >= 20000 */
if (saslresult != SASL_OK && saslresult != SASL_CONTINUE)
{
@@ -1501,7 +1733,22 @@ attemptauth(m, mci, e, sai)
(*sai)[SASL_MECH] = mechusing;
/* send the info across the wire */
- if (outlen > 0)
+ if (out == NULL)
+ {
+ /* no initial response */
+ smtpmessage("AUTH %s", m, mci, mechusing);
+ }
+ else if (outlen == 0)
+ {
+ /*
+ ** zero-length initial response, per RFC 2554 4.:
+ ** "Unlike a zero-length client answer to a 334 reply, a zero-
+ ** length initial response is sent as a single equals sign"
+ */
+
+ smtpmessage("AUTH %s =", m, mci, mechusing);
+ }
+ else
{
saslresult = sasl_encode64(out, outlen, in64, MAXOUTLEN, NULL);
if (saslresult != SASL_OK) /* internal error */
@@ -1513,11 +1760,9 @@ attemptauth(m, mci, e, sai)
}
smtpmessage("AUTH %s %s", m, mci, mechusing, in64);
}
- else
- {
- smtpmessage("AUTH %s", m, mci, mechusing);
- }
+# if SASL < 20000
sm_sasl_free(out); /* XXX only if no rpool is used */
+# endif /* SASL < 20000 */
/* get the reply */
smtpresult = reply(m, mci, e, TimeOuts.to_auth, getsasldata, NULL);
@@ -1581,7 +1826,9 @@ attemptauth(m, mci, e, sai)
}
else
in64[0] = '\0';
+# if SASL < 20000
sm_sasl_free(out); /* XXX only if no rpool is used */
+# endif /* SASL < 20000 */
smtpmessage("%s", m, mci, in64);
smtpresult = reply(m, mci, e, TimeOuts.to_auth,
getsasldata, NULL);
@@ -1660,12 +1907,16 @@ smtpauth(m, mci, e)
return EX_UNAVAILABLE;
/* set the context for the callback function to sai */
- callbacks[CB_PASS_IDX].context = (void *)&mci->mci_sai;
- callbacks[CB_USER_IDX].context = (void *)&mci->mci_sai;
- callbacks[CB_AUTHNAME_IDX].context = (void *)&mci->mci_sai;
- callbacks[CB_GETREALM_IDX].context = (void *)&mci->mci_sai;
+# if SASL >= 20000
+ callbacks[CB_PASS_IDX].context = (void *) mci;
+# else /* SASL >= 20000 */
+ callbacks[CB_PASS_IDX].context = (void *) &mci->mci_sai;
+# endif /* SASL >= 20000 */
+ callbacks[CB_USER_IDX].context = (void *) &mci->mci_sai;
+ callbacks[CB_AUTHNAME_IDX].context = (void *) &mci->mci_sai;
+ callbacks[CB_GETREALM_IDX].context = (void *) &mci->mci_sai;
#if 0
- callbacks[CB_SAFESASL_IDX].context = (void *)&mci->mci_sai;
+ callbacks[CB_SAFESASL_IDX].context = (void *) &mci->mci_sai;
#endif /* 0 */
/* set default value for realm */
diff --git a/gnu/usr.sbin/sendmail/sendmail/util.c b/gnu/usr.sbin/sendmail/sendmail/util.c
index 36711915ffd..5ff9148f29b 100644
--- a/gnu/usr.sbin/sendmail/sendmail/util.c
+++ b/gnu/usr.sbin/sendmail/sendmail/util.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Sendmail: util.c,v 8.360 2002/04/04 21:32:15 gshapiro Exp $")
+SM_RCSID("@(#)$Sendmail: util.c,v 8.363 2002/05/24 20:44:05 gshapiro Exp $")
#include <sysexits.h>
#include <sm/xtrap.h>
@@ -516,7 +516,7 @@ log_sendmail_pid(e)
{
long sff;
SM_FILE_T *pidf;
- char pidpath[MAXPATHLEN + 1];
+ char pidpath[MAXPATHLEN];
extern char *CommandLineArgs;
/* write the pid to the log file for posterity */
@@ -524,7 +524,7 @@ log_sendmail_pid(e)
if (TrustedUid != 0 && RealUid == TrustedUid)
sff |= SFF_OPENASROOT;
expand(PidFile, pidpath, sizeof pidpath, e);
- pidf = safefopen(pidpath, O_WRONLY|O_TRUNC, 0644, sff);
+ pidf = safefopen(pidpath, O_WRONLY|O_TRUNC, FileMode, sff);
if (pidf == NULL)
{
sm_syslog(LOG_ERR, NOQID, "unable to write %s: %s",
@@ -1919,7 +1919,7 @@ prog_open(argv, pfd, e)
int ret;
int fdv[2];
char *p, *q;
- char buf[MAXLINE + 1];
+ char buf[MAXPATHLEN];
extern int DtableSize;
if (pipe(fdv) < 0)
diff --git a/gnu/usr.sbin/sendmail/sendmail/version.c b/gnu/usr.sbin/sendmail/sendmail/version.c
index d56196fe5ec..589017f2a6d 100644
--- a/gnu/usr.sbin/sendmail/sendmail/version.c
+++ b/gnu/usr.sbin/sendmail/sendmail/version.c
@@ -13,6 +13,6 @@
#include <sm/gen.h>
-SM_RCSID("@(#)$Sendmail: version.c,v 8.99 2002/04/04 22:20:06 ca Exp $")
+SM_RCSID("@(#)$Sendmail: version.c,v 8.102 2002/05/31 18:53:59 ca Exp $")
-char Version[] = "8.12.3";
+char Version[] = "8.12.4";
diff --git a/gnu/usr.sbin/sendmail/smrsh/smrsh.8 b/gnu/usr.sbin/sendmail/smrsh/smrsh.8
index 0abcdb07e6a..2ce06bca2b0 100644
--- a/gnu/usr.sbin/sendmail/smrsh/smrsh.8
+++ b/gnu/usr.sbin/sendmail/smrsh/smrsh.8
@@ -9,10 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $OpenBSD: smrsh.8,v 1.6 2001/09/11 19:02:50 millert Exp $
.\" $Sendmail: smrsh.8,v 8.15 2001/01/24 00:40:47 gshapiro Exp $
.\"
-.Dd January 24, 2001
+.Dd April 25, 2002
.Dt SMRSH 8
.Os
.Sh NAME
diff --git a/gnu/usr.sbin/sendmail/smrsh/smrsh.c b/gnu/usr.sbin/sendmail/smrsh/smrsh.c
index e9170206405..b5e8e6eb079 100644
--- a/gnu/usr.sbin/sendmail/smrsh/smrsh.c
+++ b/gnu/usr.sbin/sendmail/smrsh/smrsh.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1993 Eric P. Allman. All rights reserved.
* Copyright (c) 1993
@@ -20,7 +20,7 @@ SM_IDSTR(copyright,
Copyright (c) 1993\n\
The Regents of the University of California. All rights reserved.\n")
-SM_IDSTR(id, "@(#)$Sendmail: smrsh.c,v 8.55 2001/09/11 04:05:22 gshapiro Exp $")
+SM_IDSTR(id, "@(#)$Sendmail: smrsh.c,v 8.58 2002/05/25 02:41:31 ca Exp $")
/*
** SMRSH -- sendmail restricted shell
@@ -54,6 +54,7 @@ SM_IDSTR(id, "@(#)$Sendmail: smrsh.c,v 8.55 2001/09/11 04:05:22 gshapiro Exp $")
#include <unistd.h>
#include <sm/io.h>
+#include <sm/limits.h>
#include <sm/string.h>
#include <sys/file.h>
#include <string.h>
@@ -126,10 +127,7 @@ addcmd(s, cmd, len)
exit(EX_UNAVAILABLE);
}
if (cmd)
- {
- (void) sm_strlcat(newcmdbuf, CMDDIR, sizeof newcmdbuf);
- (void) sm_strlcat(newcmdbuf, "/", sizeof newcmdbuf);
- }
+ (void) sm_strlcat2(newcmdbuf, CMDDIR, "/", sizeof newcmdbuf);
(void) sm_strlcat(newcmdbuf, s, sizeof newcmdbuf);
}
@@ -145,7 +143,6 @@ main(argc, argv)
int isexec;
int save_errno;
char *newenv[2];
- char cmdbuf[1000];
char pathbuf[1000];
char specialbuf[32];
@@ -157,8 +154,7 @@ main(argc, argv)
# endif /* ! LOG_MAIL */
#endif /* ! DEBUG */
- (void) sm_strlcpy(pathbuf, "PATH=", sizeof pathbuf);
- (void) sm_strlcat(pathbuf, PATH, sizeof pathbuf);
+ (void) sm_strlcpyn(pathbuf, sizeof pathbuf, 2, "PATH=", PATH);
newenv[0] = pathbuf;
newenv[1] = NULL;
@@ -217,7 +213,7 @@ main(argc, argv)
newcmdbuf[0] = '\0';
isexec = false;
- while (*q)
+ while (*q != '\0')
{
/*
** Strip off a leading pathname on the command name. For
@@ -266,6 +262,7 @@ main(argc, argv)
if (strcmp(q, "exec") == 0 && p != NULL)
{
addcmd("exec ", false, strlen("exec "));
+
/* test _next_ arg */
q = ++p;
isexec = true;
@@ -274,16 +271,33 @@ main(argc, argv)
else if (strcmp(q, "exit") == 0 || strcmp(q, "echo") == 0)
{
addcmd(cmd, false, strlen(cmd));
+
/* test following chars */
}
else
{
+ char cmdbuf[MAXPATHLEN];
+
/*
** Check to see if the command name is legal.
*/
- (void) sm_strlcpy(cmdbuf, CMDDIR, sizeof cmdbuf);
- (void) sm_strlcat(cmdbuf, "/", sizeof cmdbuf);
- (void) sm_strlcat(cmdbuf, cmd, sizeof cmdbuf);
+
+ if (sm_strlcpyn(cmdbuf, sizeof cmdbuf, 3, CMDDIR,
+ "/", cmd) >= sizeof cmdbuf)
+ {
+ /* too long */
+ (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
+ "%s: %s not available for sendmail programs (filename too long)\n",
+ prg, cmd);
+ if (p != NULL)
+ *p = ' ';
+#ifndef DEBUG
+ syslog(LOG_CRIT, "uid %d: attempt to use %s (filename too long)",
+ (int) getuid(), cmd);
+#endif /* ! DEBUG */
+ exit(EX_UNAVAILABLE);
+ }
+
#ifdef DEBUG
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
"Trying %s\n", cmdbuf);
@@ -345,7 +359,7 @@ main(argc, argv)
(int) getuid(), *r, par);
#endif /* ! DEBUG */
exit(EX_UNAVAILABLE);
- } /* end of while *q */
+ }
if (isexec)
{
(void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
diff --git a/gnu/usr.sbin/sendmail/vacation/vacation.c b/gnu/usr.sbin/sendmail/vacation/vacation.c
index c2215314883..94e0df17804 100644
--- a/gnu/usr.sbin/sendmail/vacation/vacation.c
+++ b/gnu/usr.sbin/sendmail/vacation/vacation.c
@@ -20,7 +20,7 @@ SM_IDSTR(copyright,
The Regents of the University of California. All rights reserved.\n\
Copyright (c) 1983 Eric P. Allman. All rights reserved.\n")
-SM_IDSTR(id, "@(#)$Sendmail: vacation.c,v 8.134 2002/03/01 20:45:00 ca Exp $")
+SM_IDSTR(id, "@(#)$Sendmail: vacation.c,v 8.137 2002/04/22 18:48:12 gshapiro Exp $")
#include <ctype.h>
@@ -108,7 +108,7 @@ static void listdb __P((void));
#define EXITM(excode) \
{ \
- if (!iflag && !lflag) \
+ if (!initdb && !list) \
eatmsg(); \
exit(excode); \
}
@@ -118,9 +118,10 @@ main(argc, argv)
int argc;
char **argv;
{
- bool iflag, exclude;
+ bool alwaysrespond = false;
+ bool initdb, exclude;
bool runasuser = false;
- bool lflag = false;
+ bool list = false;
int mfail = 0, ufail = 0;
int ch;
int result;
@@ -139,7 +140,7 @@ main(argc, argv)
extern char *optarg;
extern void usage __P((void));
extern void setinterval __P((time_t));
- extern int readheaders __P((void));
+ extern int readheaders __P((bool));
extern bool recent __P((void));
extern void setreply __P((char *, time_t));
extern void sendmessage __P((char *, char *, char *));
@@ -168,17 +169,13 @@ main(argc, argv)
# endif /* LOG_MAIL */
opterr = 0;
- iflag = false;
+ initdb = false;
exclude = false;
interval = INTERVAL_UNDEF;
*From = '\0';
-#if _FFR_RETURN_ADDR
-# define OPTIONS "a:C:df:Iilm:R:r:s:t:Uxz"
-#else /* _FFR_RETURN_ADDR */
-# define OPTIONS "a:C:df:Iilm:r:s:t:Uxz"
-#endif /* _FFR_RETURN_ADDR */
+#define OPTIONS "a:C:df:Iijlm:R:r:s:t:Uxz"
while (mfail == 0 && ufail == 0 &&
(ch = getopt(argc, argv, OPTIONS)) != -1)
@@ -211,11 +208,17 @@ main(argc, argv)
case 'I': /* backward compatible */
case 'i': /* init the database */
- iflag = true;
+ initdb = true;
+ break;
+
+#if _FFR_RESPOND_ALL
+ case 'j':
+ alwaysrespond = true;
break;
+#endif /* _FFR_RESPOND_ALL */
case 'l':
- lflag = true; /* list the database */
+ list = true; /* list the database */
break;
case 'm': /* alternate message file */
@@ -278,7 +281,7 @@ main(argc, argv)
if (argc != 1)
{
- if (!iflag && !lflag && !exclude)
+ if (!initdb && !list && !exclude)
usage();
if ((pw = getpwuid(getuid())) == NULL)
{
@@ -381,7 +384,7 @@ main(argc, argv)
result = smdb_open_database(&Db, dbfilename,
- O_CREAT|O_RDWR | (iflag ? O_TRUNC : 0),
+ O_CREAT|O_RDWR | (initdb ? O_TRUNC : 0),
S_IRUSR|S_IWUSR, sff,
SMDB_TYPE_DEFAULT, &user_info, NULL);
if (result != SMDBE_OK)
@@ -391,7 +394,7 @@ main(argc, argv)
EXITM(EX_DATAERR);
}
- if (lflag)
+ if (list)
{
listdb();
(void) Db->smdb_close(Db);
@@ -401,7 +404,7 @@ main(argc, argv)
if (interval != INTERVAL_UNDEF)
setinterval(interval);
- if (iflag && !exclude)
+ if (initdb && !exclude)
{
(void) Db->smdb_close(Db);
exit(EX_OK);
@@ -425,7 +428,7 @@ main(argc, argv)
cur->next = Names;
Names = cur;
- result = readheaders();
+ result = readheaders(alwaysrespond);
if (result == EX_OK && !recent())
{
time_t now;
@@ -468,7 +471,7 @@ eatmsg()
** READHEADERS -- read mail headers
**
** Parameters:
-** none.
+** alwaysrespond -- respond regardless of whether msg is to me
**
** Returns:
** a exit code: NOUSER if no reply, OK if reply, * if error
@@ -479,7 +482,8 @@ eatmsg()
*/
int
-readheaders()
+readheaders(alwaysrespond)
+ bool alwaysrespond;
{
bool tome, cont;
register char *p;
@@ -488,7 +492,8 @@ readheaders()
extern bool junkmail __P((char *));
extern bool nsearch __P((char *, char *));
- cont = tome = false;
+ cont = false;
+ tome = alwaysrespond;
while (sm_io_fgets(smioin, SM_TIME_DEFAULT, buf, sizeof(buf)) &&
*buf != '\n')
{
@@ -1037,17 +1042,20 @@ sendmessage(myname, msgfn, sender)
void
usage()
{
- char *retusage;
+ char *retusage = "";
+ char *respusage = "";
#if _FFR_RETURN_ADDR
retusage = "[-R returnaddr] ";
-#else /* _FFR_RETURN_ADDR */
- retusage = "";
#endif /* _FFR_RETURN_ADDR */
+#if _FFR_RESPOND_ALL
+ respusage = "[-j] ";
+#endif /* _FFR_RESPOND_ALL */
+
msglog(LOG_NOTICE,
- "uid %u: usage: vacation [-a alias] [-C cfpath] [-d] [-f db] [-i] [-l] [-m msg] %s[-r interval] [-s sender] [-t time] [-U] [-x] [-z] login\n",
- getuid(), retusage);
+ "uid %u: usage: vacation [-a alias] [-C cfpath] [-d] [-f db] [-i] %s[-l] [-m msg] %s[-r interval] [-s sender] [-t time] [-U] [-x] [-z] login\n",
+ getuid(), respusage, retusage);
exit(EX_USAGE);
}
@@ -1084,6 +1092,8 @@ listdb()
while ((result = cursor->smdbc_get(cursor, &db_key, &db_value,
SMDB_CURSOR_GET_NEXT)) == SMDBE_OK)
{
+ char *timestamp;
+
/* skip magic VIT entry */
if ((int)db_key.size - 1 == strlen(VIT) &&
strncmp((char *)db_key.data, VIT,
@@ -1104,9 +1114,18 @@ listdb()
if (db_key.size > 40)
db_key.size = 40;
+ if (t <= 0)
+ {
+ /* must be an exclude */
+ timestamp = "(exclusion)\n";
+ }
+ else
+ {
+ timestamp = ctime(&t);
+ }
sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%-40.*s %-10s",
(int) db_key.size, (char *) db_key.data,
- ctime(&t));
+ timestamp);
memset(&db_key, '\0', sizeof db_key);
memset(&db_value, '\0', sizeof db_value);