Import sendmail 8.13.4
This commit is contained in:
parent
27bec48138
commit
13d8826863
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/vendor/sendmail/dist/; revision=147078 svn path=/vendor/sendmail/8.13.4/; revision=147080; tag=vendor/sendmail/8.13.4
@ -1,11 +1,65 @@
|
|||||||
SENDMAIL RELEASE NOTES
|
SENDMAIL RELEASE NOTES
|
||||||
$Id: RELEASE_NOTES,v 8.1709 2005/01/12 04:32:31 ca Exp $
|
$Id: RELEASE_NOTES,v 8.1730 2005/03/28 00:31:23 gshapiro Exp $
|
||||||
|
|
||||||
|
|
||||||
This listing shows the version of the sendmail binary, the version
|
This listing shows the version of the sendmail binary, the version
|
||||||
of the sendmail configuration files, the date of release, and a
|
of the sendmail configuration files, the date of release, and a
|
||||||
summary of the changes in that release.
|
summary of the changes in that release.
|
||||||
|
|
||||||
|
8.13.4/8.13.4 2005/03/27
|
||||||
|
The bug fixes in 8.13.3 for connection handling uncovered a
|
||||||
|
different error which could result in connections that
|
||||||
|
stay in CLOSE_WAIT state due to a variable that was not
|
||||||
|
properly initialized. Problem noted by Michael Sims.
|
||||||
|
Deal with empty hostnames in hostsignature(). This bug could lead
|
||||||
|
to an endless loop when doing LMTP deliveries to another
|
||||||
|
host. Problem first reported by Martin Lathoud and
|
||||||
|
tracked down by Gael Roualland.
|
||||||
|
Make sure return parameters are initialized in getmxrr(). Problem
|
||||||
|
found by Gael Roualland using valgrind.
|
||||||
|
If shared memory is used and the RunAsUser option is set, then the
|
||||||
|
owner and group of the shared memory segment is set to
|
||||||
|
the ids specified RunAsUser and the access mode is set
|
||||||
|
to 0660 to allow for updates by sendmail processes.
|
||||||
|
The number of queue entries that is (optionally) kept in shared
|
||||||
|
memory was wrong in some cases, e.g., envelope splitting
|
||||||
|
and bounce generation.
|
||||||
|
Undo a change made in 8.13.0 to silently truncate long strings
|
||||||
|
in address rewriting because the message can be triggered
|
||||||
|
for header checks where long strings are legitimate.
|
||||||
|
Problem reported by Mary Verge DeSisto, and tracked
|
||||||
|
down with the help of John Beck of Sun Microsystems.
|
||||||
|
The internal stab map did not obey the -m flag. Patch from
|
||||||
|
Rob McMahon of Warwick University, England.
|
||||||
|
The socket map did not obey the -f flag. Problem noted by
|
||||||
|
Dan Ringdahl, forwarded by Andrzej Filip.
|
||||||
|
The addition of LDAP recursion in 8.13.0 broke enforcement of
|
||||||
|
the LDAP map -1 argument which tells the MTA to only
|
||||||
|
return success if and only if a single LDAP match is found.
|
||||||
|
Add additional error checks in the MTA for milter communication
|
||||||
|
to avoid a possible segmentation fault. Based on patch
|
||||||
|
by Joe Maimon.
|
||||||
|
Do not trigger an assertion if X509_digest() returns success but
|
||||||
|
does not assign a value to its output parameter. Based
|
||||||
|
on patch by Brian Kantor.
|
||||||
|
Add more checks when resetting internal AUTH data (applies only
|
||||||
|
to Cyrus SASL version 2). Otherwise an SMTP session might
|
||||||
|
be dropped after an AUTH failure.
|
||||||
|
Portability:
|
||||||
|
Add LA_LONGLONG as valid LA_TYPE type for systems that use
|
||||||
|
"long long" to read load average data, e.g.,
|
||||||
|
AIX 5.1 in 32 bit mode. Note: this has to be set
|
||||||
|
"by hand", it is not (yet) automatically detected.
|
||||||
|
Problem noted by Burak Bilen.
|
||||||
|
Use socklen_t for accept(), etc. on AIX 5.x. This should
|
||||||
|
fix problems when compiling in 64 bit mode.
|
||||||
|
Problem first reported by Harry Meiert of
|
||||||
|
University of Bremen.
|
||||||
|
New Files:
|
||||||
|
include/sm/sem.h
|
||||||
|
libsm/sem.c
|
||||||
|
libsm/t-sem.c
|
||||||
|
|
||||||
8.13.3/8.13.3 2005/01/11
|
8.13.3/8.13.3 2005/01/11
|
||||||
Enhance handling of I/O errors, especially EOF, when STARTTLS
|
Enhance handling of I/O errors, especially EOF, when STARTTLS
|
||||||
is active.
|
is active.
|
||||||
|
@ -1593,7 +1593,7 @@ The four mailers are:
|
|||||||
|
|
||||||
uucp-old (obsolete name: "uucp")
|
uucp-old (obsolete name: "uucp")
|
||||||
This is the oldest, the worst (but the closest to UUCP) way of
|
This is the oldest, the worst (but the closest to UUCP) way of
|
||||||
sending messages accros UUCP connections. It does bangify
|
sending messages across UUCP connections. It does bangify
|
||||||
everything and prepends $U (your UUCP name) to the sender's
|
everything and prepends $U (your UUCP name) to the sender's
|
||||||
address (which can already be a bang path itself). It can
|
address (which can already be a bang path itself). It can
|
||||||
only send to one address at a time, so it spends a lot of
|
only send to one address at a time, so it spends a lot of
|
||||||
@ -2662,7 +2662,7 @@ blacklists, use the access_db feature and add:
|
|||||||
|
|
||||||
to the access map, where 10.1 is your local network. You may
|
to the access map, where 10.1 is your local network. You may
|
||||||
want to use "RELAY" instead of "OK" to allow also relaying
|
want to use "RELAY" instead of "OK" to allow also relaying
|
||||||
instead of just disabling the DNS lookups in the backlists.
|
instead of just disabling the DNS lookups in the blacklists.
|
||||||
|
|
||||||
|
|
||||||
The features described above make use of the check_relay, check_mail,
|
The features described above make use of the check_relay, check_mail,
|
||||||
@ -2870,12 +2870,12 @@ the previous paragraph. Example:
|
|||||||
| STARTTLS |
|
| STARTTLS |
|
||||||
+----------+
|
+----------+
|
||||||
|
|
||||||
In this text, cert will be used as an abreviation for X.509 certificate,
|
In this text, cert will be used as an abbreviation for X.509 certificate,
|
||||||
DN (CN) is the distinguished (common) name of a cert, and CA is a
|
DN (CN) is the distinguished (common) name of a cert, and CA is a
|
||||||
certification authority, which signs (issues) certs.
|
certification authority, which signs (issues) certs.
|
||||||
|
|
||||||
For STARTTLS to be offered by sendmail you need to set at least
|
For STARTTLS to be offered by sendmail you need to set at least
|
||||||
this variables (the file names and paths are just examples):
|
these variables (the file names and paths are just examples):
|
||||||
|
|
||||||
define(`confCACERT_PATH', `/etc/mail/certs/')
|
define(`confCACERT_PATH', `/etc/mail/certs/')
|
||||||
define(`confCACERT', `/etc/mail/certs/CA.cert.pem')
|
define(`confCACERT', `/etc/mail/certs/CA.cert.pem')
|
||||||
@ -4127,12 +4127,8 @@ confAUTH_OPTIONS AuthOptions [undefined] If this option is 'A'
|
|||||||
then the AUTH= parameter for the
|
then the AUTH= parameter for the
|
||||||
MAIL FROM command is only issued
|
MAIL FROM command is only issued
|
||||||
when authentication succeeded.
|
when authentication succeeded.
|
||||||
Other values (which should be listed
|
See doc/op/op.me for more options
|
||||||
one after the other without any
|
and details.
|
||||||
intervening characters except for
|
|
||||||
space or comma) are a, c, d, f, p,
|
|
||||||
and y. See doc/op/op.me for
|
|
||||||
details.
|
|
||||||
confAUTH_MAX_BITS AuthMaxBits [INT_MAX] Limit the maximum encryption
|
confAUTH_MAX_BITS AuthMaxBits [INT_MAX] Limit the maximum encryption
|
||||||
strength for the security layer in
|
strength for the security layer in
|
||||||
SMTP AUTH (SASL). Default is
|
SMTP AUTH (SASL). Default is
|
||||||
@ -4587,4 +4583,4 @@ M4 DIVERSIONS
|
|||||||
8 DNS based blacklists
|
8 DNS based blacklists
|
||||||
9 special local rulesets (1 and 2)
|
9 special local rulesets (1 and 2)
|
||||||
|
|
||||||
$Revision: 8.691 $, Last updated $Date: 2004/07/19 17:47:34 $
|
$Revision: 8.694 $, Last updated $Date: 2005/03/23 21:41:09 $
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
#####
|
#####
|
||||||
##### SENDMAIL CONFIGURATION FILE
|
##### SENDMAIL CONFIGURATION FILE
|
||||||
#####
|
#####
|
||||||
##### built by ca@wiz.smi.sendmail.com on Tue Jan 11 20:36:44 PST 2005
|
##### built by ca@wiz.smi.sendmail.com on Sun Mar 27 16:38:48 PST 2005
|
||||||
##### in /extra/home/ca/sm-8.13.3/OpenSource/sendmail-8.13.3/cf/cf
|
##### in /extra/home/ca/sm-8.13.4/OpenSource/sendmail-8.13.4/cf/cf
|
||||||
##### using ../ as configuration include directory
|
##### using ../ as configuration include directory
|
||||||
#####
|
#####
|
||||||
######################################################################
|
######################################################################
|
||||||
@ -114,7 +114,7 @@ D{MTAHost}[127.0.0.1]
|
|||||||
|
|
||||||
|
|
||||||
# Configuration version number
|
# Configuration version number
|
||||||
DZ8.13.3/Submit
|
DZ8.13.4/Submit
|
||||||
|
|
||||||
|
|
||||||
###############
|
###############
|
||||||
|
@ -11,8 +11,8 @@ divert(-1)
|
|||||||
# the sendmail distribution.
|
# the sendmail distribution.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
VERSIONID(`$Id: version.m4,v 8.127 2005/01/12 04:32:32 ca Exp $')
|
VERSIONID(`$Id: version.m4,v 8.132 2005/03/25 18:44:45 ca Exp $')
|
||||||
#
|
#
|
||||||
divert(0)
|
divert(0)
|
||||||
# Configuration version number
|
# Configuration version number
|
||||||
DZ8.13.3`'ifdef(`confCF_VERSION', `/confCF_VERSION')
|
DZ8.13.4`'ifdef(`confCF_VERSION', `/confCF_VERSION')
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.\" Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
|
.\" Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
.\" Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
|
.\" Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
|
||||||
.\" Copyright (c) 1983, 1993
|
.\" Copyright (c) 1983, 1993
|
||||||
@ -9,7 +9,7 @@
|
|||||||
.\" the sendmail distribution.
|
.\" the sendmail distribution.
|
||||||
.\"
|
.\"
|
||||||
.\"
|
.\"
|
||||||
.\" $Id: op.me,v 8.699 2004/06/03 18:29:01 ca Exp $
|
.\" $Id: op.me,v 8.704 2005/02/01 00:40:57 ca Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" eqn op.me | pic | troff -me
|
.\" eqn op.me | pic | troff -me
|
||||||
.\"
|
.\"
|
||||||
@ -90,7 +90,7 @@ Sendmail, Inc.
|
|||||||
.de Ve
|
.de Ve
|
||||||
Version \\$2
|
Version \\$2
|
||||||
..
|
..
|
||||||
.Ve $Revision: 8.699 $
|
.Ve $Revision: 8.704 $
|
||||||
.rm Ve
|
.rm Ve
|
||||||
.sp
|
.sp
|
||||||
For Sendmail Version 8.13
|
For Sendmail Version 8.13
|
||||||
@ -1621,7 +1621,7 @@ the
|
|||||||
.i address
|
.i address
|
||||||
part of the triple is looked up as the key
|
part of the triple is looked up as the key
|
||||||
(i.e., the left hand side)
|
(i.e., the left hand side)
|
||||||
into the alias database.
|
in the alias database.
|
||||||
If there is a match, the address is deleted from the send queue
|
If there is a match, the address is deleted from the send queue
|
||||||
and all addresses on the right hand side of the alias
|
and all addresses on the right hand side of the alias
|
||||||
are added in place of the alias that was found.
|
are added in place of the alias that was found.
|
||||||
@ -3916,6 +3916,11 @@ The complete syntax for ruleset 0 is:
|
|||||||
This specifies the
|
This specifies the
|
||||||
{mailer, host, user}
|
{mailer, host, user}
|
||||||
3-tuple necessary to direct the mailer.
|
3-tuple necessary to direct the mailer.
|
||||||
|
Note: the third element (
|
||||||
|
.i user
|
||||||
|
) is often also called
|
||||||
|
.i address
|
||||||
|
part.
|
||||||
If the mailer is local
|
If the mailer is local
|
||||||
the host part may be omitted\**.
|
the host part may be omitted\**.
|
||||||
.(f
|
.(f
|
||||||
@ -4781,7 +4786,8 @@ command line flag or by the SMTP server code.
|
|||||||
Sender's host name.
|
Sender's host name.
|
||||||
Set from the
|
Set from the
|
||||||
.b \-p
|
.b \-p
|
||||||
command line flag or by the SMTP server code.
|
command line flag or by the SMTP server code
|
||||||
|
(in which case it is set to the EHLO/HELO parameter).
|
||||||
.ip $t
|
.ip $t
|
||||||
A numeric representation of the current time in the format YYYYMMDDHHmm
|
A numeric representation of the current time in the format YYYYMMDDHHmm
|
||||||
(4 digit year 1900-9999, 2 digit month 01-12, 2 digit day 01-31,
|
(4 digit year 1900-9999, 2 digit month 01-12, 2 digit day 01-31,
|
||||||
@ -5514,7 +5520,7 @@ set to be the set of all names
|
|||||||
this host is known by.
|
this host is known by.
|
||||||
This can be used to match local hostnames.
|
This can be used to match local hostnames.
|
||||||
.ip $={persistentMacros}
|
.ip $={persistentMacros}
|
||||||
set to the macros would should be saved across queue runs.
|
set to the macros that should be saved across queue runs.
|
||||||
Care should be taken when adding macro names to this class.
|
Care should be taken when adding macro names to this class.
|
||||||
.pp
|
.pp
|
||||||
.i Sendmail
|
.i Sendmail
|
||||||
@ -5596,7 +5602,8 @@ Run Extended SMTP (ESMTP) protocol (defined in RFCs 1869, 1652, and 1870).
|
|||||||
This flag defaults on if the SMTP greeting message includes the word
|
This flag defaults on if the SMTP greeting message includes the word
|
||||||
.q ESMTP .
|
.q ESMTP .
|
||||||
.ip A
|
.ip A
|
||||||
Look up the user part of the address in the alias database.
|
Look up the user (address) part of the resolved mailer triple,
|
||||||
|
in the alias database.
|
||||||
Normally this is only set for local mailers.
|
Normally this is only set for local mailers.
|
||||||
.ip b
|
.ip b
|
||||||
Force a blank line on the end of a message.
|
Force a blank line on the end of a message.
|
||||||
@ -11310,7 +11317,7 @@ replace it with a blank sheet for double-sided output.
|
|||||||
.\".sz 10
|
.\".sz 10
|
||||||
.\"Eric Allman
|
.\"Eric Allman
|
||||||
.\".sp
|
.\".sp
|
||||||
.\"Version $Revision: 8.699 $
|
.\"Version $Revision: 8.704 $
|
||||||
.\".ce 0
|
.\".ce 0
|
||||||
.bp 3
|
.bp 3
|
||||||
.ce
|
.ce
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
@ -10,7 +10,7 @@
|
|||||||
* the sendmail distribution.
|
* the sendmail distribution.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* $Id: conf.h,v 1.118 2004/08/20 20:30:32 ca Exp $
|
* $Id: conf.h,v 1.120 2005/03/22 22:07:53 ca Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -161,6 +161,8 @@ extern void hard_syslog();
|
|||||||
|
|
||||||
# ifdef _AIX5
|
# ifdef _AIX5
|
||||||
# define _AIX4 40300
|
# define _AIX4 40300
|
||||||
|
# define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */
|
||||||
|
# define SOCKOPT_LEN_T socklen_t /* arg#5 to getsockopt */
|
||||||
# if _AIX5 >= 50200
|
# if _AIX5 >= 50200
|
||||||
# define HASUNSETENV 1 /* has unsetenv(3) call */
|
# define HASUNSETENV 1 /* has unsetenv(3) call */
|
||||||
# endif /* _AIX5 >= 50200 */
|
# endif /* _AIX5 >= 50200 */
|
||||||
@ -175,10 +177,14 @@ extern void hard_syslog();
|
|||||||
# define BSD4_4_SOCKADDR /* has sa_len */
|
# define BSD4_4_SOCKADDR /* has sa_len */
|
||||||
# define USESETEUID 1 /* seteuid(2) works */
|
# define USESETEUID 1 /* seteuid(2) works */
|
||||||
# define TZ_TYPE TZ_NAME /* use tzname[] vector */
|
# define TZ_TYPE TZ_NAME /* use tzname[] vector */
|
||||||
# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
|
# ifndef SOCKOPT_LEN_T
|
||||||
|
# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
|
||||||
|
# endif /* SOCKOPT_LEN_T */
|
||||||
# if _AIX4 >= 40200
|
# if _AIX4 >= 40200
|
||||||
# define HASSETREUID 1 /* setreuid(2) works as of AIX 4.2 */
|
# define HASSETREUID 1 /* setreuid(2) works as of AIX 4.2 */
|
||||||
# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
|
# ifndef SOCKADDR_LEN_T
|
||||||
|
# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
|
||||||
|
# endif /* SOCKADDR_LEN_T */
|
||||||
# endif /* _AIX4 >= 40200 */
|
# endif /* _AIX4 >= 40200 */
|
||||||
# if defined(_ILS_MACROS) /* IBM versions aren't side-effect clean */
|
# if defined(_ILS_MACROS) /* IBM versions aren't side-effect clean */
|
||||||
# undef isascii
|
# undef isascii
|
||||||
@ -208,7 +214,9 @@ extern void hard_syslog();
|
|||||||
# define GIDSET_T gid_t
|
# define GIDSET_T gid_t
|
||||||
# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
|
# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
|
||||||
# define SPT_PADCHAR '\0' /* pad process title with nulls */
|
# define SPT_PADCHAR '\0' /* pad process title with nulls */
|
||||||
# define LA_TYPE LA_INT
|
# ifndef LA_TYPE
|
||||||
|
# define LA_TYPE LA_INT
|
||||||
|
# endif /* LA_TYPE */
|
||||||
# define FSHIFT 16
|
# define FSHIFT 16
|
||||||
# define LA_AVENRUN "avenrun"
|
# define LA_AVENRUN "avenrun"
|
||||||
# if !defined(_AIX4) || _AIX4 < 40300
|
# if !defined(_AIX4) || _AIX4 < 40300
|
||||||
@ -1125,7 +1133,7 @@ typedef short pid_t;
|
|||||||
# define _SCO_unix_4_2
|
# define _SCO_unix_4_2
|
||||||
# else /* ! _SCO_unix_4_2 */
|
# else /* ! _SCO_unix_4_2 */
|
||||||
# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
|
# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
|
||||||
# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
|
# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
|
||||||
# endif /* ! _SCO_unix_4_2 */
|
# endif /* ! _SCO_unix_4_2 */
|
||||||
# endif /* _SCO_DS >= 1 */
|
# endif /* _SCO_DS >= 1 */
|
||||||
|
|
||||||
@ -1819,7 +1827,7 @@ extern struct passwd * sendmail_mpe_getpwuid __P((uid_t));
|
|||||||
# define HASWAITPID 1
|
# define HASWAITPID 1
|
||||||
# define HASGETDTABLESIZE 1
|
# define HASGETDTABLESIZE 1
|
||||||
# define GIDSET_T gid_t
|
# define GIDSET_T gid_t
|
||||||
# define SOCKADDR_LEN_T size_t
|
# define SOCKADDR_LEN_T size_t
|
||||||
# define SOCKOPT_LEN_T size_t
|
# define SOCKOPT_LEN_T size_t
|
||||||
# ifndef _PATH_UNIX
|
# ifndef _PATH_UNIX
|
||||||
# define _PATH_UNIX "/stand/unix"
|
# define _PATH_UNIX "/stand/unix"
|
||||||
|
59
contrib/sendmail/include/sm/sem.h
Normal file
59
contrib/sendmail/include/sm/sem.h
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2000-2001, 2005 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.
|
||||||
|
*
|
||||||
|
* $Id: sem.h,v 1.9 2005/02/17 22:08:58 ca Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef SM_SEM_H
|
||||||
|
# define SM_SEM_H 1
|
||||||
|
|
||||||
|
#include <sm/gen.h>
|
||||||
|
|
||||||
|
/* key for semaphores */
|
||||||
|
# define SM_SEM_KEY (41L)
|
||||||
|
# define SM_SEM_NO_ID (-1)
|
||||||
|
# define SM_NO_SEM(id) ((id) < 0)
|
||||||
|
|
||||||
|
# if SM_CONF_SEM > 0
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/ipc.h>
|
||||||
|
# include <sys/sem.h>
|
||||||
|
|
||||||
|
# if SM_CONF_SEM == 2
|
||||||
|
union semun
|
||||||
|
{
|
||||||
|
int val;
|
||||||
|
struct semid_ds *buf;
|
||||||
|
ushort *array;
|
||||||
|
};
|
||||||
|
# endif /* SM_CONF_SEM == 2 */
|
||||||
|
|
||||||
|
# ifndef SEM_A
|
||||||
|
# define SEM_A 0200
|
||||||
|
# endif /* SEM_A */
|
||||||
|
# ifndef SEM_R
|
||||||
|
# define SEM_R 0400
|
||||||
|
# endif /* SEM_R */
|
||||||
|
|
||||||
|
# define SM_NSEM 1
|
||||||
|
|
||||||
|
extern int sm_sem_start __P((key_t, int, int, bool));
|
||||||
|
extern int sm_sem_stop __P((int));
|
||||||
|
extern int sm_sem_acq __P((int, int, int));
|
||||||
|
extern int sm_sem_rel __P((int, int, int));
|
||||||
|
extern int sm_sem_get __P((int, int));
|
||||||
|
|
||||||
|
# else /* SM_CONF_SEM > 0 */
|
||||||
|
# define sm_sem_start(key, nsem, semflg, owner) 0
|
||||||
|
# define sm_sem_stop(semid) 0
|
||||||
|
# define sm_sem_acq(semid, semnum, timeout) 0
|
||||||
|
# define sm_sem_rel(semid, semnum, timeout) 0
|
||||||
|
# define sm_sem_get(semid, semnum) 0
|
||||||
|
# endif /* SM_CONF_SEM > 0 */
|
||||||
|
|
||||||
|
#endif /* ! SM_SEM_H */
|
@ -1,12 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2003 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 2000-2003, 2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* By using this file, you agree to the terms and conditions set
|
* 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
|
* forth in the LICENSE file which can be found at the top level of
|
||||||
* the sendmail distribution.
|
* the sendmail distribution.
|
||||||
*
|
*
|
||||||
* $Id: shm.h,v 1.10 2003/05/17 18:34:54 ca Exp $
|
* $Id: shm.h,v 1.11 2005/01/13 22:57:04 ca Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef SM_SHM_H
|
#ifndef SM_SHM_H
|
||||||
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
extern void *sm_shmstart __P((key_t, int , int , int *, bool));
|
extern void *sm_shmstart __P((key_t, int , int , int *, bool));
|
||||||
extern int sm_shmstop __P((void *, int, bool));
|
extern int sm_shmstop __P((void *, int, bool));
|
||||||
|
extern int sm_shmsetowner __P((int, uid_t, gid_t, mode_t));
|
||||||
|
|
||||||
|
|
||||||
/* for those braindead systems... (e.g., SunOS 4) */
|
/* for those braindead systems... (e.g., SunOS 4) */
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
dnl $Id: Makefile.m4,v 1.67 2004/08/20 20:42:14 ca Exp $
|
dnl $Id: Makefile.m4,v 1.68 2005/02/17 23:34:25 ca Exp $
|
||||||
define(`confREQUIRE_LIBUNIX')
|
define(`confREQUIRE_LIBUNIX')
|
||||||
include(confBUILDTOOLSDIR`/M4/switch.m4')
|
include(confBUILDTOOLSDIR`/M4/switch.m4')
|
||||||
|
|
||||||
define(`confREQUIRE_LIBSM', `true')
|
define(`confREQUIRE_LIBSM', `true')
|
||||||
PREPENDDEF(`confENVDEF', `confMAPDEF')
|
PREPENDDEF(`confENVDEF', `confMAPDEF')
|
||||||
bldPRODUCT_START(`library', `libsm')
|
bldPRODUCT_START(`library', `libsm')
|
||||||
define(`bldSOURCES', ` 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 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 strio.c ungetc.c vasprintf.c vfprintf.c vfscanf.c vprintf.c vsnprintf.c wbuf.c wsetup.c string.c stringf.c xtrap.c strto.c test.c path.c strcasecmp.c strrevcmp.c signal.c clock.c config.c shm.c mbdb.c strexit.c cf.c ldap.c niprop.c mpeix.c ')
|
define(`bldSOURCES', ` 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 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 strio.c ungetc.c vasprintf.c vfprintf.c vfscanf.c vprintf.c vsnprintf.c wbuf.c wsetup.c string.c stringf.c xtrap.c strto.c test.c path.c strcasecmp.c strrevcmp.c signal.c clock.c config.c shm.c sem.c mbdb.c strexit.c cf.c ldap.c niprop.c mpeix.c ')
|
||||||
bldPRODUCT_END
|
bldPRODUCT_END
|
||||||
dnl sem.c msg.c
|
dnl msg.c
|
||||||
dnl syslogio.c
|
dnl syslogio.c
|
||||||
|
|
||||||
include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/sm-test.m4')
|
include(confBUILDTOOLSDIR`/M4/'bldM4_TYPE_DIR`/sm-test.m4')
|
||||||
@ -27,7 +27,7 @@ smtest(`t-path', `run')
|
|||||||
smtest(`t-float', `run')
|
smtest(`t-float', `run')
|
||||||
smtest(`t-scanf', `run')
|
smtest(`t-scanf', `run')
|
||||||
smtest(`t-shm', `run')
|
smtest(`t-shm', `run')
|
||||||
dnl smtest(`t-sem', `run')
|
smtest(`t-sem', `run')
|
||||||
dnl smtest(`t-msg', `run')
|
dnl smtest(`t-msg', `run')
|
||||||
smtest(`t-cf')
|
smtest(`t-cf')
|
||||||
smtest(`b-strcmp')
|
smtest(`b-strcmp')
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 2001-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* By using this file, you agree to the terms and conditions set
|
* By using this file, you agree to the terms and conditions set
|
||||||
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sm/gen.h>
|
#include <sm/gen.h>
|
||||||
SM_RCSID("@(#)$Id: ldap.c,v 1.60 2004/08/03 20:42:21 ca Exp $")
|
SM_RCSID("@(#)$Id: ldap.c,v 1.62 2005/02/24 00:30:01 ca Exp $")
|
||||||
|
|
||||||
#if LDAPMAP
|
#if LDAPMAP
|
||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
@ -589,7 +589,9 @@ sm_ldap_results(lmap, msgid, flags, delim, rpool, result,
|
|||||||
LDAPMessage *entry;
|
LDAPMessage *entry;
|
||||||
|
|
||||||
/* If we don't want multiple values and we have one, break */
|
/* If we don't want multiple values and we have one, break */
|
||||||
if ((char) delim == '\0' && *result != NULL)
|
if ((char) delim == '\0' &&
|
||||||
|
!bitset(SM_LDAP_SINGLEMATCH, flags) &&
|
||||||
|
*result != NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Cycle through all entries */
|
/* Cycle through all entries */
|
||||||
@ -767,19 +769,17 @@ sm_ldap_results(lmap, msgid, flags, delim, rpool, result,
|
|||||||
if (*result != NULL)
|
if (*result != NULL)
|
||||||
{
|
{
|
||||||
/* already have a value */
|
/* already have a value */
|
||||||
|
if (bitset(SM_LDAP_SINGLEMATCH,
|
||||||
|
flags))
|
||||||
|
{
|
||||||
|
/* only wanted one match */
|
||||||
|
SM_LDAP_ERROR_CLEANUP();
|
||||||
|
errno = ENOENT;
|
||||||
|
return EX_NOTFOUND;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitset(SM_LDAP_SINGLEMATCH,
|
|
||||||
flags) &&
|
|
||||||
*result != NULL)
|
|
||||||
{
|
|
||||||
/* only wanted one match */
|
|
||||||
SM_LDAP_ERROR_CLEANUP();
|
|
||||||
errno = ENOENT;
|
|
||||||
return EX_NOTFOUND;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lmap->ldap_attrsonly == LDAPMAP_TRUE)
|
if (lmap->ldap_attrsonly == LDAPMAP_TRUE)
|
||||||
{
|
{
|
||||||
*result = sm_rpool_strdup_x(rpool,
|
*result = sm_rpool_strdup_x(rpool,
|
||||||
@ -990,7 +990,9 @@ sm_ldap_results(lmap, msgid, flags, delim, rpool, result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We don't want multiple values and we have one */
|
/* We don't want multiple values and we have one */
|
||||||
if ((char) delim == '\0' && *result != NULL)
|
if ((char) delim == '\0' &&
|
||||||
|
!bitset(SM_LDAP_SINGLEMATCH, flags) &&
|
||||||
|
*result != NULL)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
save_errno = sm_ldap_geterrno(lmap->ldap_ld);
|
save_errno = sm_ldap_geterrno(lmap->ldap_ld);
|
||||||
|
201
contrib/sendmail/libsm/sem.c
Normal file
201
contrib/sendmail/libsm/sem.c
Normal file
@ -0,0 +1,201 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2000-2001, 2005 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sm/gen.h>
|
||||||
|
SM_RCSID("@(#)$Id: sem.c,v 1.12 2005/03/25 21:27:02 ca Exp $")
|
||||||
|
|
||||||
|
#if SM_CONF_SEM
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <sm/sem.h>
|
||||||
|
# include <sm/heap.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SM_SEM_START -- initialize semaphores
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** key -- key for semaphores.
|
||||||
|
** nsem -- number of semaphores.
|
||||||
|
** semflg -- flag for semget(), if 0, use a default.
|
||||||
|
** owner -- create semaphores.
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** id for semaphores.
|
||||||
|
** < 0 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
sm_sem_start(key, nsem, semflg, owner)
|
||||||
|
key_t key;
|
||||||
|
int nsem;
|
||||||
|
int semflg;
|
||||||
|
bool owner;
|
||||||
|
{
|
||||||
|
int semid, i;
|
||||||
|
unsigned short *semvals;
|
||||||
|
|
||||||
|
semvals = NULL;
|
||||||
|
if (semflg == 0)
|
||||||
|
semflg = (SEM_A|SEM_R)|((SEM_A|SEM_R) >> 3);
|
||||||
|
if (owner)
|
||||||
|
semflg |= IPC_CREAT|IPC_EXCL;
|
||||||
|
semid = semget(key, nsem, semflg);
|
||||||
|
if (semid < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
|
if (owner)
|
||||||
|
{
|
||||||
|
union semun semarg;
|
||||||
|
|
||||||
|
semvals = (unsigned short *) sm_malloc(nsem * sizeof semvals);
|
||||||
|
if (semvals == NULL)
|
||||||
|
goto error;
|
||||||
|
semarg.array = semvals;
|
||||||
|
|
||||||
|
/* initialize semaphore values to be available */
|
||||||
|
for (i = 0; i < nsem; i++)
|
||||||
|
semvals[i] = 1;
|
||||||
|
if (semctl(semid, 0, SETALL, semarg) < 0)
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
return semid;
|
||||||
|
|
||||||
|
error:
|
||||||
|
if (semvals != NULL)
|
||||||
|
sm_free(semvals);
|
||||||
|
if (semid >= 0)
|
||||||
|
sm_sem_stop(semid);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SM_SEM_STOP -- stop using semaphores.
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** semid -- id for semaphores.
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** 0 on success.
|
||||||
|
** < 0 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
sm_sem_stop(semid)
|
||||||
|
int semid;
|
||||||
|
{
|
||||||
|
return semctl(semid, 0, IPC_RMID, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SM_SEM_ACQ -- acquire semaphore.
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** semid -- id for semaphores.
|
||||||
|
** semnum -- number of semaphore.
|
||||||
|
** timeout -- how long to wait for operation to succeed.
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** 0 on success.
|
||||||
|
** < 0 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
sm_sem_acq(semid, semnum, timeout)
|
||||||
|
int semid;
|
||||||
|
int semnum;
|
||||||
|
int timeout;
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
struct sembuf semops[1];
|
||||||
|
|
||||||
|
semops[0].sem_num = semnum;
|
||||||
|
semops[0].sem_op = -1;
|
||||||
|
semops[0].sem_flg = SEM_UNDO |
|
||||||
|
(timeout != SM_TIME_FOREVER ? 0 : IPC_NOWAIT);
|
||||||
|
if (timeout == SM_TIME_IMMEDIATE || timeout == SM_TIME_FOREVER)
|
||||||
|
return semop(semid, semops, 1);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = semop(semid, semops, 1);
|
||||||
|
if (r == 0)
|
||||||
|
return r;
|
||||||
|
sleep(1);
|
||||||
|
--timeout;
|
||||||
|
} while (timeout > 0);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SM_SEM_REL -- release semaphore.
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** semid -- id for semaphores.
|
||||||
|
** semnum -- number of semaphore.
|
||||||
|
** timeout -- how long to wait for operation to succeed.
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** 0 on success.
|
||||||
|
** < 0 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
sm_sem_rel(semid, semnum, timeout)
|
||||||
|
int semid;
|
||||||
|
int semnum;
|
||||||
|
int timeout;
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
struct sembuf semops[1];
|
||||||
|
|
||||||
|
#if PARANOID
|
||||||
|
/* XXX should we check whether the value is already 0 ? */
|
||||||
|
SM_REQUIRE(sm_get_sem(semid, semnum) > 0);
|
||||||
|
#endif /* PARANOID */
|
||||||
|
|
||||||
|
semops[0].sem_num = semnum;
|
||||||
|
semops[0].sem_op = 1;
|
||||||
|
semops[0].sem_flg = SEM_UNDO |
|
||||||
|
(timeout != SM_TIME_FOREVER ? 0 : IPC_NOWAIT);
|
||||||
|
if (timeout == SM_TIME_IMMEDIATE || timeout == SM_TIME_FOREVER)
|
||||||
|
return semop(semid, semops, 1);
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = semop(semid, semops, 1);
|
||||||
|
if (r == 0)
|
||||||
|
return r;
|
||||||
|
sleep(1);
|
||||||
|
--timeout;
|
||||||
|
} while (timeout > 0);
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SM_SEM_GET -- get semaphore value.
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** semid -- id for semaphores.
|
||||||
|
** semnum -- number of semaphore.
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** value of semaphore on success.
|
||||||
|
** < 0 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
sm_sem_get(semid, semnum)
|
||||||
|
int semid;
|
||||||
|
int semnum;
|
||||||
|
{
|
||||||
|
int semval;
|
||||||
|
|
||||||
|
if ((semval = semctl(semid, semnum, GETVAL, NULL)) < 0)
|
||||||
|
return -1;
|
||||||
|
return semval;
|
||||||
|
}
|
||||||
|
#endif /* SM_CONF_SEM */
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2001, 2003 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 2000-2001, 2003, 2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* By using this file, you agree to the terms and conditions set
|
* By using this file, you agree to the terms and conditions set
|
||||||
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sm/gen.h>
|
#include <sm/gen.h>
|
||||||
SM_RCSID("@(#)$Id: shm.c,v 1.16 2003/06/13 21:18:08 ca Exp $")
|
SM_RCSID("@(#)$Id: shm.c,v 1.18 2005/02/09 01:54:51 ca Exp $")
|
||||||
|
|
||||||
#if SM_CONF_SHM
|
#if SM_CONF_SHM
|
||||||
# include <stdlib.h>
|
# include <stdlib.h>
|
||||||
@ -104,4 +104,38 @@ sm_shmstop(shm, shmid, owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SM_SHMSETOWNER -- set owner/group/mode of shared memory segment.
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** shmid -- id.
|
||||||
|
** uid -- uid to use
|
||||||
|
** gid -- gid to use
|
||||||
|
** mode -- mode to use
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** 0 on success.
|
||||||
|
** < 0 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int
|
||||||
|
sm_shmsetowner(shmid, uid, gid, mode)
|
||||||
|
int shmid;
|
||||||
|
uid_t uid;
|
||||||
|
gid_t gid;
|
||||||
|
mode_t mode;
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
struct shmid_ds shmid_ds;
|
||||||
|
|
||||||
|
memset(&shmid_ds, 0, sizeof(shmid_ds));
|
||||||
|
if ((r = shmctl(shmid, IPC_STAT, &shmid_ds)) < 0)
|
||||||
|
return r;
|
||||||
|
shmid_ds.shm_perm.uid = uid;
|
||||||
|
shmid_ds.shm_perm.gid = gid;
|
||||||
|
shmid_ds.shm_perm.mode = mode;
|
||||||
|
if ((r = shmctl(shmid, IPC_SET, &shmid_ds)) < 0)
|
||||||
|
return r;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
#endif /* SM_CONF_SHM */
|
#endif /* SM_CONF_SHM */
|
||||||
|
344
contrib/sendmail/libsm/t-sem.c
Normal file
344
contrib/sendmail/libsm/t-sem.c
Normal file
@ -0,0 +1,344 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2000-2001 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <sm/gen.h>
|
||||||
|
SM_RCSID("@(#)$Id: t-sem.c,v 1.14 2005/03/25 21:27:41 ca Exp $")
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#if SM_CONF_SEM
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <sysexits.h>
|
||||||
|
# include <sm/heap.h>
|
||||||
|
# include <sm/string.h>
|
||||||
|
# include <sm/signal.h>
|
||||||
|
# include <sm/test.h>
|
||||||
|
# include <sm/sem.h>
|
||||||
|
|
||||||
|
static void
|
||||||
|
delay(t, s)
|
||||||
|
int t;
|
||||||
|
char *s;
|
||||||
|
{
|
||||||
|
if (t > 0)
|
||||||
|
{
|
||||||
|
#if DEBUG
|
||||||
|
fprintf(stderr, "sleep(%d) before %s\n", t, s);
|
||||||
|
#endif /* DEBUG */
|
||||||
|
sleep(t);
|
||||||
|
}
|
||||||
|
#if DEBUG
|
||||||
|
fprintf(stderr, "%s\n", s);
|
||||||
|
#endif /* DEBUG */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SEMINTER -- interactive testing of semaphores.
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** owner -- create semaphores.
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** 0 on success
|
||||||
|
** < 0 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int
|
||||||
|
seminter(owner)
|
||||||
|
bool owner;
|
||||||
|
{
|
||||||
|
int semid;
|
||||||
|
int t;
|
||||||
|
|
||||||
|
semid = sm_sem_start(SM_SEM_KEY, SM_NSEM, 0, owner);
|
||||||
|
if (semid < 0)
|
||||||
|
{
|
||||||
|
perror("sm_sem_start failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((t = getchar()) != EOF)
|
||||||
|
{
|
||||||
|
switch (t)
|
||||||
|
{
|
||||||
|
case 'a':
|
||||||
|
delay(0, "try to acq");
|
||||||
|
if (sm_sem_acq(semid, 0, 2) < 0)
|
||||||
|
{
|
||||||
|
perror("sm_sem_acq failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
delay(0, "acquired");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'r':
|
||||||
|
delay(0, "try to rel");
|
||||||
|
if (sm_sem_rel(semid, 0, 2) < 0)
|
||||||
|
{
|
||||||
|
perror("sm_sem_rel failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
delay(0, "released");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'v':
|
||||||
|
if ((t = sm_sem_get(semid, 0)) < 0)
|
||||||
|
{
|
||||||
|
perror("get_sem failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
printf("semval: %d\n", t);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (owner)
|
||||||
|
return sm_sem_stop(semid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SEM_CLEANUP -- cleanup if something breaks
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** sig -- signal.
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** none.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int semid_c = -1;
|
||||||
|
void
|
||||||
|
sem_cleanup(sig)
|
||||||
|
int sig;
|
||||||
|
{
|
||||||
|
if (semid_c >= 0)
|
||||||
|
(void) sm_sem_stop(semid_c);
|
||||||
|
exit(EX_UNAVAILABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** SEMTEST -- test of semaphores
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** owner -- create semaphores.
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** 0 on success
|
||||||
|
** < 0 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
# define MAX_CNT 10
|
||||||
|
|
||||||
|
static int
|
||||||
|
semtest(owner)
|
||||||
|
int owner;
|
||||||
|
{
|
||||||
|
int semid, r;
|
||||||
|
int cnt = 0;
|
||||||
|
|
||||||
|
semid = sm_sem_start(SM_SEM_KEY, 1, 0, owner);
|
||||||
|
if (semid < 0)
|
||||||
|
{
|
||||||
|
perror("sm_sem_start failed");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (owner)
|
||||||
|
{
|
||||||
|
/* just in case someone kills the program... */
|
||||||
|
semid_c = semid;
|
||||||
|
(void) sm_signal(SIGHUP, sem_cleanup);
|
||||||
|
(void) sm_signal(SIGINT, sem_cleanup);
|
||||||
|
(void) sm_signal(SIGTERM, sem_cleanup);
|
||||||
|
|
||||||
|
delay(1, "parent: acquire 1");
|
||||||
|
cnt = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = sm_sem_acq(semid, 0, 0);
|
||||||
|
if (r < 0)
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
} while (r < 0 && cnt <= MAX_CNT);
|
||||||
|
SM_TEST(r >= 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
delay(3, "parent: release 1");
|
||||||
|
cnt = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = sm_sem_rel(semid, 0, 0);
|
||||||
|
if (r < 0)
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
} while (r < 0 && cnt <= MAX_CNT);
|
||||||
|
SM_TEST(r >= 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
delay(1, "parent: getval");
|
||||||
|
cnt = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = sm_sem_get(semid, 0);
|
||||||
|
if (r <= 0)
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
} while (r <= 0 && cnt <= MAX_CNT);
|
||||||
|
SM_TEST(r > 0);
|
||||||
|
if (r <= 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
delay(1, "parent: acquire 2");
|
||||||
|
cnt = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = sm_sem_acq(semid, 0, 0);
|
||||||
|
if (r < 0)
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
} while (r < 0 && cnt <= MAX_CNT);
|
||||||
|
SM_TEST(r >= 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
cnt = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = sm_sem_rel(semid, 0, 0);
|
||||||
|
if (r < 0)
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
} while (r < 0 && cnt <= MAX_CNT);
|
||||||
|
SM_TEST(r >= 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delay(1, "child: acquire 1");
|
||||||
|
cnt = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = sm_sem_acq(semid, 0, 0);
|
||||||
|
if (r < 0)
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
} while (r < 0 && cnt <= MAX_CNT);
|
||||||
|
SM_TEST(r >= 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
delay(1, "child: release 1");
|
||||||
|
cnt = 0;
|
||||||
|
do
|
||||||
|
{
|
||||||
|
r = sm_sem_rel(semid, 0, 0);
|
||||||
|
if (r < 0)
|
||||||
|
{
|
||||||
|
sleep(1);
|
||||||
|
++cnt;
|
||||||
|
}
|
||||||
|
} while (r < 0 && cnt <= MAX_CNT);
|
||||||
|
SM_TEST(r >= 0);
|
||||||
|
if (r < 0)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (owner)
|
||||||
|
return sm_sem_stop(semid);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
{
|
||||||
|
bool interactive = false;
|
||||||
|
bool owner = false;
|
||||||
|
int ch;
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
|
# define OPTIONS "io"
|
||||||
|
while ((ch = getopt(argc, argv, OPTIONS)) != -1)
|
||||||
|
{
|
||||||
|
switch ((char) ch)
|
||||||
|
{
|
||||||
|
case 'i':
|
||||||
|
interactive = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'o':
|
||||||
|
owner = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (interactive)
|
||||||
|
r = seminter(owner);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
printf("This test takes about 8 seconds.\n");
|
||||||
|
printf("If it takes longer than 30 second, please interrupt it\n");
|
||||||
|
printf("and compile again without semaphore support, i.e.,");
|
||||||
|
printf("-DSM_CONF_SEM=0\n");
|
||||||
|
if ((pid = fork()) < 0)
|
||||||
|
{
|
||||||
|
perror("fork failed\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sm_test_begin(argc, argv, "test semaphores");
|
||||||
|
if (pid == 0)
|
||||||
|
{
|
||||||
|
/* give the parent the chance to setup data */
|
||||||
|
sleep(1);
|
||||||
|
r = semtest(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r = semtest(true);
|
||||||
|
}
|
||||||
|
SM_TEST(r == 0);
|
||||||
|
return sm_test_end();
|
||||||
|
}
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
#else /* SM_CONF_SEM */
|
||||||
|
int
|
||||||
|
main(argc, argv)
|
||||||
|
int argc;
|
||||||
|
char *argv[];
|
||||||
|
{
|
||||||
|
printf("No support for semaphores configured on this machine\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif /* SM_CONF_SEM */
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2002, 2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 2000-2002, 2004, 2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* By using this file, you agree to the terms and conditions set
|
* By using this file, you agree to the terms and conditions set
|
||||||
@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sm/gen.h>
|
#include <sm/gen.h>
|
||||||
SM_RCSID("@(#)$Id: t-shm.c,v 1.20 2004/08/03 20:51:36 ca Exp $")
|
SM_RCSID("@(#)$Id: t-shm.c,v 1.22 2005/01/14 02:14:10 ca Exp $")
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
@ -83,6 +83,10 @@ shminter(owner)
|
|||||||
case 'v':
|
case 'v':
|
||||||
printf("shmval: %d\n", *shm);
|
printf("shmval: %d\n", *shm);
|
||||||
break;
|
break;
|
||||||
|
case 'S':
|
||||||
|
i = sm_shmsetowner(shmid, getuid(), getgid(), 0644);
|
||||||
|
printf("sm_shmsetowner=%d\n", i);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sm_shmstop((void *) shm, shmid, owner);
|
return sm_shmstop((void *) shm, shmid, owner);
|
||||||
@ -165,6 +169,8 @@ shmtest(owner)
|
|||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
r = sm_shmsetowner(shmid, getuid(), getgid(), 0660);
|
||||||
|
SM_TEST(r == 0);
|
||||||
*shm = 1;
|
*shm = 1;
|
||||||
while (*shm == 1 && cnt++ < MAX_CNT)
|
while (*shm == 1 && cnt++ < MAX_CNT)
|
||||||
sleep(1);
|
sleep(1);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
# the sendmail distribution.
|
# the sendmail distribution.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# $Id: README,v 8.385 2004/11/25 06:52:06 msk Exp $
|
# $Id: README,v 8.386 2005/03/04 23:24:08 ca Exp $
|
||||||
#
|
#
|
||||||
|
|
||||||
This directory contains the source files for sendmail(TM).
|
This directory contains the source files for sendmail(TM).
|
||||||
@ -375,6 +375,9 @@ LA_TYPE The type of load average your kernel supports. These
|
|||||||
LA_DEVSHORT (13) reads a short from a system file (default:
|
LA_DEVSHORT (13) reads a short from a system file (default:
|
||||||
/dev/table/avenrun) and scales it in the same manner
|
/dev/table/avenrun) and scales it in the same manner
|
||||||
as LA_SHORT.
|
as LA_SHORT.
|
||||||
|
LA_LONGLONG (17) to read /dev/kmem for the symbol avenrun and
|
||||||
|
interpret as a long long integer (e.g., for 64 bit
|
||||||
|
systems).
|
||||||
LA_INT, LA_SHORT, LA_FLOAT, and LA_READKSYM have several
|
LA_INT, LA_SHORT, LA_FLOAT, and LA_READKSYM have several
|
||||||
other parameters that they try to divine: the name of your
|
other parameters that they try to divine: the name of your
|
||||||
kernel, the name of the variable in the kernel to examine,
|
kernel, the name of the variable in the kernel to examine,
|
||||||
@ -1823,4 +1826,4 @@ util.c Some general purpose routines used by sendmail.
|
|||||||
version.c The version number and information about this
|
version.c The version number and information about this
|
||||||
version of sendmail.
|
version of sendmail.
|
||||||
|
|
||||||
(Version $Revision: 8.385 $, last update $Date: 2004/11/25 06:52:06 $ )
|
(Version $Revision: 8.386 $, last update $Date: 2005/03/04 23:24:08 $ )
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# $Id: TRACEFLAGS,v 8.42 2003/06/13 22:29:11 lijian Exp $
|
# $Id: TRACEFLAGS,v 8.43 2005/02/16 23:38:51 ca Exp $
|
||||||
0, 4 main.c main canonical name, UUCP node name, a.k.a.s
|
0, 4 main.c main canonical name, UUCP node name, a.k.a.s
|
||||||
0, 15 main.c main print configuration
|
0, 15 main.c main print configuration
|
||||||
0, 44 util.c printav print address of each string
|
0, 44 util.c printav print address of each string
|
||||||
@ -83,6 +83,7 @@
|
|||||||
#endif /* _FFR_QUEUE_SCHED_DBG */
|
#endif /* _FFR_QUEUE_SCHED_DBG */
|
||||||
70 queue.c quarantining
|
70 queue.c quarantining
|
||||||
71,>99 milter.c quarantine on errors
|
71,>99 milter.c quarantine on errors
|
||||||
|
73 queue.c shared memory updates
|
||||||
80 content length
|
80 content length
|
||||||
81 sun remote mode
|
81 sun remote mode
|
||||||
91 mci.c syslogging of MCI cache information
|
91 mci.c syslogging of MCI cache information
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: collect.c,v 8.260 2004/11/30 23:29:15 ca Exp $")
|
SM_RCSID("@(#)$Id: collect.c,v 8.261 2005/02/16 23:38:51 ca Exp $")
|
||||||
|
|
||||||
static void collecttimeout __P((int));
|
static void collecttimeout __P((int));
|
||||||
static void eatfrom __P((char *volatile, ENVELOPE *));
|
static void eatfrom __P((char *volatile, ENVELOPE *));
|
||||||
@ -728,6 +728,7 @@ collect(fp, smtpmode, hdrp, e, rsetsize)
|
|||||||
{
|
{
|
||||||
/* skip next few clauses */
|
/* skip next few clauses */
|
||||||
/* EMPTY */
|
/* EMPTY */
|
||||||
|
/* Note: updfs() is not called in this case! */
|
||||||
}
|
}
|
||||||
else if (sm_io_setinfo(df, SM_BF_COMMIT, NULL) < 0 && errno != EINVAL)
|
else if (sm_io_setinfo(df, SM_BF_COMMIT, NULL) < 0 && errno != EINVAL)
|
||||||
{
|
{
|
||||||
@ -781,7 +782,7 @@ collect(fp, smtpmode, hdrp, e, rsetsize)
|
|||||||
df = NULL;
|
df = NULL;
|
||||||
|
|
||||||
/* remove from available space in filesystem */
|
/* remove from available space in filesystem */
|
||||||
updfs(e, false, true);
|
updfs(e, 0, 1, "collect");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* An EOF when running SMTP is an error */
|
/* An EOF when running SMTP is an error */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: conf.c,v 8.1052 2004/12/15 22:45:55 ca Exp $")
|
SM_RCSID("@(#)$Id: conf.c,v 8.1061 2005/03/07 17:18:44 ca Exp $")
|
||||||
|
|
||||||
#include <sendmail/pathnames.h>
|
#include <sendmail/pathnames.h>
|
||||||
#if NEWDB
|
#if NEWDB
|
||||||
@ -1431,6 +1431,7 @@ init_vendor_macros(e)
|
|||||||
#define LA_DEVSHORT 13 /* read short from a device */
|
#define LA_DEVSHORT 13 /* read short from a device */
|
||||||
#define LA_ALPHAOSF 14 /* Digital UNIX (OSF/1 on Alpha) table() call */
|
#define LA_ALPHAOSF 14 /* Digital UNIX (OSF/1 on Alpha) table() call */
|
||||||
#define LA_PSET 15 /* Solaris per-processor-set load average */
|
#define LA_PSET 15 /* Solaris per-processor-set load average */
|
||||||
|
#define LA_LONGLONG 17 /* read kmem for avenrun; interpret as long long */
|
||||||
|
|
||||||
/* do guesses based on general OS type */
|
/* do guesses based on general OS type */
|
||||||
#ifndef LA_TYPE
|
#ifndef LA_TYPE
|
||||||
@ -1469,7 +1470,7 @@ init_vendor_macros(e)
|
|||||||
# define _PATH_KMEM "/dev/kmem"
|
# define _PATH_KMEM "/dev/kmem"
|
||||||
#endif /* ! _PATH_KMEM */
|
#endif /* ! _PATH_KMEM */
|
||||||
|
|
||||||
#if (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT)
|
#if (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG)
|
||||||
|
|
||||||
# include <nlist.h>
|
# include <nlist.h>
|
||||||
|
|
||||||
@ -1503,8 +1504,12 @@ getla()
|
|||||||
# else /* LA_TYPE == LA_INT */
|
# else /* LA_TYPE == LA_INT */
|
||||||
# if LA_TYPE == LA_SHORT
|
# if LA_TYPE == LA_SHORT
|
||||||
short avenrun[3];
|
short avenrun[3];
|
||||||
# else /* LA_TYPE == LA_SHORT */
|
# else
|
||||||
|
# if LA_TYPE == LA_LONGLONG
|
||||||
|
long long avenrun[3];
|
||||||
|
# else /* LA_TYPE == LA_LONGLONG */
|
||||||
double avenrun[3];
|
double avenrun[3];
|
||||||
|
# endif /* LA_TYPE == LA_LONGLONG */
|
||||||
# endif /* LA_TYPE == LA_SHORT */
|
# endif /* LA_TYPE == LA_SHORT */
|
||||||
# endif /* LA_TYPE == LA_INT */
|
# endif /* LA_TYPE == LA_INT */
|
||||||
extern off_t lseek();
|
extern off_t lseek();
|
||||||
@ -1570,7 +1575,7 @@ getla()
|
|||||||
sm_errstring(errno));
|
sm_errstring(errno));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
# if (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT)
|
# if (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG)
|
||||||
if (tTd(3, 5))
|
if (tTd(3, 5))
|
||||||
{
|
{
|
||||||
# if LA_TYPE == LA_SHORT
|
# if LA_TYPE == LA_SHORT
|
||||||
@ -1578,9 +1583,15 @@ getla()
|
|||||||
if (tTd(3, 15))
|
if (tTd(3, 15))
|
||||||
sm_dprintf(", %d, %d", avenrun[1], avenrun[2]);
|
sm_dprintf(", %d, %d", avenrun[1], avenrun[2]);
|
||||||
# else /* LA_TYPE == LA_SHORT */
|
# else /* LA_TYPE == LA_SHORT */
|
||||||
|
# if LA_TYPE == LA_LONGLONG
|
||||||
|
sm_dprintf("getla: avenrun = %lld", avenrun[0]);
|
||||||
|
if (tTd(3, 15))
|
||||||
|
sm_dprintf(", %lld, %lld", avenrun[1], avenrun[2]);
|
||||||
|
# else /* LA_TYPE == LA_LONGLONG */
|
||||||
sm_dprintf("getla: avenrun = %ld", avenrun[0]);
|
sm_dprintf("getla: avenrun = %ld", avenrun[0]);
|
||||||
if (tTd(3, 15))
|
if (tTd(3, 15))
|
||||||
sm_dprintf(", %ld, %ld", avenrun[1], avenrun[2]);
|
sm_dprintf(", %ld, %ld", avenrun[1], avenrun[2]);
|
||||||
|
# endif /* LA_TYPE == LA_LONGLONG */
|
||||||
# endif /* LA_TYPE == LA_SHORT */
|
# endif /* LA_TYPE == LA_SHORT */
|
||||||
sm_dprintf("\n");
|
sm_dprintf("\n");
|
||||||
}
|
}
|
||||||
@ -1588,7 +1599,7 @@ getla()
|
|||||||
sm_dprintf("getla: %d\n",
|
sm_dprintf("getla: %d\n",
|
||||||
(int) (avenrun[0] + FSCALE/2) >> FSHIFT);
|
(int) (avenrun[0] + FSCALE/2) >> FSHIFT);
|
||||||
return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
|
return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
|
||||||
# else /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) */
|
# else /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG) */
|
||||||
if (tTd(3, 5))
|
if (tTd(3, 5))
|
||||||
{
|
{
|
||||||
sm_dprintf("getla: avenrun = %g", avenrun[0]);
|
sm_dprintf("getla: avenrun = %g", avenrun[0]);
|
||||||
@ -1599,10 +1610,10 @@ getla()
|
|||||||
if (tTd(3, 1))
|
if (tTd(3, 1))
|
||||||
sm_dprintf("getla: %d\n", (int) (avenrun[0] +0.5));
|
sm_dprintf("getla: %d\n", (int) (avenrun[0] +0.5));
|
||||||
return ((int) (avenrun[0] + 0.5));
|
return ((int) (avenrun[0] + 0.5));
|
||||||
# endif /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) */
|
# endif /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG) */
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT) */
|
#endif /* (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT) || (LA_TYPE == LA_LONGLONG) */
|
||||||
|
|
||||||
#if LA_TYPE == LA_READKSYM
|
#if LA_TYPE == LA_READKSYM
|
||||||
|
|
||||||
@ -6040,6 +6051,10 @@ char *FFRCompileOptions[] =
|
|||||||
/* Problem noted by Anne Bennett of Concordia University */
|
/* Problem noted by Anne Bennett of Concordia University */
|
||||||
"_FFR_DIGUNIX_SAFECHOWN",
|
"_FFR_DIGUNIX_SAFECHOWN",
|
||||||
#endif /* _FFR_DIGUNIX_SAFECHOWN */
|
#endif /* _FFR_DIGUNIX_SAFECHOWN */
|
||||||
|
#if _FFR_DM_PER_DAEMON
|
||||||
|
/* DeliveryMode per DaemonPortOptions: 'D' */
|
||||||
|
"_FFR_DM_PER_DAEMON",
|
||||||
|
#endif /* _FFR_DM_PER_DAEMON */
|
||||||
#if _FFR_DNSMAP_ALIASABLE
|
#if _FFR_DNSMAP_ALIASABLE
|
||||||
/* Allow dns map type to be used for aliases. */
|
/* Allow dns map type to be used for aliases. */
|
||||||
/* Don Lewis of TDK */
|
/* Don Lewis of TDK */
|
||||||
@ -6170,6 +6185,10 @@ char *FFRCompileOptions[] =
|
|||||||
/* Disable PIPELINING, delay client if used. */
|
/* Disable PIPELINING, delay client if used. */
|
||||||
"_FFR_NO_PIPE",
|
"_FFR_NO_PIPE",
|
||||||
#endif /* _FFR_NO_PIPE */
|
#endif /* _FFR_NO_PIPE */
|
||||||
|
#if _FFR_LOG_NTRIES
|
||||||
|
/* log ntries=, from Nik Clayton of FreeBSD */
|
||||||
|
"_FFR_LOG_NTRIES",
|
||||||
|
#endif /* _FFR_LOG_NTRIES */
|
||||||
#if _FFR_PRIV_NOACTUALRECIPIENT
|
#if _FFR_PRIV_NOACTUALRECIPIENT
|
||||||
/*
|
/*
|
||||||
** PrivacyOptions=noactualrecipient stops sendmail from putting
|
** PrivacyOptions=noactualrecipient stops sendmail from putting
|
||||||
@ -6177,7 +6196,7 @@ char *FFRCompileOptions[] =
|
|||||||
** account that addresses map to. Patch from Dan Harkless.
|
** account that addresses map to. Patch from Dan Harkless.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
"_FFR_PRIV_NOACTUALRECIPIENT"
|
"_FFR_PRIV_NOACTUALRECIPIENT",
|
||||||
#endif /* _FFR_PRIV_NOACTUALRECIPIENT */
|
#endif /* _FFR_PRIV_NOACTUALRECIPIENT */
|
||||||
#if _FFR_QUEUEDELAY
|
#if _FFR_QUEUEDELAY
|
||||||
/* Exponential queue delay; disabled in 8.13 since it isn't used. */
|
/* Exponential queue delay; disabled in 8.13 since it isn't used. */
|
||||||
@ -6249,6 +6268,10 @@ char *FFRCompileOptions[] =
|
|||||||
/* Chris Adams of HiWAAY Informations Services */
|
/* Chris Adams of HiWAAY Informations Services */
|
||||||
"_FFR_SPT_ALIGN",
|
"_FFR_SPT_ALIGN",
|
||||||
#endif /* _FFR_SPT_ALIGN */
|
#endif /* _FFR_SPT_ALIGN */
|
||||||
|
#if _FFR_SS_PER_DAEMON
|
||||||
|
/* SuperSafe per DaemonPortOptions: 'T' (better letter?) */
|
||||||
|
"_FFR_SS_PER_DAEMON",
|
||||||
|
#endif /* _FFR_SS_PER_DAEMON */
|
||||||
#if _FFR_TIMERS
|
#if _FFR_TIMERS
|
||||||
/* Donated code (unused). */
|
/* Donated code (unused). */
|
||||||
"_FFR_TIMERS",
|
"_FFR_TIMERS",
|
||||||
@ -6266,6 +6289,9 @@ char *FFRCompileOptions[] =
|
|||||||
|
|
||||||
"_FFR_TRUSTED_QF",
|
"_FFR_TRUSTED_QF",
|
||||||
#endif /* _FFR_TRUSTED_QF */
|
#endif /* _FFR_TRUSTED_QF */
|
||||||
|
#if _FFR_USE_SEM_LOCKING
|
||||||
|
"_FFR_USE_SEM_LOCKING",
|
||||||
|
#endif /* _FFR_USE_SEM_LOCKING */
|
||||||
#if _FFR_USE_SETLOGIN
|
#if _FFR_USE_SETLOGIN
|
||||||
/* Use setlogin() */
|
/* Use setlogin() */
|
||||||
/* Peter Philipp */
|
/* Peter Philipp */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: daemon.c,v 8.653 2004/11/18 23:45:01 ca Exp $")
|
SM_RCSID("@(#)$Id: daemon.c,v 8.658 2005/02/02 18:19:28 ca Exp $")
|
||||||
|
|
||||||
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
|
#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
|
||||||
# define USE_SOCK_STREAM 1
|
# define USE_SOCK_STREAM 1
|
||||||
@ -77,10 +77,22 @@ struct daemon
|
|||||||
char *d_inputfilterlist;
|
char *d_inputfilterlist;
|
||||||
struct milter *d_inputfilters[MAXFILTERS];
|
struct milter *d_inputfilters[MAXFILTERS];
|
||||||
#endif /* MILTER */
|
#endif /* MILTER */
|
||||||
|
#if _FFR_SS_PER_DAEMON
|
||||||
|
int d_supersafe;
|
||||||
|
#endif /* _FFR_SS_PER_DAEMON */
|
||||||
|
#if _FFR_DM_PER_DAEMON
|
||||||
|
int d_dm; /* DeliveryMode */
|
||||||
|
#endif /* _FFR_DM_PER_DAEMON */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct daemon DAEMON_T;
|
typedef struct daemon DAEMON_T;
|
||||||
|
|
||||||
|
#define SAFE_NOTSET (-1) /* SuperSafe (per daemon) option not set */
|
||||||
|
/* see also sendmail.h: SuperSafe values */
|
||||||
|
|
||||||
|
#define DM_NOTSET (-1) /* DeliveryMode (per daemon) option not set */
|
||||||
|
/* see also sendmail.h: values for e_sendmode -- send modes */
|
||||||
|
|
||||||
static void connecttimeout __P((int));
|
static void connecttimeout __P((int));
|
||||||
static int opendaemonsocket __P((DAEMON_T *, bool));
|
static int opendaemonsocket __P((DAEMON_T *, bool));
|
||||||
static unsigned short setupdaemon __P((SOCKADDR *));
|
static unsigned short setupdaemon __P((SOCKADDR *));
|
||||||
@ -742,6 +754,17 @@ getrequests(e)
|
|||||||
|
|
||||||
/* don't schedule queue runs if ETRN */
|
/* don't schedule queue runs if ETRN */
|
||||||
QueueIntvl = 0;
|
QueueIntvl = 0;
|
||||||
|
#if _FFR_SS_PER_DAEMON
|
||||||
|
if (Daemons[curdaemon].d_supersafe !=
|
||||||
|
SAFE_NOTSET)
|
||||||
|
SuperSafe = Daemons[curdaemon].d_supersafe;
|
||||||
|
#endif /* _FFR_SS_PER_DAEMON */
|
||||||
|
#if _FFR_DM_PER_DAEMON
|
||||||
|
if (Daemons[curdaemon].d_dm != DM_NOTSET)
|
||||||
|
set_delivery_mode(
|
||||||
|
Daemons[curdaemon].d_dm, e);
|
||||||
|
#endif /* _FFR_DM_PER_DAEMON */
|
||||||
|
|
||||||
|
|
||||||
sm_setproctitle(true, e, "startup with %s",
|
sm_setproctitle(true, e, "startup with %s",
|
||||||
anynet_ntoa(&RealHostAddr));
|
anynet_ntoa(&RealHostAddr));
|
||||||
@ -1453,9 +1476,37 @@ setsockaddroptions(p, d)
|
|||||||
continue;
|
continue;
|
||||||
if (isascii(*f) && islower(*f))
|
if (isascii(*f) && islower(*f))
|
||||||
*f = toupper(*f);
|
*f = toupper(*f);
|
||||||
|
#if _FFR_SS_PER_DAEMON
|
||||||
|
d->d_supersafe = SAFE_NOTSET;
|
||||||
|
#endif /* _FFR_SS_PER_DAEMON */
|
||||||
|
#if _FFR_DM_PER_DAEMON
|
||||||
|
d->d_dm = DM_NOTSET;
|
||||||
|
#endif /* _FFR_DM_PER_DAEMON */
|
||||||
|
|
||||||
switch (*f)
|
switch (*f)
|
||||||
{
|
{
|
||||||
|
case 'A': /* address */
|
||||||
|
addr = v;
|
||||||
|
break;
|
||||||
|
|
||||||
|
#if _FFR_DM_PER_DAEMON
|
||||||
|
case 'D': /* DeliveryMode */
|
||||||
|
switch (*v)
|
||||||
|
{
|
||||||
|
case SM_QUEUE:
|
||||||
|
case SM_DEFER:
|
||||||
|
case SM_DELIVER:
|
||||||
|
case SM_FORK:
|
||||||
|
d->d_dm = *v;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
syserr("554 5.3.5 Unknown delivery mode %c",
|
||||||
|
*v);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif /* _FFR_DM_PER_DAEMON */
|
||||||
|
|
||||||
case 'F': /* address family */
|
case 'F': /* address family */
|
||||||
if (isascii(*v) && isdigit(*v))
|
if (isascii(*v) && isdigit(*v))
|
||||||
d->d_addr.sa.sa_family = atoi(v);
|
d->d_addr.sa.sa_family = atoi(v);
|
||||||
@ -1491,20 +1542,12 @@ setsockaddroptions(p, d)
|
|||||||
v);
|
v);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'A': /* address */
|
|
||||||
addr = v;
|
|
||||||
break;
|
|
||||||
|
|
||||||
#if MILTER
|
#if MILTER
|
||||||
case 'I':
|
case 'I':
|
||||||
d->d_inputfilterlist = v;
|
d->d_inputfilterlist = v;
|
||||||
break;
|
break;
|
||||||
#endif /* MILTER */
|
#endif /* MILTER */
|
||||||
|
|
||||||
case 'P': /* port */
|
|
||||||
port = v;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'L': /* listen queue size */
|
case 'L': /* listen queue size */
|
||||||
d->d_listenqueue = atoi(v);
|
d->d_listenqueue = atoi(v);
|
||||||
break;
|
break;
|
||||||
@ -1513,18 +1556,39 @@ setsockaddroptions(p, d)
|
|||||||
d->d_mflags = getmodifiers(v, d->d_flags);
|
d->d_mflags = getmodifiers(v, d->d_flags);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'S': /* send buffer size */
|
case 'N': /* name */
|
||||||
d->d_tcpsndbufsize = atoi(v);
|
d->d_name = v;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'P': /* port */
|
||||||
|
port = v;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R': /* receive buffer size */
|
case 'R': /* receive buffer size */
|
||||||
d->d_tcprcvbufsize = atoi(v);
|
d->d_tcprcvbufsize = atoi(v);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'N': /* name */
|
case 'S': /* send buffer size */
|
||||||
d->d_name = v;
|
d->d_tcpsndbufsize = atoi(v);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if _FFR_SS_PER_DAEMON
|
||||||
|
case 'T': /* SuperSafe */
|
||||||
|
if (tolower(*v) == 'i')
|
||||||
|
d->d_supersafe = SAFE_INTERACTIVE;
|
||||||
|
else if (tolower(*v) == 'p')
|
||||||
|
# if MILTER
|
||||||
|
d->d_supersafe = SAFE_REALLY_POSTMILTER;
|
||||||
|
# else /* MILTER */
|
||||||
|
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
|
||||||
|
"Warning: SuperSafe=PostMilter requires Milter support (-DMILTER)\n");
|
||||||
|
# endif /* MILTER */
|
||||||
|
else
|
||||||
|
d->d_supersafe = atobool(v) ? SAFE_REALLY
|
||||||
|
: SAFE_NO;
|
||||||
|
break;
|
||||||
|
#endif /* _FFR_SS_PER_DAEMON */
|
||||||
|
|
||||||
default:
|
default:
|
||||||
syserr("554 5.3.5 PortOptions parameter \"%s\" unknown",
|
syserr("554 5.3.5 PortOptions parameter \"%s\" unknown",
|
||||||
f);
|
f);
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: deliver.c,v 8.983 2005/01/07 17:43:22 ca Exp $")
|
SM_RCSID("@(#)$Id: deliver.c,v 8.986 2005/03/05 02:28:50 ca Exp $")
|
||||||
|
|
||||||
#if HASSETUSERCONTEXT
|
#if HASSETUSERCONTEXT
|
||||||
# include <login_cap.h>
|
# include <login_cap.h>
|
||||||
@ -4267,6 +4267,16 @@ logdelivery(m, mci, dsn, status, ctladdr, xstart, e)
|
|||||||
bp += strlen(bp);
|
bp += strlen(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if _FFR_LOG_NTRIES
|
||||||
|
/* ntries */
|
||||||
|
if (e->e_ntries >= 0)
|
||||||
|
{
|
||||||
|
(void) sm_snprintf(bp, SPACELEFT(buf, bp),
|
||||||
|
", ntries=%d", e->e_ntries + 1);
|
||||||
|
bp += strlen(bp);
|
||||||
|
}
|
||||||
|
#endif /* _FFR_LOG_NTRIES */
|
||||||
|
|
||||||
# define STATLEN (((SYSLOG_BUFSIZE) - 100) / 4)
|
# define STATLEN (((SYSLOG_BUFSIZE) - 100) / 4)
|
||||||
# if (STATLEN) < 63
|
# if (STATLEN) < 63
|
||||||
# undef STATLEN
|
# undef STATLEN
|
||||||
@ -5673,6 +5683,10 @@ hostsignature(m, host)
|
|||||||
!(m->m_argv[0] != NULL && strcmp(m->m_argv[0], "TCP") == 0))
|
!(m->m_argv[0] != NULL && strcmp(m->m_argv[0], "TCP") == 0))
|
||||||
return "localhost";
|
return "localhost";
|
||||||
|
|
||||||
|
/* an empty host does not have MX records */
|
||||||
|
if (*host == '\0')
|
||||||
|
return "_empty_";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Check to see if this uses IPC -- if not, it can't have MX records.
|
** Check to see if this uses IPC -- if not, it can't have MX records.
|
||||||
*/
|
*/
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
#if NAMED_BIND
|
#if NAMED_BIND
|
||||||
SM_RCSID("@(#)$Id: domain.c,v 8.195 2004/08/04 21:11:31 ca Exp $ (with name server)")
|
SM_RCSID("@(#)$Id: domain.c,v 8.197 2005/03/04 00:54:42 ca Exp $ (with name server)")
|
||||||
#else /* NAMED_BIND */
|
#else /* NAMED_BIND */
|
||||||
SM_RCSID("@(#)$Id: domain.c,v 8.195 2004/08/04 21:11:31 ca Exp $ (without name server)")
|
SM_RCSID("@(#)$Id: domain.c,v 8.197 2005/03/04 00:54:42 ca Exp $ (without name server)")
|
||||||
#endif /* NAMED_BIND */
|
#endif /* NAMED_BIND */
|
||||||
|
|
||||||
#if NAMED_BIND
|
#if NAMED_BIND
|
||||||
@ -232,6 +232,9 @@ getmxrr(host, mxhosts, mxprefs, droplocalhost, rcode, tryfallback, pttl)
|
|||||||
if (tTd(8, 2))
|
if (tTd(8, 2))
|
||||||
sm_dprintf("getmxrr(%s, droplocalhost=%d)\n",
|
sm_dprintf("getmxrr(%s, droplocalhost=%d)\n",
|
||||||
host, droplocalhost);
|
host, droplocalhost);
|
||||||
|
*rcode = EX_OK;
|
||||||
|
if (pttl != NULL)
|
||||||
|
*pttl = SM_DEFAULT_TTL;
|
||||||
if (*host == '\0')
|
if (*host == '\0')
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -242,8 +245,6 @@ getmxrr(host, mxhosts, mxprefs, droplocalhost, rcode, tryfallback, pttl)
|
|||||||
fallbackMX = NULL;
|
fallbackMX = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
*rcode = EX_OK;
|
|
||||||
|
|
||||||
if (mxprefs != NULL)
|
if (mxprefs != NULL)
|
||||||
prefs = mxprefs;
|
prefs = mxprefs;
|
||||||
else
|
else
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: envelope.c,v 8.293 2004/02/18 00:46:18 gshapiro Exp $")
|
SM_RCSID("@(#)$Id: envelope.c,v 8.294 2005/02/16 23:38:51 ca Exp $")
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** CLRSESSENVELOPE -- clear session oriented data in an envelope
|
** CLRSESSENVELOPE -- clear session oriented data in an envelope
|
||||||
@ -518,7 +518,7 @@ dropenvelope(e, fulldrop, split)
|
|||||||
if (xunlink(queuename(e, ANYQFL_LETTER)) == 0)
|
if (xunlink(queuename(e, ANYQFL_LETTER)) == 0)
|
||||||
{
|
{
|
||||||
/* add to available space in filesystem */
|
/* add to available space in filesystem */
|
||||||
updfs(e, true, !panic);
|
updfs(e, -1, panic ? 0 : -1, "dropenvelope");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e->e_ntries > 0 && LogLevel > 9)
|
if (e->e_ntries > 0 && LogLevel > 9)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1992, 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1992, 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: map.c,v 8.666 2004/08/17 16:50:19 gshapiro Exp $")
|
SM_RCSID("@(#)$Id: map.c,v 8.669 2005/02/09 01:46:35 ca Exp $")
|
||||||
|
|
||||||
#if LDAPMAP
|
#if LDAPMAP
|
||||||
# include <sm/ldap.h>
|
# include <sm/ldap.h>
|
||||||
@ -5657,12 +5657,14 @@ stab_map_lookup(map, name, av, pstat)
|
|||||||
map->map_mname, name);
|
map->map_mname, name);
|
||||||
|
|
||||||
s = stab(name, ST_ALIAS, ST_FIND);
|
s = stab(name, ST_ALIAS, ST_FIND);
|
||||||
if (s != NULL)
|
if (s == NULL)
|
||||||
return s->s_alias;
|
return NULL;
|
||||||
return NULL;
|
if (bitset(MF_MATCHONLY, map->map_mflags))
|
||||||
|
return map_rewrite(map, name, strlen(name), NULL);
|
||||||
|
else
|
||||||
|
return map_rewrite(map, s->s_alias, strlen(s->s_alias), av);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** STAB_MAP_STORE -- store in symtab (actually using during init, not rebuild)
|
** STAB_MAP_STORE -- store in symtab (actually using during init, not rebuild)
|
||||||
*/
|
*/
|
||||||
@ -7554,8 +7556,9 @@ socket_map_lookup(map, name, av, statp)
|
|||||||
int *statp;
|
int *statp;
|
||||||
{
|
{
|
||||||
unsigned int nettolen, replylen, recvlen;
|
unsigned int nettolen, replylen, recvlen;
|
||||||
char *replybuf, *rval, *value, *status;
|
char *replybuf, *rval, *value, *status, *key;
|
||||||
SM_FILE_T *f;
|
SM_FILE_T *f;
|
||||||
|
char keybuf[MAXNAME + 1];
|
||||||
|
|
||||||
replybuf = NULL;
|
replybuf = NULL;
|
||||||
rval = NULL;
|
rval = NULL;
|
||||||
@ -7564,11 +7567,24 @@ socket_map_lookup(map, name, av, statp)
|
|||||||
sm_dprintf("socket_map_lookup(%s, %s) %s\n",
|
sm_dprintf("socket_map_lookup(%s, %s) %s\n",
|
||||||
map->map_mname, name, map->map_file);
|
map->map_mname, name, map->map_file);
|
||||||
|
|
||||||
nettolen = strlen(map->map_mname) + 1 + strlen(name);
|
if (!bitset(MF_NOFOLDCASE, map->map_mflags))
|
||||||
|
{
|
||||||
|
nettolen = strlen(name);
|
||||||
|
if (nettolen > sizeof keybuf - 1)
|
||||||
|
nettolen = sizeof keybuf - 1;
|
||||||
|
memmove(keybuf, name, nettolen);
|
||||||
|
keybuf[nettolen] = '\0';
|
||||||
|
makelower(keybuf);
|
||||||
|
key = keybuf;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
key = name;
|
||||||
|
|
||||||
|
nettolen = strlen(map->map_mname) + 1 + strlen(key);
|
||||||
SM_ASSERT(nettolen > strlen(map->map_mname));
|
SM_ASSERT(nettolen > strlen(map->map_mname));
|
||||||
SM_ASSERT(nettolen > strlen(name));
|
SM_ASSERT(nettolen > strlen(key));
|
||||||
if ((sm_io_fprintf(f, SM_TIME_DEFAULT, "%u:%s %s,",
|
if ((sm_io_fprintf(f, SM_TIME_DEFAULT, "%u:%s %s,",
|
||||||
nettolen, map->map_mname, name) == SM_IO_EOF) ||
|
nettolen, map->map_mname, key) == SM_IO_EOF) ||
|
||||||
(sm_io_flush(f, SM_TIME_DEFAULT) != 0) ||
|
(sm_io_flush(f, SM_TIME_DEFAULT) != 0) ||
|
||||||
(sm_io_error(f)))
|
(sm_io_error(f)))
|
||||||
{
|
{
|
||||||
@ -7638,7 +7654,7 @@ socket_map_lookup(map, name, av, statp)
|
|||||||
|
|
||||||
/* collect the return value */
|
/* collect the return value */
|
||||||
if (bitset(MF_MATCHONLY, map->map_mflags))
|
if (bitset(MF_MATCHONLY, map->map_mflags))
|
||||||
rval = map_rewrite(map, name, strlen(name), NULL);
|
rval = map_rewrite(map, key, strlen(key), NULL);
|
||||||
else
|
else
|
||||||
rval = map_rewrite(map, value, strlen(value), av);
|
rval = map_rewrite(map, value, strlen(value), av);
|
||||||
}
|
}
|
||||||
@ -7647,13 +7663,13 @@ socket_map_lookup(map, name, av, statp)
|
|||||||
*statp = EX_NOTFOUND;
|
*statp = EX_NOTFOUND;
|
||||||
if (tTd(38, 20))
|
if (tTd(38, 20))
|
||||||
sm_dprintf("socket_map_lookup(%s): %s not found\n",
|
sm_dprintf("socket_map_lookup(%s): %s not found\n",
|
||||||
map->map_mname, name);
|
map->map_mname, key);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (tTd(38, 5))
|
if (tTd(38, 5))
|
||||||
sm_dprintf("socket_map_lookup(%s, %s): server returned error: type=%s, reason=%s\n",
|
sm_dprintf("socket_map_lookup(%s, %s): server returned error: type=%s, reason=%s\n",
|
||||||
map->map_mname, name, status,
|
map->map_mname, key, status,
|
||||||
value ? value : "");
|
value ? value : "");
|
||||||
if ((strcmp(status, "TEMP") == 0) ||
|
if ((strcmp(status, "TEMP") == 0) ||
|
||||||
(strcmp(status, "TIMEOUT") == 0))
|
(strcmp(status, "TIMEOUT") == 0))
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: mci.c,v 8.212 2004/08/04 21:11:31 ca Exp $")
|
SM_RCSID("@(#)$Id: mci.c,v 8.214 2005/02/04 22:01:45 ca Exp $")
|
||||||
|
|
||||||
#if NETINET || NETINET6
|
#if NETINET || NETINET6
|
||||||
# include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999-2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1999-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* By using this file, you agree to the terms and conditions set
|
* By using this file, you agree to the terms and conditions set
|
||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: milter.c,v 8.228 2004/11/09 18:54:55 ca Exp $")
|
SM_RCSID("@(#)$Id: milter.c,v 8.229 2005/03/02 02:32:34 ca Exp $")
|
||||||
|
|
||||||
#if MILTER
|
#if MILTER
|
||||||
# include <libmilter/mfapi.h>
|
# include <libmilter/mfapi.h>
|
||||||
@ -350,6 +350,16 @@ milter_read(m, cmd, rlen, to, e)
|
|||||||
char *buf;
|
char *buf;
|
||||||
char data[MILTER_LEN_BYTES + 1];
|
char data[MILTER_LEN_BYTES + 1];
|
||||||
|
|
||||||
|
if (m->mf_sock < 0)
|
||||||
|
{
|
||||||
|
if (MilterLogLevel > 0)
|
||||||
|
sm_syslog(LOG_ERR, e->e_id,
|
||||||
|
"milter_read(%s): socket closed",
|
||||||
|
m->mf_name);
|
||||||
|
milter_error(m, e);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
*rlen = 0;
|
*rlen = 0;
|
||||||
*cmd = '\0';
|
*cmd = '\0';
|
||||||
|
|
||||||
@ -487,6 +497,15 @@ milter_write(m, cmd, buf, len, to, e)
|
|||||||
milter_error(m, e);
|
milter_error(m, e);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
if (m->mf_sock < 0)
|
||||||
|
{
|
||||||
|
if (MilterLogLevel > 0)
|
||||||
|
sm_syslog(LOG_ERR, e->e_id,
|
||||||
|
"milter_write(%s): socket closed",
|
||||||
|
m->mf_name);
|
||||||
|
milter_error(m, e);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (tTd(64, 20))
|
if (tTd(64, 20))
|
||||||
sm_dprintf("milter_write(%s): cmd %c, len %ld\n",
|
sm_dprintf("milter_write(%s): cmd %c, len %ld\n",
|
||||||
@ -1852,7 +1871,7 @@ milter_send_macros(m, macros, cmd, e)
|
|||||||
}
|
}
|
||||||
(void) milter_write(m, SMFIC_MACRO, buf, s,
|
(void) milter_write(m, SMFIC_MACRO, buf, s,
|
||||||
m->mf_timeout[SMFTO_WRITE], e);
|
m->mf_timeout[SMFTO_WRITE], e);
|
||||||
sm_free(buf); /* XXX */
|
sm_free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3760,8 +3779,11 @@ milter_data(e, state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (MilterEOMMacros[0] != NULL)
|
if (MilterEOMMacros[0] != NULL)
|
||||||
|
{
|
||||||
milter_send_macros(m, MilterEOMMacros,
|
milter_send_macros(m, MilterEOMMacros,
|
||||||
SMFIC_BODYEOB, e);
|
SMFIC_BODYEOB, e);
|
||||||
|
MILTER_CHECK_RESULTS();
|
||||||
|
}
|
||||||
|
|
||||||
/* send the final body chunk */
|
/* send the final body chunk */
|
||||||
(void) milter_write(m, SMFIC_BODYEOB, NULL, 0,
|
(void) milter_write(m, SMFIC_BODYEOB, NULL, 0,
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: parseaddr.c,v 8.379 2004/08/06 22:19:36 ca Exp $")
|
SM_RCSID("@(#)$Id: parseaddr.c,v 8.381 2005/02/04 22:01:45 ca Exp $")
|
||||||
|
|
||||||
static void allocaddr __P((ADDRESS *, int, char *, ENVELOPE *));
|
static void allocaddr __P((ADDRESS *, int, char *, ENVELOPE *));
|
||||||
static int callsubr __P((char**, int, ENVELOPE *));
|
static int callsubr __P((char**, int, ENVELOPE *));
|
||||||
@ -2194,9 +2194,22 @@ cataddr(pvp, evp, buf, sz, spacesub)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't silently truncate long strings */
|
#if 0
|
||||||
|
/*
|
||||||
|
** Silently truncate long strings: even though this doesn't
|
||||||
|
** seem like a good idea it is necessary because header checks
|
||||||
|
** send the whole header value to rscheck() and hence rewrite().
|
||||||
|
** The latter however sometimes uses a "short" buffer (e.g.,
|
||||||
|
** cbuf[MAXNAME + 1]) to call cataddr() which then triggers this
|
||||||
|
** error function. One possible fix to the problem is to pass
|
||||||
|
** flags to rscheck() and rewrite() to distinguish the various
|
||||||
|
** calls and only trigger the error if necessary. For now just
|
||||||
|
** undo the change from 8.13.0.
|
||||||
|
*/
|
||||||
|
|
||||||
if (sz <= 0)
|
if (sz <= 0)
|
||||||
usrerr("cataddr: string too long");
|
usrerr("cataddr: string too long");
|
||||||
|
#endif
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
@ -12,8 +12,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
#include <sm/sem.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: queue.c,v 8.939 2004/08/03 19:57:23 ca Exp $")
|
SM_RCSID("@(#)$Id: queue.c,v 8.944 2005/02/17 23:58:58 ca Exp $")
|
||||||
|
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
@ -401,6 +402,7 @@ queueup(e, announce, msync)
|
|||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
e->e_lockfp = tfp;
|
e->e_lockfp = tfp;
|
||||||
|
upd_qs(e, 1, 0, "queueup");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if newid, write the queue file directly (instead of temp file) */
|
/* if newid, write the queue file directly (instead of temp file) */
|
||||||
@ -6496,13 +6498,79 @@ disk_status(out, prefix)
|
|||||||
#endif /* _FFR_CONTROL_MSTAT */
|
#endif /* _FFR_CONTROL_MSTAT */
|
||||||
|
|
||||||
#if SM_CONF_SHM
|
#if SM_CONF_SHM
|
||||||
|
|
||||||
|
/*
|
||||||
|
** INIT_SEM -- initialize semaphore system
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** owner -- is this the owner of semaphores?
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** none.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if _FFR_USE_SEM_LOCKING
|
||||||
|
#if SM_CONF_SEM
|
||||||
|
static int SemId = -1; /* Semaphore Id */
|
||||||
|
int SemKey = SM_SEM_KEY;
|
||||||
|
#endif /* SM_CONF_SEM */
|
||||||
|
#endif /* _FFR_USE_SEM_LOCKING */
|
||||||
|
|
||||||
|
static void init_sem __P((bool));
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_sem(owner)
|
||||||
|
bool owner;
|
||||||
|
{
|
||||||
|
#if _FFR_USE_SEM_LOCKING
|
||||||
|
#if SM_CONF_SEM
|
||||||
|
SemId = sm_sem_start(SemKey, 1, 0, owner);
|
||||||
|
if (SemId < 0)
|
||||||
|
{
|
||||||
|
sm_syslog(LOG_ERR, NOQID,
|
||||||
|
"func=init_sem, sem_key=%ld, sm_sem_start=%d",
|
||||||
|
(long) SemKey, SemId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif /* SM_CONF_SEM */
|
||||||
|
#endif /* _FFR_USE_SEM_LOCKING */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** STOP_SEM -- stop semaphore system
|
||||||
|
**
|
||||||
|
** Parameters:
|
||||||
|
** owner -- is this the owner of semaphores?
|
||||||
|
**
|
||||||
|
** Returns:
|
||||||
|
** none.
|
||||||
|
*/
|
||||||
|
|
||||||
|
static void stop_sem __P((bool));
|
||||||
|
|
||||||
|
static void
|
||||||
|
stop_sem(owner)
|
||||||
|
bool owner;
|
||||||
|
{
|
||||||
|
#if _FFR_USE_SEM_LOCKING
|
||||||
|
#if SM_CONF_SEM
|
||||||
|
if (owner && SemId >= 0)
|
||||||
|
sm_sem_stop(SemId);
|
||||||
|
#endif /* SM_CONF_SEM */
|
||||||
|
#endif /* _FFR_USE_SEM_LOCKING */
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** UPD_QS -- update information about queue when adding/deleting an entry
|
** UPD_QS -- update information about queue when adding/deleting an entry
|
||||||
**
|
**
|
||||||
** Parameters:
|
** Parameters:
|
||||||
** e -- envelope.
|
** e -- envelope.
|
||||||
** delete -- delete/add entry.
|
** count -- add/remove entry (+1/0/-1: add/no change/remove)
|
||||||
** avail -- update the space available as well.
|
** space -- update the space available as well.
|
||||||
|
** (>0/0/<0: add/no change/remove)
|
||||||
|
** where -- caller (for logging)
|
||||||
**
|
**
|
||||||
** Returns:
|
** Returns:
|
||||||
** none.
|
** none.
|
||||||
@ -6513,13 +6581,17 @@ disk_status(out, prefix)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
void
|
||||||
upd_qs(e, delete, avail)
|
upd_qs(e, count, space, where)
|
||||||
ENVELOPE *e;
|
ENVELOPE *e;
|
||||||
bool delete;
|
int count;
|
||||||
bool avail;
|
int space;
|
||||||
|
char *where;
|
||||||
{
|
{
|
||||||
short fidx;
|
short fidx;
|
||||||
int idx;
|
int idx;
|
||||||
|
# if _FFR_USE_SEM_LOCKING
|
||||||
|
int r;
|
||||||
|
# endif /* _FFR_USE_SEM_LOCKING */
|
||||||
long s;
|
long s;
|
||||||
|
|
||||||
if (ShmId == SM_SHM_NO_ID || e == NULL)
|
if (ShmId == SM_SHM_NO_ID || e == NULL)
|
||||||
@ -6527,14 +6599,21 @@ upd_qs(e, delete, avail)
|
|||||||
if (e->e_qgrp == NOQGRP || e->e_qdir == NOQDIR)
|
if (e->e_qgrp == NOQGRP || e->e_qdir == NOQDIR)
|
||||||
return;
|
return;
|
||||||
idx = Queue[e->e_qgrp]->qg_qpaths[e->e_qdir].qp_idx;
|
idx = Queue[e->e_qgrp]->qg_qpaths[e->e_qdir].qp_idx;
|
||||||
|
if (tTd(73,2))
|
||||||
|
sm_dprintf("func=upd_qs, count=%d, space=%d, where=%s, idx=%d, entries=%d\n",
|
||||||
|
count, space, where, idx, QSHM_ENTRIES(idx));
|
||||||
|
|
||||||
/* XXX in theory this needs to be protected with a mutex */
|
/* XXX in theory this needs to be protected with a mutex */
|
||||||
if (QSHM_ENTRIES(idx) >= 0)
|
if (QSHM_ENTRIES(idx) >= 0 && count != 0)
|
||||||
{
|
{
|
||||||
if (delete)
|
# if _FFR_USE_SEM_LOCKING
|
||||||
--QSHM_ENTRIES(idx);
|
r = sm_sem_acq(SemId, 0, 1);
|
||||||
else
|
# endif /* _FFR_USE_SEM_LOCKING */
|
||||||
++QSHM_ENTRIES(idx);
|
QSHM_ENTRIES(idx) += count;
|
||||||
|
# if _FFR_USE_SEM_LOCKING
|
||||||
|
if (r >= 0)
|
||||||
|
r = sm_sem_rel(SemId, 0, 1);
|
||||||
|
# endif /* _FFR_USE_SEM_LOCKING */
|
||||||
}
|
}
|
||||||
|
|
||||||
fidx = Queue[e->e_qgrp]->qg_qpaths[e->e_qdir].qp_fsysidx;
|
fidx = Queue[e->e_qgrp]->qg_qpaths[e->e_qdir].qp_fsysidx;
|
||||||
@ -6542,7 +6621,7 @@ upd_qs(e, delete, avail)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* update available space also? (might be loseqfile) */
|
/* update available space also? (might be loseqfile) */
|
||||||
if (!avail)
|
if (space == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* convert size to blocks; this causes rounding errors */
|
/* convert size to blocks; this causes rounding errors */
|
||||||
@ -6551,7 +6630,7 @@ upd_qs(e, delete, avail)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* XXX in theory this needs to be protected with a mutex */
|
/* XXX in theory this needs to be protected with a mutex */
|
||||||
if (delete)
|
if (space > 0)
|
||||||
FILE_SYS_AVAIL(fidx) += s;
|
FILE_SYS_AVAIL(fidx) += s;
|
||||||
else
|
else
|
||||||
FILE_SYS_AVAIL(fidx) -= s;
|
FILE_SYS_AVAIL(fidx) -= s;
|
||||||
@ -6676,6 +6755,8 @@ init_shm(qn, owner, hash)
|
|||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
int count;
|
||||||
|
int save_errno;
|
||||||
#if _FFR_SELECT_SHM
|
#if _FFR_SELECT_SHM
|
||||||
bool keyselect;
|
bool keyselect;
|
||||||
#endif /* _FFR_SELECT_SHM */
|
#endif /* _FFR_SELECT_SHM */
|
||||||
@ -6689,120 +6770,129 @@ init_shm(qn, owner, hash)
|
|||||||
#endif /* _FFR_SELECT_SHM */
|
#endif /* _FFR_SELECT_SHM */
|
||||||
|
|
||||||
/* This allows us to disable shared memory at runtime. */
|
/* This allows us to disable shared memory at runtime. */
|
||||||
if (ShmKey != 0)
|
if (ShmKey == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
count = 0;
|
||||||
|
shms = SM_T_SIZE + qn * sizeof(QUEUE_SHM_T);
|
||||||
|
#if _FFR_SELECT_SHM
|
||||||
|
keyselect = ShmKey == SEL_SHM_KEY;
|
||||||
|
if (keyselect)
|
||||||
{
|
{
|
||||||
int count;
|
if (owner)
|
||||||
int save_errno;
|
ShmKey = FIRST_SHM_KEY;
|
||||||
|
else
|
||||||
count = 0;
|
|
||||||
shms = SM_T_SIZE + qn * sizeof(QUEUE_SHM_T);
|
|
||||||
#if _FFR_SELECT_SHM
|
|
||||||
keyselect = ShmKey == SEL_SHM_KEY;
|
|
||||||
if (keyselect)
|
|
||||||
{
|
{
|
||||||
if (owner)
|
ShmKey = read_key_file(ShmKeyFile, ShmKey);
|
||||||
ShmKey = FIRST_SHM_KEY;
|
keyselect = false;
|
||||||
else
|
if (ShmKey == SEL_SHM_KEY)
|
||||||
{
|
goto error;
|
||||||
ShmKey = read_key_file(ShmKeyFile, ShmKey);
|
|
||||||
keyselect = false;
|
|
||||||
if (ShmKey == SEL_SHM_KEY)
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif /* _FFR_SELECT_SHM */
|
#endif /* _FFR_SELECT_SHM */
|
||||||
for (;;)
|
for (;;)
|
||||||
|
{
|
||||||
|
/* allow read/write access for group? */
|
||||||
|
Pshm = sm_shmstart(ShmKey, shms,
|
||||||
|
SHM_R|SHM_W|(SHM_R>>3)|(SHM_W>>3),
|
||||||
|
&ShmId, owner);
|
||||||
|
save_errno = errno;
|
||||||
|
if (Pshm != NULL || !sm_file_exists(save_errno))
|
||||||
|
break;
|
||||||
|
if (++count >= 3)
|
||||||
{
|
{
|
||||||
/* XXX: maybe allow read access for group? */
|
|
||||||
Pshm = sm_shmstart(ShmKey, shms, SHM_R|SHM_W, &ShmId,
|
|
||||||
owner);
|
|
||||||
save_errno = errno;
|
|
||||||
if (Pshm != NULL || !sm_file_exists(save_errno))
|
|
||||||
break;
|
|
||||||
if (++count >= 3)
|
|
||||||
{
|
|
||||||
#if _FFR_SELECT_SHM
|
|
||||||
if (keyselect)
|
|
||||||
{
|
|
||||||
++ShmKey;
|
|
||||||
|
|
||||||
/* back where we started? */
|
|
||||||
if (ShmKey == SEL_SHM_KEY)
|
|
||||||
break;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif /* _FFR_SELECT_SHM */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#if _FFR_SELECT_SHM
|
|
||||||
/* only sleep if we are at the first key */
|
|
||||||
if (!keyselect || ShmKey == SEL_SHM_KEY)
|
|
||||||
#endif /* _FFR_SELECT_SHM */
|
|
||||||
sleep(count);
|
|
||||||
}
|
|
||||||
if (Pshm != NULL)
|
|
||||||
{
|
|
||||||
int *p;
|
|
||||||
|
|
||||||
#if _FFR_SELECT_SHM
|
#if _FFR_SELECT_SHM
|
||||||
if (keyselect)
|
if (keyselect)
|
||||||
(void) write_key_file(ShmKeyFile, (long) ShmKey);
|
{
|
||||||
|
++ShmKey;
|
||||||
|
|
||||||
|
/* back where we started? */
|
||||||
|
if (ShmKey == SEL_SHM_KEY)
|
||||||
|
break;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
#endif /* _FFR_SELECT_SHM */
|
#endif /* _FFR_SELECT_SHM */
|
||||||
p = (int *) Pshm;
|
break;
|
||||||
if (owner)
|
|
||||||
{
|
|
||||||
*p = (int) shms;
|
|
||||||
*((pid_t *) SHM_OFF_PID(Pshm)) = CurrentPid;
|
|
||||||
p = (int *) SHM_OFF_TAG(Pshm);
|
|
||||||
*p = hash;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (*p != (int) shms)
|
|
||||||
{
|
|
||||||
save_errno = EINVAL;
|
|
||||||
cleanup_shm(false);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
p = (int *) SHM_OFF_TAG(Pshm);
|
|
||||||
if (*p != (int) hash)
|
|
||||||
{
|
|
||||||
save_errno = EINVAL;
|
|
||||||
cleanup_shm(false);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
** XXX how to check the pid?
|
|
||||||
** Read it from the pid-file? That does
|
|
||||||
** not need to exist.
|
|
||||||
** We could disable shm if we can't confirm
|
|
||||||
** that it is the right one.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
PtrFileSys = (FILESYS *) OFF_FILE_SYS(Pshm);
|
|
||||||
PNumFileSys = (int *) OFF_NUM_FILE_SYS(Pshm);
|
|
||||||
QShm = (QUEUE_SHM_T *) OFF_QUEUE_SHM(Pshm);
|
|
||||||
PRSATmpCnt = (int *) OFF_RSA_TMP_CNT(Pshm);
|
|
||||||
*PRSATmpCnt = 0;
|
|
||||||
if (owner)
|
|
||||||
{
|
|
||||||
/* initialize values in shared memory */
|
|
||||||
NumFileSys = 0;
|
|
||||||
for (i = 0; i < qn; i++)
|
|
||||||
QShm[i].qs_entries = -1;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
error:
|
#if _FFR_SELECT_SHM
|
||||||
if (LogLevel > (owner ? 8 : 11))
|
/* only sleep if we are at the first key */
|
||||||
|
if (!keyselect || ShmKey == SEL_SHM_KEY)
|
||||||
|
#endif /* _FFR_SELECT_SHM */
|
||||||
|
sleep(count);
|
||||||
|
}
|
||||||
|
if (Pshm != NULL)
|
||||||
|
{
|
||||||
|
int *p;
|
||||||
|
|
||||||
|
#if _FFR_SELECT_SHM
|
||||||
|
if (keyselect)
|
||||||
|
(void) write_key_file(ShmKeyFile, (long) ShmKey);
|
||||||
|
#endif /* _FFR_SELECT_SHM */
|
||||||
|
if (owner && RunAsUid != 0)
|
||||||
{
|
{
|
||||||
sm_syslog(owner ? LOG_ERR : LOG_NOTICE, NOQID,
|
i = sm_shmsetowner(ShmId, RunAsUid, RunAsGid,
|
||||||
"can't %s shared memory, key=%ld: %s",
|
0660);
|
||||||
owner ? "initialize" : "attach to",
|
if (i != 0)
|
||||||
(long) ShmKey, sm_errstring(save_errno));
|
sm_syslog(LOG_ERR, NOQID,
|
||||||
|
"key=%ld, sm_shmsetowner=%d, RunAsUid=%d, RunAsGid=%d",
|
||||||
|
(long) ShmKey, i,
|
||||||
|
RunAsUid, RunAsGid);
|
||||||
}
|
}
|
||||||
|
p = (int *) Pshm;
|
||||||
|
if (owner)
|
||||||
|
{
|
||||||
|
*p = (int) shms;
|
||||||
|
*((pid_t *) SHM_OFF_PID(Pshm)) = CurrentPid;
|
||||||
|
p = (int *) SHM_OFF_TAG(Pshm);
|
||||||
|
*p = hash;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (*p != (int) shms)
|
||||||
|
{
|
||||||
|
save_errno = EINVAL;
|
||||||
|
cleanup_shm(false);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
p = (int *) SHM_OFF_TAG(Pshm);
|
||||||
|
if (*p != (int) hash)
|
||||||
|
{
|
||||||
|
save_errno = EINVAL;
|
||||||
|
cleanup_shm(false);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** XXX how to check the pid?
|
||||||
|
** Read it from the pid-file? That does
|
||||||
|
** not need to exist.
|
||||||
|
** We could disable shm if we can't confirm
|
||||||
|
** that it is the right one.
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
PtrFileSys = (FILESYS *) OFF_FILE_SYS(Pshm);
|
||||||
|
PNumFileSys = (int *) OFF_NUM_FILE_SYS(Pshm);
|
||||||
|
QShm = (QUEUE_SHM_T *) OFF_QUEUE_SHM(Pshm);
|
||||||
|
PRSATmpCnt = (int *) OFF_RSA_TMP_CNT(Pshm);
|
||||||
|
*PRSATmpCnt = 0;
|
||||||
|
if (owner)
|
||||||
|
{
|
||||||
|
/* initialize values in shared memory */
|
||||||
|
NumFileSys = 0;
|
||||||
|
for (i = 0; i < qn; i++)
|
||||||
|
QShm[i].qs_entries = -1;
|
||||||
|
}
|
||||||
|
init_sem(owner);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
error:
|
||||||
|
if (LogLevel > (owner ? 8 : 11))
|
||||||
|
{
|
||||||
|
sm_syslog(owner ? LOG_ERR : LOG_NOTICE, NOQID,
|
||||||
|
"can't %s shared memory, key=%ld: %s",
|
||||||
|
owner ? "initialize" : "attach to",
|
||||||
|
(long) ShmKey, sm_errstring(save_errno));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* SM_CONF_SHM */
|
#endif /* SM_CONF_SHM */
|
||||||
@ -7013,6 +7103,7 @@ cleanup_shm(owner)
|
|||||||
Pshm = NULL;
|
Pshm = NULL;
|
||||||
ShmId = SM_SHM_NO_ID;
|
ShmId = SM_SHM_NO_ID;
|
||||||
}
|
}
|
||||||
|
stop_sem(owner);
|
||||||
}
|
}
|
||||||
#endif /* SM_CONF_SHM */
|
#endif /* SM_CONF_SHM */
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
@ -52,7 +52,7 @@
|
|||||||
|
|
||||||
#ifdef _DEFINE
|
#ifdef _DEFINE
|
||||||
# ifndef lint
|
# ifndef lint
|
||||||
SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.990 2004/11/09 19:45:46 ca Exp $";
|
SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.993 2005/03/07 18:03:17 ca Exp $";
|
||||||
# endif /* ! lint */
|
# endif /* ! lint */
|
||||||
#endif /* _DEFINE */
|
#endif /* _DEFINE */
|
||||||
|
|
||||||
@ -2578,10 +2578,11 @@ extern void unsetenv __P((char *));
|
|||||||
|
|
||||||
/* update file system information: +/- some blocks */
|
/* update file system information: +/- some blocks */
|
||||||
#if SM_CONF_SHM
|
#if SM_CONF_SHM
|
||||||
extern void upd_qs __P((ENVELOPE *, bool, bool));
|
extern void upd_qs __P((ENVELOPE *, bool, bool, char *));
|
||||||
# define updfs(e, delete, avail) upd_qs(e, delete, avail)
|
# define updfs(e, count, space, where) upd_qs(e, count, space, where)
|
||||||
#else /* SM_CONF_SHM */
|
#else /* SM_CONF_SHM */
|
||||||
# define updfs(e, delete, avail)
|
# define updfs(e, count, space, where)
|
||||||
|
# define upd_qs(e, count, space, where)
|
||||||
#endif /* SM_CONF_SHM */
|
#endif /* SM_CONF_SHM */
|
||||||
|
|
||||||
extern char *username __P((void));
|
extern char *username __P((void));
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
|
||||||
* Copyright (c) 1988, 1993
|
* Copyright (c) 1988, 1993
|
||||||
@ -17,7 +17,7 @@
|
|||||||
# include <libmilter/mfdef.h>
|
# include <libmilter/mfdef.h>
|
||||||
#endif /* MILTER */
|
#endif /* MILTER */
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.902 2004/11/18 21:46:01 ca Exp $")
|
SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.906 2005/03/16 00:36:09 ca Exp $")
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sm/fdset.h>
|
#include <sm/fdset.h>
|
||||||
@ -80,13 +80,13 @@ static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
|
|||||||
char *_auth_id, sasl_ssf_t *_ext_ssf));
|
char *_auth_id, sasl_ssf_t *_ext_ssf));
|
||||||
|
|
||||||
# define RESET_SASLCONN \
|
# define RESET_SASLCONN \
|
||||||
result = reset_saslconn(&conn, AuthRealm, remoteip, localip, auth_id, \
|
do \
|
||||||
&ext_ssf); \
|
{ \
|
||||||
if (result != SASL_OK) \
|
result = reset_saslconn(&conn, AuthRealm, remoteip, \
|
||||||
{ \
|
localip, auth_id, &ext_ssf); \
|
||||||
/* This is pretty fatal */ \
|
if (result != SASL_OK) \
|
||||||
goto doquit; \
|
sasl_ok = false; \
|
||||||
}
|
} while (0)
|
||||||
|
|
||||||
# else /* SASL >= 20000 */
|
# else /* SASL >= 20000 */
|
||||||
static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
|
static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
|
||||||
@ -94,12 +94,13 @@ static int reset_saslconn __P((sasl_conn_t **_conn, char *_hostname,
|
|||||||
struct sockaddr_in *_saddr_l,
|
struct sockaddr_in *_saddr_l,
|
||||||
sasl_external_properties_t *_ext_ssf));
|
sasl_external_properties_t *_ext_ssf));
|
||||||
# define RESET_SASLCONN \
|
# define RESET_SASLCONN \
|
||||||
result = reset_saslconn(&conn, AuthRealm, &saddr_r, &saddr_l, &ext_ssf); \
|
do \
|
||||||
if (result != SASL_OK) \
|
{ \
|
||||||
{ \
|
result = reset_saslconn(&conn, AuthRealm, &saddr_r, \
|
||||||
/* This is pretty fatal */ \
|
&saddr_l, &ext_ssf); \
|
||||||
goto doquit; \
|
if (result != SASL_OK) \
|
||||||
}
|
sasl_ok = false; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
# endif /* SASL >= 20000 */
|
# endif /* SASL >= 20000 */
|
||||||
#endif /* SASL */
|
#endif /* SASL */
|
||||||
@ -664,6 +665,7 @@ smtp(nullserver, d_flags, e)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
# if SASL >= 20000
|
# if SASL >= 20000
|
||||||
|
localip[0] = remoteip[0] = '\0';
|
||||||
# if NETINET || NETINET6
|
# if NETINET || NETINET6
|
||||||
in = macvalue(macid("{daemon_family}"), e);
|
in = macvalue(macid("{daemon_family}"), e);
|
||||||
if (in != NULL && (
|
if (in != NULL && (
|
||||||
@ -747,8 +749,6 @@ smtp(nullserver, d_flags, e)
|
|||||||
|
|
||||||
/* XXX should these be options settable via .cf ? */
|
/* XXX should these be options settable via .cf ? */
|
||||||
/* ssp.min_ssf = 0; is default due to memset() */
|
/* ssp.min_ssf = 0; is default due to memset() */
|
||||||
# if STARTTLS
|
|
||||||
# endif /* STARTTLS */
|
|
||||||
{
|
{
|
||||||
ssp.max_ssf = MaxSLBits;
|
ssp.max_ssf = MaxSLBits;
|
||||||
ssp.maxbufsize = MAXOUTLEN;
|
ssp.maxbufsize = MAXOUTLEN;
|
||||||
@ -4618,12 +4618,12 @@ help(topic, e)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
reset_saslconn(sasl_conn_t ** conn, char *hostname,
|
reset_saslconn(sasl_conn_t **conn, char *hostname,
|
||||||
# if SASL >= 20000
|
# if SASL >= 20000
|
||||||
char *remoteip, char *localip,
|
char *remoteip, char *localip,
|
||||||
char *auth_id, sasl_ssf_t * ext_ssf)
|
char *auth_id, sasl_ssf_t * ext_ssf)
|
||||||
# else /* SASL >= 20000 */
|
# else /* SASL >= 20000 */
|
||||||
struct sockaddr_in * saddr_r, struct sockaddr_in * saddr_l,
|
struct sockaddr_in *saddr_r, struct sockaddr_in *saddr_l,
|
||||||
sasl_external_properties_t * ext_ssf)
|
sasl_external_properties_t * ext_ssf)
|
||||||
# endif /* SASL >= 20000 */
|
# endif /* SASL >= 20000 */
|
||||||
{
|
{
|
||||||
@ -4646,12 +4646,12 @@ reset_saslconn(sasl_conn_t ** conn, char *hostname,
|
|||||||
|
|
||||||
# if SASL >= 20000
|
# if SASL >= 20000
|
||||||
# if NETINET || NETINET6
|
# if NETINET || NETINET6
|
||||||
if (remoteip != NULL)
|
if (remoteip != NULL && *remoteip != '\0')
|
||||||
result = sasl_setprop(*conn, SASL_IPREMOTEPORT, remoteip);
|
result = sasl_setprop(*conn, SASL_IPREMOTEPORT, remoteip);
|
||||||
if (result != SASL_OK)
|
if (result != SASL_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if (localip != NULL)
|
if (localip != NULL && *localip != '\0')
|
||||||
result = sasl_setprop(*conn, SASL_IPLOCALPORT, localip);
|
result = sasl_setprop(*conn, SASL_IPLOCALPORT, localip);
|
||||||
if (result != SASL_OK)
|
if (result != SASL_OK)
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2000-2004 Sendmail, Inc. and its suppliers.
|
* Copyright (c) 2000-2005 Sendmail, Inc. and its suppliers.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* By using this file, you agree to the terms and conditions set
|
* By using this file, you agree to the terms and conditions set
|
||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: tls.c,v 8.96 2004/08/04 21:17:58 ca Exp $")
|
SM_RCSID("@(#)$Id: tls.c,v 8.97 2005/03/08 22:20:52 ca Exp $")
|
||||||
|
|
||||||
#if STARTTLS
|
#if STARTTLS
|
||||||
# include <openssl/err.h>
|
# include <openssl/err.h>
|
||||||
@ -1155,7 +1155,8 @@ tls_get_info(ssl, srv, host, mac, certreq)
|
|||||||
NID_commonName, buf, sizeof buf);
|
NID_commonName, buf, sizeof buf);
|
||||||
macdefine(mac, A_TEMP, macid("{cn_issuer}"),
|
macdefine(mac, A_TEMP, macid("{cn_issuer}"),
|
||||||
xtextify(buf, "<>\")"));
|
xtextify(buf, "<>\")"));
|
||||||
if (X509_digest(cert, EVP_md5(), md, &n))
|
n = 0;
|
||||||
|
if (X509_digest(cert, EVP_md5(), md, &n) != 0 && n > 0)
|
||||||
{
|
{
|
||||||
char md5h[EVP_MAX_MD_SIZE * 3];
|
char md5h[EVP_MAX_MD_SIZE * 3];
|
||||||
static const char hexcodes[] = "0123456789ABCDEF";
|
static const char hexcodes[] = "0123456789ABCDEF";
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include <sendmail.h>
|
#include <sendmail.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: usersmtp.c,v 8.460 2005/01/11 00:24:19 ca Exp $")
|
SM_RCSID("@(#)$Id: usersmtp.c,v 8.463 2005/03/16 00:36:09 ca Exp $")
|
||||||
|
|
||||||
#include <sysexits.h>
|
#include <sysexits.h>
|
||||||
|
|
||||||
@ -1596,8 +1596,6 @@ attemptauth(m, mci, e, sai)
|
|||||||
(void) memset(&ssp, '\0', sizeof ssp);
|
(void) memset(&ssp, '\0', sizeof ssp);
|
||||||
|
|
||||||
/* XXX should these be options settable via .cf ? */
|
/* XXX should these be options settable via .cf ? */
|
||||||
# if STARTTLS
|
|
||||||
#endif /* STARTTLS */
|
|
||||||
{
|
{
|
||||||
ssp.max_ssf = MaxSLBits;
|
ssp.max_ssf = MaxSLBits;
|
||||||
ssp.maxbufsize = MAXOUTLEN;
|
ssp.maxbufsize = MAXOUTLEN;
|
||||||
|
@ -13,6 +13,6 @@
|
|||||||
|
|
||||||
#include <sm/gen.h>
|
#include <sm/gen.h>
|
||||||
|
|
||||||
SM_RCSID("@(#)$Id: version.c,v 8.140 2005/01/12 04:32:32 ca Exp $")
|
SM_RCSID("@(#)$Id: version.c,v 8.145 2005/03/25 18:44:44 ca Exp $")
|
||||||
|
|
||||||
char Version[] = "8.13.3";
|
char Version[] = "8.13.4";
|
||||||
|
Loading…
Reference in New Issue
Block a user