Resolve conflicts from sendmail 8.13.1 import

This commit is contained in:
Gregory Neil Shapiro 2004-08-01 01:16:16 +00:00
parent 6b3455a766
commit bfb62e91d7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=132946
20 changed files with 641 additions and 400 deletions

View File

@ -1,22 +0,0 @@
divert(-1)
#
# Copyright (c) 1998, 1999 Sendmail, Inc. and its suppliers.
# All rights reserved.
# Copyright (c) 1983 Eric P. Allman. All rights reserved.
# Copyright (c) 1988, 1993
# The Regents of the University of California. 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.
#
#
divert(0)
VERSIONID(`$Id: nodns.m4,v 8.14 1999/07/22 17:55:35 gshapiro Exp $')
divert(-1)
undefine(`confBIND_OPTS')dnl
errprint(`FEATURE(nodns) is no-op.
Use ServiceSwitchFile ('ifdef(`confSERVICE_SWITCH_FILE',confSERVICE_SWITCH_FILE,MAIL_SETTINGS_DIR`service.switch')`) if your OS does not provide its own instead.
')

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
# Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
# All rights reserved.
# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
# Copyright (c) 1988, 1993
@ -304,7 +304,8 @@ define(`confMILTER_MACROS_CONNECT', ``j, _, {daemon_name}, {if_name}, {if_addr}'
define(`confMILTER_MACROS_HELO', ``{tls_version}, {cipher}, {cipher_bits}, {cert_subject}, {cert_issuer}'')
define(`confMILTER_MACROS_ENVFROM', ``i, {auth_type}, {auth_authen}, {auth_ssf}, {auth_author}, {mail_mailer}, {mail_host}, {mail_addr}'')
define(`confMILTER_MACROS_ENVRCPT', ``{rcpt_mailer}, {rcpt_host}, {rcpt_addr}'')
define(`confMILTER_MACROS_EOM', `{msg_id}')
divert(0)dnl
VERSIONID(`$Id: cfhead.m4,v 8.108.2.6 2003/12/05 02:26:47 ca Exp $')
VERSIONID(`$Id: cfhead.m4,v 8.116 2004/01/28 22:02:22 ca Exp $')

View File

@ -1,79 +0,0 @@
/*
** OLDBIND.COMPAT.C
**
** Very old systems do not have res_query(), res_querydomain() or
** res_search(), so emulate them here.
**
** You really ought to be upgrading to a newer version of BIND
** (4.8.2 or later) rather than be using this.
**
** J.R. Oldroyd <jr@inset.com>
*/
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
typedef union
{
HEADER qb1;
char qb2[PACKETSZ];
} querybuf;
res_query(dname, class, type, data, datalen)
char * dname;
int class;
int type;
char * data;
int datalen;
{
int n;
querybuf buf;
n = res_mkquery(QUERY, dname, class, type, (char *) NULL, 0,
NULL, (char *) &buf, sizeof buf);
n = res_send((char *)&buf, n, data, datalen);
return n;
}
res_querydomain(host, dname, class, type, data, datalen)
char * host;
char * dname;
int class;
int type;
char * data;
int datalen;
{
int n;
querybuf buf;
char dbuf[256];
strcpy(dbuf, host);
if (dbuf[strlen(dbuf)-1] != '.')
strcat(dbuf, ".");
strcat(dbuf, dname);
n = res_mkquery(QUERY, dbuf, class, type, (char *) NULL, 0,
NULL, (char *)&buf, sizeof buf);
n = res_send((char *) &buf, n, data, datalen);
return n;
}
res_search(dname, class, type, data, datalen)
char * dname;
int class;
int type;
char * data;
int datalen;
{
int n;
querybuf buf;
n = res_mkquery(QUERY, dname, class, type, (char *)NULL, 0,
NULL, (char *) &buf, sizeof buf);
n = res_send((char *) &buf, n, data, datalen);
return n;
}

View File

@ -1,66 +0,0 @@
/*
* Copyright (c) 2000-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* This code is derived from software contributed to Berkeley by
* Chris Torek.
*
* 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: vsprintf.c,v 1.21 2001/09/11 04:04:49 gshapiro Exp $")
#include <limits.h>
#include <sm/io.h>
#include "local.h"
/*
** SM_VSPRINTF -- format data for "output" into a string
**
** Assigned 'str' to a "fake" file pointer. This allows common
** o/p formatting function sm_vprintf() to be used.
**
** Parameters:
** str -- location for output
** fmt -- format directives
** ap -- data unit vectors for use by 'fmt'
**
** Results:
** result from sm_io_vfprintf()
**
** Side Effects:
** Quietly limits the size to INT_MAX though this may
** not prevent SEGV's.
*/
int
sm_vsprintf(str, fmt, ap)
char *str;
const char *fmt;
SM_VA_LOCAL_DECL
{
int ret;
SM_FILE_T fake;
fake.sm_magic = SmFileMagic;
fake.f_file = -1;
fake.f_flags = SMWR | SMSTR;
fake.f_bf.smb_base = fake.f_p = (unsigned char *)str;
fake.f_bf.smb_size = fake.f_w = INT_MAX;
fake.f_timeout = SM_TIME_FOREVER;
fake.f_timeoutstate = SM_TIME_BLOCK;
fake.f_close = NULL;
fake.f_open = NULL;
fake.f_read = NULL;
fake.f_write = NULL;
fake.f_seek = NULL;
fake.f_setinfo = fake.f_getinfo = NULL;
fake.f_type = "sm_vsprintf:fake";
ret = sm_io_vfprintf(&fake, SM_TIME_FOREVER, fmt, ap);
*fake.f_p = '\0';
return ret;
}

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
.\" Copyright (c) 1998-2001, 2003 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -8,9 +8,9 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: mail.local.8,v 8.23 2001/04/05 23:27:35 gshapiro Exp $
.\" $Id: mail.local.8,v 8.25 2003/10/20 20:26:51 ca Exp $
.\"
.TH MAIL.LOCAL 8 "$Date: 2001/04/05 23:27:35 $"
.TH MAIL.LOCAL 8 "$Date: 2003/10/20 20:26:51 $"
.SH NAME
mail.local
\- store mail in a mailbox
@ -77,6 +77,29 @@ Same as \-f.
Store incoming mail in \fIfilename\fR in the user's home directory instead
of a system mail spool directory.
.PP
The next options are only available if
.B mail.local
has been compiled with -DHASHSPOOL.
.TP
.BI \-H " hashtypehashdepth"
Select hashed mail directories.
Valid hash types are
.B u
for user name and
.B m
for MD5 (requires compilation with -DHASHSPOOLMD5).
Example:
.BI \-H " u2"
selects user name hashing with a hash depth of 2.
Note: there must be no space between the hash type and the depth.
.TP
.BI \-p " path"
Specify an alternate mail spool path.
.TP
.BI \-n
Specify that the domain part of recipient addresses in LMTP mode
should not be stripped.
.PP
Individual mail messages in the mailbox are delimited by an empty
line followed by a line beginning with the string ``From ''.
A line containing the string ``From '', the sender's name and a time stamp

View File

@ -20,7 +20,7 @@ SM_IDSTR(copyright,
Copyright (c) 1990, 1993, 1994\n\
The Regents of the University of California. All rights reserved.\n")
SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.239.2.11 2003/09/01 01:49:46 gshapiro Exp $")
SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.251 2003/11/03 18:38:29 ca Exp $")
#include <stdlib.h>
#include <sm/errstring.h>
@ -34,6 +34,13 @@ SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.239.2.11 2003/09/01 01:49:46 gshapiro Ex
#include <sm/mbdb.h>
#include <sm/sysexits.h>
#ifndef HASHSPOOL
# define HASHSPOOL 0
#endif /* ! HASHSPOOL */
#ifndef HASHSPOOLMD5
# define HASHSPOOLMD5 0
#endif /* ! HASHSPOOLMD5 */
/*
** This is not intended to work on System V derived systems
** such as Solaris or HP-UX, since they use a totally different
@ -65,6 +72,15 @@ SM_IDSTR(id, "@(#)$Id: mail.local.c,v 8.239.2.11 2003/09/01 01:49:46 gshapiro Ex
#include <sm/conf.h>
#include <sendmail/pathnames.h>
#if HASHSPOOL
# define HASH_NONE 0
# define HASH_USER 1
# if HASHSPOOLMD5
# define HASH_MD5 2
# include <openssl/md5.h>
# endif /* HASHSPOOLMD5 */
#endif /* HASHSPOOL */
#ifndef LOCKTO_RM
# define LOCKTO_RM 300 /* timeout for stale lockfile removal */
@ -134,6 +150,15 @@ bool LMTPMode = false;
bool BounceQuota = false; /* permanent error when over quota */
char *HomeMailFile = NULL; /* store mail in homedir */
#if HASHSPOOL
int HashType = HASH_NONE;
int HashDepth = 0;
bool StripRcptDomain = true;
#else /* HASHSPOOL */
# define StripRcptDomain true
#endif /* HASHSPOOL */
char SpoolPath[MAXPATHLEN];
void deliver __P((int, char *));
int e_to_sys __P((int));
void notifybiff __P((char *));
@ -143,6 +168,9 @@ int lockmbox __P((char *));
void unlockmbox __P((void));
void mailerr __P((const char *, const char *, ...));
void flush_error __P((void));
#if HASHSPOOL
const char *hashname __P((char *));
#endif /* HASHSPOOL */
int
@ -174,7 +202,17 @@ main(argc, argv)
# endif /* LOG_MAIL */
from = NULL;
if (sm_strlcpy(SpoolPath, _PATH_MAILDIR, sizeof(SpoolPath)) >=
sizeof(SpoolPath))
{
mailerr("421", "Configuration error: _PATH_MAILDIR too large");
exit(EX_CONFIG);
}
#if HASHSPOOL
while ((ch = getopt(argc, argv, "7BbdD:f:h:r:lH:p:ns")) != -1)
#else /* HASHSPOOL */
while ((ch = getopt(argc, argv, "7BbdD:f:h:r:ls")) != -1)
#endif /* HASHSPOOL */
{
switch(ch)
{
@ -225,6 +263,61 @@ main(argc, argv)
nofsync++;
break;
#if HASHSPOOL
case 'H':
if (optarg == NULL || *optarg == '\0')
{
mailerr(NULL, "-H: missing hashinfo");
usage();
}
switch(optarg[0])
{
case 'u':
HashType = HASH_USER;
break;
# if HASHSPOOLMD5
case 'm':
HashType = HASH_MD5;
break;
# endif /* HASHSPOOLMD5 */
default:
mailerr(NULL, "-H: unknown hash type");
usage();
}
if (optarg[1] == '\0')
{
mailerr(NULL, "-H: invalid hash depth");
usage();
}
HashDepth = atoi(&optarg[1]);
if ((HashDepth <= 0) || ((HashDepth * 2) >= MAXPATHLEN))
{
mailerr(NULL, "-H: invalid hash depth");
usage();
}
break;
case 'p':
if (optarg == NULL || *optarg == '\0')
{
mailerr(NULL, "-p: missing spool path");
usage();
}
if (sm_strlcpy(SpoolPath, optarg, sizeof(SpoolPath)) >=
sizeof(SpoolPath))
{
mailerr(NULL, "-p: invalid spool path");
usage();
}
break;
case 'n':
StripRcptDomain = false;
break;
#endif /* HASHSPOOL */
case '?':
default:
usage();
@ -593,7 +686,7 @@ dolmtp()
}
if (sm_strncasecmp(buf + 5, "to:", 3) != 0 ||
((rcpt_addr[rcpt_num] = parseaddr(buf + 8,
true)) == NULL))
StripRcptDomain)) == NULL))
{
mailerr("501 5.5.4",
"Syntax error in parameters");
@ -916,6 +1009,7 @@ deliver(fd, name)
** Also, clear out any bogus characters.
*/
#if !HASHSPOOL
if (strlen(name) > 40)
name[40] = '\0';
for (p = name; *p != '\0'; p++)
@ -925,12 +1019,22 @@ deliver(fd, name)
else if (!isprint(*p))
*p = '.';
}
#endif /* !HASHSPOOL */
if (HomeMailFile == NULL)
{
if (sm_snprintf(path, sizeof(path), "%s/%s",
_PATH_MAILDIR, name) >= sizeof(path))
if (sm_strlcpyn(path, sizeof(path),
#if HASHSPOOL
4,
#else /* HASHSPOOL */
3,
#endif /* HASHSPOOL */
SpoolPath, "/",
#if HASHSPOOL
hashname(name),
#endif /* HASHSPOOL */
name) >= sizeof(path))
{
exitval = EX_UNAVAILABLE;
mailerr("550 5.1.1", "%s: Invalid mailbox path", name);
@ -1510,6 +1614,79 @@ flush_error()
}
}
#if HASHSPOOL
const char *
hashname(name)
char *name;
{
static char p[MAXPATHLEN];
int i;
int len;
char *str;
# if HASHSPOOLMD5
char Base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+_";
MD5_CTX ctx;
unsigned char md5[18];
# if MAXPATHLEN <= 24
ERROR _MAXPATHLEN <= 24
# endif /* MAXPATHLEN <= 24 */
char b64[24];
MD5_LONG bits;
int j;
# endif /* HASHSPOOLMD5 */
if (HashType == HASH_NONE || HashDepth * 2 >= MAXPATHLEN)
{
p[0] = '\0';
return p;
}
switch(HashType)
{
case HASH_USER:
str = name;
break;
# if HASHSPOOLMD5
case HASH_MD5:
MD5_Init(&ctx);
MD5_Update(&ctx, name, strlen(name));
MD5_Final(md5, &ctx);
md5[16] = 0;
md5[17] = 0;
for (i = 0; i < 6; i++)
{
bits = (unsigned) md5[(3 * i)] << 16;
bits |= (unsigned) md5[(3 * i) + 1] << 8;
bits |= (unsigned) md5[(3 * i) + 2];
for (j = 3; j >= 0; j--)
{
b64[(4 * i) + j] = Base64[(bits & 0x3f)];
bits >>= 6;
}
}
b64[22] = '\0';
str = b64;
break;
# endif /* HASHSPOOLMD5 */
}
len = strlen(str);
for (i = 0; i < HashDepth; i++)
{
if (i < len)
p[i * 2] = str[i];
else
p[i * 2] = '_';
p[(i * 2) + 1] = '/';
}
p[HashDepth * 2] = '\0';
return p;
}
#endif /* HASHSPOOL */
/*
* e_to_sys --
* Guess which errno's are temporary. Gag me.

View File

@ -15,12 +15,12 @@
#include <sm/gen.h>
SM_IDSTR(copyright,
"@(#) Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.\n\
"@(#) Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.\n\
All rights reserved.\n\
Copyright (c) 1988, 1993\n\
The Regents of the University of California. All rights reserved.\n")
SM_IDSTR(id, "@(#)$Id: mailstats.c,v 8.98 2002/05/24 23:10:15 gshapiro Exp $")
SM_IDSTR(id, "@(#)$Id: mailstats.c,v 8.100 2002/06/27 23:24:06 gshapiro Exp $")
#include <unistd.h>
#include <stddef.h>
@ -59,9 +59,7 @@ main(argc, argv)
bool trunc;
long frmsgs = 0, frbytes = 0, tomsgs = 0, tobytes = 0, rejmsgs = 0;
long dismsgs = 0;
#if _FFR_QUARANTINE
long quarmsgs = 0;
#endif /* _FFR_QUARANTINE */
time_t now;
char mtable[MAXMAILERS][MNAMELEN + 1];
char sfilebuf[MAXPATHLEN];
@ -285,18 +283,14 @@ main(argc, argv)
ctime(&stats.stat_itime));
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
" M msgsfr bytes_from msgsto bytes_to msgsrej msgsdis");
#if _FFR_QUARANTINE
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, " msgsqur");
#endif /* _FFR_QUARANTINE */
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%s\n",
mnames ? " Mailer" : "");
}
for (i = 0; i < MAXMAILERS; i++)
{
if (stats.stat_nf[i] || stats.stat_nt[i] ||
#if _FFR_QUARANTINE
stats.stat_nq[i] ||
#endif /* _FFR_QUARANTINE */
stats.stat_nr[i] || stats.stat_nd[i])
{
char *format;
@ -313,10 +307,8 @@ main(argc, argv)
stats.stat_bt[i],
stats.stat_nr[i],
stats.stat_nd[i]);
#if _FFR_QUARANTINE
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
" %6ld", stats.stat_nq[i]);
#endif /* _FFR_QUARANTINE */
if (mnames)
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
" %s",
@ -328,9 +320,7 @@ main(argc, argv)
tobytes += stats.stat_bt[i];
rejmsgs += stats.stat_nr[i];
dismsgs += stats.stat_nd[i];
#if _FFR_QUARANTINE
quarmsgs += stats.stat_nq[i];
#endif /* _FFR_QUARANTINE */
}
}
if (progmode)
@ -339,10 +329,8 @@ main(argc, argv)
" T %8ld %10ld %8ld %10ld %6ld %6ld",
frmsgs, frbytes, tomsgs, tobytes, rejmsgs,
dismsgs);
#if _FFR_QUARANTINE
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
" %6ld", quarmsgs);
#endif /* _FFR_QUARANTINE */
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "\n");
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
" C %8ld %8ld %6ld\n",
@ -360,18 +348,14 @@ main(argc, argv)
{
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
"=============================================================");
#if _FFR_QUARANTINE
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "========");
#endif /* _FFR_QUARANTINE */
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "\n");
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
" T %8ld %10ldK %8ld %10ldK %6ld %6ld",
frmsgs, frbytes, tomsgs, tobytes, rejmsgs,
dismsgs);
#if _FFR_QUARANTINE
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
" %6ld", quarmsgs);
#endif /* _FFR_QUARANTINE */
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "\n");
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT,
" C %8ld %10s %8ld %10s %6ld\n",

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
* Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1992 Eric P. Allman. All rights reserved.
* Copyright (c) 1992, 1993
@ -20,7 +20,7 @@ SM_IDSTR(copyright,
Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n")
SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.175 2001/12/28 22:44:01 ca Exp $")
SM_IDSTR(id, "@(#)$Id: makemap.c,v 8.176 2002/06/27 23:41:04 gshapiro Exp $")
#include <sys/types.h>
@ -56,13 +56,15 @@ static void
usage(progname)
char *progname;
{
/* XXX break the usage output into multiple lines? it's too long */
sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
"Usage: %s [-C cffile] [-N] [-c cachesize] [-d] [-e] [-f] [-l] [-o] [-r] [-s] [-t delimiter] [-u] [-v] type mapname\n",
progname);
#if _FFR_COMMENT_CHAR
/* add -D comment-char */
#endif /* _FFR_COMMENT_CHAR */
"Usage: %s [-C cffile] [-N] [-c cachesize] [-D commentchar]\n",
progname);
sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
" %*s [-d] [-e] [-f] [-l] [-o] [-r] [-s] [-t delimiter]\n",
(int) strlen(progname), "");
sm_io_fprintf(smioerr, SM_TIME_DEFAULT,
" %*s [-u] [-v] type mapname\n",
(int) strlen(progname), "");
exit(EX_USAGE);
}
@ -161,11 +163,9 @@ main(argc, argv)
foldcase = false;
break;
#if _FFR_COMMENT_CHAR
case 'D':
comment = *optarg;
break;
#endif /* _FFR_COMMENT_CHAR */
case 'l':
smdb_print_available_types();

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 1998-2001 Sendmail, Inc. and its suppliers.
.\" Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1993 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1993
@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: smrsh.8,v 8.16.2.2 2003/10/07 18:05:37 ca Exp $
.\" $Id: smrsh.8,v 8.20 2003/10/07 18:05:12 ca Exp $
.\"
.TH SMRSH 8 "$Date: 2003/10/07 18:05:37 $"
.TH SMRSH 8 "$Date: 2003/10/07 18:05:12 $"
.SH NAME
smrsh \- restricted shell for sendmail
.SH SYNOPSIS

View File

@ -21,7 +21,7 @@ SM_IDSTR(copyright,
Copyright (c) 1993\n\
The Regents of the University of California. All rights reserved.\n")
SM_IDSTR(id, "@(#)$Id: smrsh.c,v 8.58.2.5 2003/12/15 17:09:39 ca Exp $")
SM_IDSTR(id, "@(#)$Id: smrsh.c,v 8.63 2003/12/15 17:12:29 ca Exp $")
/*
** SMRSH -- sendmail restricted shell

View File

@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: aliases.5,v 8.17 2000/12/14 23:09:46 gshapiro Exp $
.\" $Id: aliases.5,v 8.19 2004/07/12 05:39:21 ca Exp $
.\"
.TH ALIASES 5 "$Date: 2000/12/14 23:09:46 $"
.TH ALIASES 5 "$Date: 2004/07/12 05:39:21 $"
.SH NAME
aliases
\- aliases file for sendmail
@ -78,6 +78,17 @@ are comments.
Aliasing occurs only on local names.
Loops can not occur, since no message will be sent to any person more than once.
.PP
If an alias is found for
.IR name ,
sendmail then checks for an alias for
.IR owner-name .
If it is found and the result of the lookup expands to a single
address, the envelope sender address of the message is rewritten to
that address.
If it is found and the result expands to more than one address, the
envelope sender address is changed to
.IR owner-name .
.PP
After aliasing has been done, local and valid recipients who have a
``.forward''
file in their home directory have messages forwarded to the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@ -14,7 +14,7 @@
#include <sendmail.h>
SM_RCSID("@(#)$Id: conf.c,v 8.972.2.54 2004/01/08 21:54:55 ca Exp $")
SM_RCSID("@(#)$Id: conf.c,v 8.1047 2004/07/14 21:54:23 ca Exp $")
#include <sendmail/pathnames.h>
#if NEWDB
@ -82,6 +82,7 @@ struct hdrinfo HdrInfo[] =
{ "errors-to", H_FROM|H_ERRORSTO, NULL },
{ "full-name", H_ACHECK, NULL },
{ "return-receipt-to", H_RECEIPTTO, NULL },
{ "delivery-receipt-to", H_RECEIPTTO, NULL },
{ "disposition-notification-to", H_FROM, NULL },
/* destination fields */
@ -260,9 +261,7 @@ setdefaults(e)
WkClassFact = 1800L; /* option z */
WkTimeFact = 90000L; /* option Z */
QueueFactor = WkRecipFact * 20; /* option q */
#if _FFR_QUARANTINE
QueueMode = QM_NORMAL; /* what queue items to act upon */
#endif /* _FFR_QUARANTINE */
FileMode = (RealUid != geteuid()) ? 0644 : 0600;
/* option F */
QueueFileMode = (RealUid != geteuid()) ? 0644 : 0600;
@ -339,6 +338,7 @@ setdefaults(e)
FastSplit = 1;
#if SASL
AuthMechanisms = newstr(AUTH_MECHANISMS);
AuthRealm = NULL;
MaxSLBits = INT_MAX;
#endif /* SASL */
#if STARTTLS
@ -369,12 +369,11 @@ setdefaults(e)
#if MILTER
InputFilters[0] = NULL;
#endif /* MILTER */
#if _FFR_REJECT_LOG
RejectLogInterval = 3 HOURS;
#endif /* _FFR_REJECT_LOG */
#if _FFR_REQ_DIR_FSYNC_OPT
#if REQUIRES_DIR_FSYNC
RequiresDirfsync = true;
#endif /* _FFR_REQ_DIR_FSYNC_OPT */
#endif /* REQUIRES_DIR_FSYNC */
ConnectionRateWindowSize = 60;
setupmaps();
setupqueues();
setupmailers();
@ -641,6 +640,13 @@ setupmaps()
dequote_init, null_map_open, null_map_close,
arith_map_lookup, null_map_store);
#if SOCKETMAP
/* arbitrary daemons */
MAPDEF("socket", NULL, MCF_ALIASOK,
map_parseargs, socket_map_open, socket_map_close,
socket_map_lookup, null_map_store);
#endif /* SOCKETMAP */
if (tTd(38, 2))
{
/* bogus map -- always return tempfail */
@ -1493,7 +1499,6 @@ getla()
double avenrun[3];
# endif /* LA_TYPE == LA_SHORT */
# endif /* LA_TYPE == LA_INT */
extern int errno;
extern off_t lseek();
if (kmem < 0)
@ -1601,7 +1606,6 @@ getla()
int j;
static int kmem = -1;
long avenrun[3];
extern int errno;
struct mioc_rksym mirk;
if (kmem < 0)
@ -1829,6 +1833,12 @@ getla()
# include <sys/sysmp.h>
# ifdef _UNICOSMP
# define CAST_SYSMP(x) (x)
# else /* _UNICOSMP */
# define CAST_SYSMP(x) ((x) & 0x7fffffff)
# endif /* _UNICOSMP */
int
getla(void)
{
@ -1858,7 +1868,8 @@ getla(void)
}
}
if (lseek(kmem, (sysmp(MP_KERNADDR, MPKA_AVENRUN) & 0x7fffffff), SEEK_SET) == -1 ||
if (lseek(kmem, CAST_SYSMP(sysmp(MP_KERNADDR, MPKA_AVENRUN)), SEEK_SET)
== -1 ||
read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
{
if (tTd(3, 1))
@ -2194,16 +2205,16 @@ refuseconnections(name, e, d, active)
{
static time_t lastconn[MAXDAEMONS];
static int conncnt[MAXDAEMONS];
#if _FFR_REJECT_LOG
static time_t firstrejtime[MAXDAEMONS];
static time_t nextlogtime[MAXDAEMONS];
#endif /* _FFR_REJECT_LOG */
#if XLA
if (!xla_smtp_ok())
return true;
#endif /* XLA */
SM_ASSERT(d >= 0);
SM_ASSERT(d < MAXDAEMONS);
if (ConnRateThrottle > 0)
{
time_t now;
@ -2235,16 +2246,13 @@ refuseconnections(name, e, d, active)
sm_getla();
if (RefuseLA > 0 && CurrentLA >= RefuseLA)
{
# if _FFR_REJECT_LOG
time_t now;
# define R2_MSG_LA "have been rejecting connections on daemon %s for %s"
# endif /* _FFR_REJECT_LOG */
# define R_MSG_LA "rejecting connections on daemon %s: load average: %d"
# define R2_MSG_LA "have been rejecting connections on daemon %s for %s"
sm_setproctitle(true, e, R_MSG_LA, name, CurrentLA);
if (LogLevel > 8)
sm_syslog(LOG_NOTICE, NOQID, R_MSG_LA, name, CurrentLA);
# if _FFR_REJECT_LOG
now = curtime();
if (firstrejtime[d] == 0)
{
@ -2257,13 +2265,10 @@ refuseconnections(name, e, d, active)
pintvl(now - firstrejtime[d], true));
nextlogtime[d] = now + RejectLogInterval;
}
# endif /* _FFR_REJECT_LOG */
return true;
}
# if _FFR_REJECT_LOG
else
firstrejtime[d] = 0;
# endif /* _FFR_REJECT_LOG */
if (DelayLA > 0 && CurrentLA >= DelayLA)
{
@ -3969,6 +3974,7 @@ validate_connection(sap, hostname, e)
sm_dprintf("validate_connection(%s, %s)\n",
hostname, anynet_ntoa(sap));
connection_rate_check(sap, e);
if (rscheck("check_relay", hostname, anynet_ntoa(sap),
e, RSF_RMCOMM|RSF_COUNT, 3, NULL, NOQID) != EX_OK)
{
@ -5156,6 +5162,80 @@ get_num_procs_online()
return nproc;
}
/*
** SM_CLOSEFROM -- close file descriptors
**
** Parameters:
** lowest -- first fd to close
** highest -- last fd + 1 to close
**
** Returns:
** none
*/
void
sm_closefrom(lowest, highest)
int lowest, highest;
{
#if HASCLOSEFROM
closefrom(lowest);
#else /* HASCLOSEFROM */
int i;
for (i = lowest; i < highest; i++)
(void) close(i);
#endif /* HASCLOSEFROM */
}
#if HASFDWALK
/*
** CLOSEFD_WALK -- walk fd's arranging to close them
** Callback for fdwalk()
**
** Parameters:
** lowest -- first fd to arrange to be closed
** fd -- fd to arrange to be closed
**
** Returns:
** zero
*/
static int
closefd_walk(lowest, fd)
void *lowest;
int fd;
{
if (fd >= *(int *)lowest)
(void) fcntl(fd, F_SETFD, FD_CLOEXEC);
return 0;
}
#endif /* HASFDWALK */
/*
** SM_CLOSE_ON_EXEC -- arrange for file descriptors to be closed
**
** Parameters:
** lowest -- first fd to arrange to be closed
** highest -- last fd + 1 to arrange to be closed
**
** Returns:
** none
*/
void
sm_close_on_exec(highest, lowest)
int highest, lowest;
{
#if HASFDWALK
(void) fdwalk(closefd_walk, &lowest);
#else /* HASFDWALK */
int i, j;
for (i = lowest; i < highest; i++)
{
if ((j = fcntl(i, F_GETFD, 0)) != -1)
(void) fcntl(i, F_SETFD, j | FD_CLOEXEC);
}
#endif /* HASFDWALK */
}
/*
** SEED_RANDOM -- seed the random number generator
**
** Parameters:
@ -5537,6 +5617,9 @@ link(source, target)
char *CompileOptions[] =
{
#if ALLOW_255
"ALLOW_255",
#endif /* ALLOW_255 */
#if NAMED_BIND
# if DNSMAP
"DNSMAP",
@ -5639,6 +5722,9 @@ char *CompileOptions[] =
#if SMTPDEBUG
"SMTPDEBUG",
#endif /* SMTPDEBUG */
#if SOCKETMAP
"SOCKETMAP",
#endif /* SOCKETMAP */
#if STARTTLS
"STARTTLS",
#endif /* STARTTLS */
@ -5660,6 +5746,9 @@ char *CompileOptions[] =
#if USE_LDAP_INIT
"USE_LDAP_INIT",
#endif /* USE_LDAP_INIT */
#if USE_TTYPATH
"USE_TTYPATH",
#endif /* USE_TTYPATH */
#if XDEBUG
"XDEBUG",
#endif /* XDEBUG */
@ -5679,9 +5768,6 @@ char *OsCompileOptions[] =
#if ADDRCONFIG_IS_BROKEN
"ADDRCONFIG_IS_BROKEN",
#endif /* ADDRCONFIG_IS_BROKEN */
#if ALLOW_255
"ALLOW_255",
#endif /* ALLOW_255 */
#ifdef AUTO_NETINFO_HOSTS
"AUTO_NETINFO_HOSTS",
#endif /* AUTO_NETINFO_HOSTS */
@ -5703,12 +5789,18 @@ char *OsCompileOptions[] =
#if FAST_PID_RECYCLE
"FAST_PID_RECYCLE",
#endif /* FAST_PID_RECYCLE */
#if HASCLOSEFROM
"HASCLOSEFROM",
#endif /* HASCLOSEFROM */
#if HASFCHOWN
"HASFCHOWN",
#endif /* HASFCHOWN */
#if HASFCHMOD
"HASFCHMOD",
#endif /* HASFCHMOD */
#if HASFDWALK
"HASFDWALK",
#endif /* HASFDWALK */
#if HASFLOCK
"HASFLOCK",
#endif /* HASFLOCK */
@ -5886,20 +5978,11 @@ char *OsCompileOptions[] =
char *FFRCompileOptions[] =
{
#if _FFR_ADAPTIVE_EOL
/* tries to be smart about \r\n versus \n from broken clients */
/* known to be broken, do not use */
"_FFR_ADAPTIVE_EOL",
#endif /* _FFR_ADAPTIVE_EOL */
#if _FFR_ALLOW_SASLINFO
/* DefaultAuthInfo can be specified by user. */
/* DefaultAuthInfo doesn't really work in 8.12 anymore. */
/* DefaultAuthInfo doesn't really work in 8.13 anymore. */
"_FFR_ALLOW_SASLINFO",
#endif /* _FFR_ALLOW_SASLINFO */
#if _FFR_ALLOW_S0_ERROR_4XX
/* Allow for tempfail from S0 (ruleset 0). */
"_FFR_ALLOW_S0_ERROR_4XX",
#endif /* _FFR_ALLOW_S0_ERROR_4XX */
#if _FFR_BESTMX_BETTER_TRUNCATION
/* Better truncation of list of MX records for dns map. */
"_FFR_BESTMX_BETTER_TRUNCATION",
@ -5912,19 +5995,10 @@ char *FFRCompileOptions[] =
"_FFR_BLOCK_PROXIES",
#endif /* _FFR_BLOCK_PROXIES */
#if _FFR_CACHE_LPC
/* Cache connections to LCP based mailers */
/* Christophe Wolfhugel of France Telecom Oleane */
"_FFR_CACHE_LPC",
#endif /* _FFR_CACHE_LPC */
#if _FFR_CATCH_BROKEN_MTAS
/* Deal with MTAs that send a reply during the DATA phase. */
"_FFR_CATCH_BROKEN_MTAS",
#endif /* _FFR_CATCH_BROKEN_MTAS */
#if _FFR_CATCH_LONG_STRINGS
/* Report long address strings instead of silently ignoring them. */
"_FFR_CATCH_LONG_STRINGS",
#endif /* _FFR_CATCH_LONG_STRINGS */
#if _FFR_CHECK_EOM
/* Enable check_eom ruleset */
"_FFR_CHECK_EOM",
@ -5941,6 +6015,10 @@ char *FFRCompileOptions[] =
/* Extended daemon status. */
"_FFR_CONTROL_MSTAT",
#endif /* _FFR_CONTROL_MSTAT */
#if _FFR_CRLPATH
/* CRLPath; needs documentation; Al Smith */
"_FFR_CRLPATH",
#endif /* _FFR_CRLPATH */
#if _FFR_DAEMON_NETUNIX
/* Allow local (not just TCP) socket connection to server. */
"_FFR_DAEMON_NETUNIX",
@ -5979,11 +6057,6 @@ char *FFRCompileOptions[] =
/* Enable DontLockFilesForRead option. */
"_FFR_DONTLOCKFILESFORREAD_OPTION",
#endif /* _FFR_DONTLOCKFILESFORREAD_OPTION */
#if _FFR_DONT_STOP_LOOKING
/* Continue with DNS lookups on ECONNREFUSED and TRY_AGAIN. */
/* Noted by Neil Rickert of Northern Illinois University */
"_FFR_DONT_STOP_LOOKING",
#endif /* _FFR_DONT_STOP_LOOKING */
#if _FFR_DOTTED_USERNAMES
/* Allow usernames with '.' */
"_FFR_DOTTED_USERNAMES",
@ -6034,6 +6107,10 @@ char *FFRCompileOptions[] =
/* Set 'h' in {addr_type} for headers. */
"_FFR_HDR_TYPE",
#endif /* _FFR_HDR_TYPE */
#if _FFR_HELONAME
/* option to set heloname; Nik Clayton of FreeBSD */
"_FFR_HELONAME",
#endif /* _FFR_HELONAME */
#if _FFR_HPUX_NSSWITCH
/* Use nsswitch on HP-UX */
"_FFR_HPUX_NSSWITCH",
@ -6046,19 +6123,16 @@ char *FFRCompileOptions[] =
/* Ignore extensions offered in response to HELO */
"_FFR_IGNORE_EXT_ON_HELO",
#endif /* _FFR_IGNORE_EXT_ON_HELO */
#if _FFR_LDAP_RECURSION
/* Support LDAP recursion in LDAP responses */
/* Andrew Baucom */
"_FFR_LDAP_RECURSION",
#endif /* _FFR_LDAP_RECURSION */
#if _FFR_LDAP_SETVERSION
/* New LDAP map option for setting LDAP protocol version */
"_FFR_LDAP_SETVERSION",
#endif /* _FFR_LDAP_SETVERSION */
#if _FFR_LDAP_URI
/* Support LDAP URI form of specifying host/port (and allows ldaps) */
"_FFR_LDAP_URI",
#endif /* _FFR_LDAP_URI */
#if _FFR_MAXDATASIZE
/*
** It is possible that a header is larger than MILTER_CHUNK_SIZE,
** hence this shouldn't be used as limit for milter communication.
** see also libmilter/comm.c
** Gurusamy Sarathy of ActiveState
*/
"_FFR_MAXDATASIZE"
#endif /* _FFR_MAXDATASIZE */
#if _FFR_MAX_FORWARD_ENTRIES
/* Try to limit number of .forward entries */
/* (doesn't work) */
@ -6069,24 +6143,20 @@ char *FFRCompileOptions[] =
/* Limit sleep(2) time in libsm/clock.c */
"_FFR_MAX_SLEEP_TIME",
#endif /* _FFR_MAX_SLEEP_TIME */
#if _FFR_MESSAGEID_MACRO
/* stick the message ID header's value in a macro */
"_FFR_MESSAGEID_MACRO",
#endif /* _FFR_MESSAGEID_MACRO */
#if MILTER
# if _FFR_MILTER_421
/* If a filter returns 421, close the SMTP connection */
"_FFR_MILTER_421",
# endif /* _FFR_MILTER_421 */
# if _FFR_MILTER_MACROS_EOM
/* Add an EOM macro set for milter */
"_FFR_MILTER_MACROS_EOM",
# endif /* _FFR_MILTER_MACROS_EOM */
# if _FFR_MILTER_PERDAEMON
/* Per DaemonPortOptions InputMailFilter lists */
"_FFR_MILTER_PERDAEMON",
# endif /* _FFR_MILTER_PERDAEMON */
#endif /* MILTER */
#if _FFR_MILTER_NAGLE
/* milter: turn off Nagle ("cork" on Linux) */
/* John Gardiner Myers of Proofpoint */
"_FFR_MILTER_NAGLE ",
#endif /* _FFR_MILTER_NAGLE */
#if _FFR_MILTER_NOHDR_RESP
/* milter: no response expected when sending headers */
/* John Gardiner Myers of Proofpoint */
"_FFR_MILTER_NOHDR_RESP",
#endif /* _FFR_MILTER_NOHDR_RESP */
#if _FFR_MIME7TO8_OLD
/* Old mime7to8 code, the new is broken for at least one example. */
"_FFR_MIME7TO8_OLD",
#endif /* _FFR_MAX_SLEEP_TIME */
#if _FFR_NODELAYDSN_ON_HOLD
/* Do not issue a DELAY DSN for mailers that use the hold flag. */
/* Steven Pitzl */
@ -6096,10 +6166,6 @@ char *FFRCompileOptions[] =
/* Disable PIPELINING, delay client if used. */
"_FFR_NO_PIPE",
#endif /* _FFR_NO_PIPE */
#if _FFR_QUARANTINE
/* Quarantine items in the queue */
"_FFR_QUARANTINE",
#endif /* _FFR_QUARANTINE */
#if _FFR_QUEUEDELAY
/* Exponential queue delay; disabled in 8.13 since it isn't used. */
"_FFR_QUEUEDELAY",
@ -6113,16 +6179,6 @@ char *FFRCompileOptions[] =
/* Define {queue} macro. */
"_FFR_QUEUE_MACRO",
#endif /* _FFR_QUEUE_MACRO */
#if _FFR_QUEUERETURN_DSN
/*
** Provide an option for different Timeout.queue{warn,return} for
** DSN messages. These days, queues are filled with bounces for
** spam that will never make it to the sender and therefore slow
** down queue runs until they timeout.
*/
"_FFR_QUEUERETURN_DSN",
#endif /* _FFR_QUEUERETURN_DSN */
#if _FFR_QUEUE_RUN_PARANOIA
/* Additional checks when doing queue runs. */
"_FFR_QUEUE_RUN_PARANOIA",
@ -6140,30 +6196,14 @@ char *FFRCompileOptions[] =
"_FFR_REDIRECTEMPTY",
#endif /* _FFR_REDIRECTEMPTY */
#if _FFR_REJECT_LOG
/* Log when we start/stop rejecting connections due to load, etc */
"_FFR_REJECT_LOG",
#endif /* _FFR_REJECT_LOG */
#if _FFR_REQ_DIR_FSYNC_OPT
/* Add cf option to fsync() directories */
"_FFR_REQ_DIR_FSYNC_OPT",
#endif /* _FFR_REQ_DIR_FSYNC_OPT */
#if _FFR_RESET_MACRO_GLOBALS
/* Allow macro 'j' to be set dynamically via rulesets. */
"_FFR_RESET_MACRO_GLOBALS",
#endif /* _FFR_RESET_MACRO_GLOBALS */
#if _FFR_RESPOND_ALL
/* in vacation: respond to every message, not just once per interval */
"_FFR_RESPOND_ALL",
#endif /* _FFR_RESPOND_ALL */
#if _FFR_RHS
/* Random shuffle for queue sorting. */
"_FFR_RHS",
#endif /* _FFR_RHS */
#if _FFR_SASL_OPT_M
/* Support SASL's SASL_SEC_MUTUAL_AUTH option */
"_FFR_SASL_OPT_M",
#endif /* _FFR_SASL_OPT_M */
#if _FFR_SELECT_SHM
/* Auto-select of shared memory key */
"_FFR_SELECT_SHM",
@ -6172,18 +6212,14 @@ char *FFRCompileOptions[] =
/* Donated code (unused). */
"_FFR_SHM_STATUS",
#endif /* _FFR_SHM_STATUS */
#if _FFR_SKIP_DOMAINS
/* process every N'th domain instead of every N'th message */
"_FFR_SKIP_DOMAINS"
#endif /* _FFR_SKIP_DOMAINS */
#if _FFR_SLEEP_USE_SELECT
/* Use select(2) in libsm/clock.c to emulate sleep(2) */
"_FFR_SLEEP_USE_SELECT ",
#endif /* _FFR_SLEEP_USE_SELECT */
#if _FFR_SMFI_OPENSOCKET
/* libmilter: smfi_opensocket() to force the socket open early */
"_FFR_SMFI_OPENSOCKET",
#endif /* _FFR_SMFI_OPENSOCKET */
#if _FFR_SMTP_SSL
/* Support for smtps (SMTP over SSL) */
"_FFR_SMTP_SSL",
#endif /* _FFR_SMTP_SSL */
#if _FFR_SOFT_BOUNCE
/* Turn all errors into temporary errors. */
"_FFR_SOFT_BOUNCE",
@ -6200,14 +6236,6 @@ char *FFRCompileOptions[] =
/* Chris Adams of HiWAAY Informations Services */
"_FFR_SPT_ALIGN",
#endif /* _FFR_SPT_ALIGN */
#if _FFR_STRIPBACKSL
/*
** Strip backslash from addresses (so sender doesn't
** decide to ignore forward)
*/
"_FFR_STRIPBACKSL",
#endif /* _FFR_STRIPBACKSL */
#if _FFR_TIMERS
/* Donated code (unused). */
"_FFR_TIMERS",

View File

@ -10,7 +10,7 @@
* the sendmail distribution.
*
*
* $Id: conf.h,v 8.563.2.3 2002/10/31 03:28:36 ca Exp $
* $Id: conf.h,v 8.567 2004/07/23 20:45:01 gshapiro Exp $
*/
/*
@ -145,6 +145,16 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */
# define DBMMODE 0640
#endif /* ! DBMMODE */
/*
** Value which means a uid or gid value should not change
*/
#ifndef NO_UID
# define NO_UID -1
#endif /* ! NO_UID */
#ifndef NO_GID
# define NO_GID -1
#endif /* ! NO_GID */
/**********************************************************************
** Compilation options.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@ -13,7 +13,7 @@
#include <sendmail.h>
SM_RCSID("@(#)$Id: err.c,v 8.189 2002/01/09 18:52:30 ca Exp $")
SM_RCSID("@(#)$Id: err.c,v 8.191 2003/01/10 02:16:46 ca Exp $")
#if LDAPMAP
# include <lber.h>
@ -238,7 +238,7 @@ syserr(fmt, va_alist)
case ESTALE:
#endif /* ESTALE */
printopenfds(true);
mci_dump_all(true);
mci_dump_all(smioout, true);
break;
}
if (panic)

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@ -14,8 +14,9 @@
#include <sendmail.h>
SM_RCSID("@(#)$Id: headers.c,v 8.266.4.9 2003/10/30 00:17:22 gshapiro Exp $")
SM_RCSID("@(#)$Id: headers.c,v 8.286 2004/07/08 17:57:32 ca Exp $")
static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *));
static size_t fix_mime_header __P((HDR *, ENVELOPE *));
static int priencode __P((char *));
static void put_vanilla_header __P((HDR *, char *, MCI *));
@ -88,7 +89,7 @@ chompheader(line, pflag, hdrp, e)
if (tTd(31, 6))
{
sm_dprintf("chompheader: ");
xputs(line);
xputs(sm_debug_file(), line);
sm_dprintf("\n");
}
@ -292,11 +293,12 @@ chompheader(line, pflag, hdrp, e)
int rscheckflags;
char *rs;
/* no ruleset? look for default */
rs = hi->hi_ruleset;
rscheckflags = RSF_COUNT;
if (!bitset(hi->hi_flags, H_FROM|H_RCPT))
rscheckflags |= RSF_UNSTRUCTURED;
/* no ruleset? look for default */
rs = hi->hi_ruleset;
if (rs == NULL)
{
s = stab("*", ST_HEADER, ST_FIND);
@ -358,17 +360,10 @@ chompheader(line, pflag, hdrp, e)
(void) sm_snprintf(qval, sizeof qval, "%d", k);
macdefine(&e->e_macro, A_TEMP, macid("{hdrlen}"), qval);
#if _FFR_HDR_TYPE
/*
** XXX: h isn't set yet
** If we really want to be precise then we have
** to lookup the header (see below).
** It's probably not worth the effort.
*/
if (bitset(H_FROM, h->h_flags))
if (bitset(H_FROM, hi->hi_flags))
macdefine(&e->e_macro, A_PERM,
macid("{addr_type}"), "h s");
else if (bitset(H_RCPT, h->h_flags))
else if (bitset(H_RCPT, hi->hi_flags))
macdefine(&e->e_macro, A_PERM,
macid("{addr_type}"), "h r");
else
@ -467,6 +462,44 @@ chompheader(line, pflag, hdrp, e)
return h->h_flags;
}
/*
** ALLOCHEADER -- allocate a header entry
**
** Parameters:
** field -- the name of the header field.
** value -- the value of the field.
** flags -- flags to add to h_flags.
** rp -- resource pool for allocations
**
** Returns:
** Pointer to a newly allocated and populated HDR.
*/
static HDR *
allocheader(field, value, flags, rp)
char *field;
char *value;
int flags;
SM_RPOOL_T *rp;
{
HDR *h;
STAB *s;
/* find info struct */
s = stab(field, ST_HEADER, ST_FIND);
/* allocate space for new header */
h = (HDR *) sm_rpool_malloc_x(rp, sizeof *h);
h->h_field = field;
h->h_value = sm_rpool_strdup_x(rp, value);
h->h_flags = flags;
if (s != NULL)
h->h_flags |= s->s_header.hi_flags;
clrbitmap(h->h_mflags);
h->h_macro = '\0';
return h;
}
/*
** ADDHEADER -- add a header entry to the end of the queue.
**
** This bypasses the special checking of chompheader.
@ -492,13 +525,9 @@ addheader(field, value, flags, e)
ENVELOPE *e;
{
register HDR *h;
STAB *s;
HDR **hp;
HDR **hdrlist = &e->e_header;
/* find info struct */
s = stab(field, ST_HEADER, ST_FIND);
/* find current place in list -- keep back pointer? */
for (hp = hdrlist; (h = *hp) != NULL; hp = &h->h_link)
{
@ -507,18 +536,65 @@ addheader(field, value, flags, e)
}
/* allocate space for new header */
h = (HDR *) sm_rpool_malloc_x(e->e_rpool, sizeof *h);
h->h_field = field;
h->h_value = sm_rpool_strdup_x(e->e_rpool, value);
h = allocheader(field, value, flags, e->e_rpool);
h->h_link = *hp;
h->h_flags = flags;
if (s != NULL)
h->h_flags |= s->s_header.hi_flags;
clrbitmap(h->h_mflags);
h->h_macro = '\0';
*hp = h;
}
/*
** INSHEADER -- insert a header entry at the specified index
**
** This bypasses the special checking of chompheader.
**
** Parameters:
** idx -- index into the header list at which to insert
** field -- the name of the header field.
** value -- the value of the field.
** flags -- flags to add to h_flags.
** e -- envelope.
**
** Returns:
** none.
**
** Side Effects:
** inserts the field on the list of headers for this envelope.
*/
void
insheader(idx, field, value, flags, e)
int idx;
char *field;
char *value;
int flags;
ENVELOPE *e;
{
HDR *h, *srch, *last = NULL;
/* allocate space for new header */
h = allocheader(field, value, flags, e->e_rpool);
/* find insertion position */
for (srch = e->e_header; srch != NULL && idx > 0;
srch = srch->h_link, idx--)
last = srch;
if (e->e_header == NULL)
{
e->e_header = h;
h->h_link = NULL;
}
else if (srch == NULL)
{
SM_ASSERT(last != NULL);
last->h_link = h;
h->h_link = NULL;
}
else
{
h->h_link = srch->h_link;
srch->h_link = h;
}
}
/*
** HVALUE -- return value of a header.
**
** Only "real" fields (i.e., ones that have not been supplied
@ -674,7 +750,7 @@ eatheader(e, full, log)
if (tTd(32, 1))
{
sm_dprintf("(");
xputs(h->h_value);
xputs(sm_debug_file(), h->h_value);
sm_dprintf(") ");
}
expand(h->h_value, buf, sizeof buf, e);
@ -689,7 +765,7 @@ eatheader(e, full, log)
}
if (tTd(32, 1))
{
xputs(h->h_value);
xputs(sm_debug_file(), h->h_value);
sm_dprintf("\n");
}
@ -731,10 +807,8 @@ eatheader(e, full, log)
e->e_msgid = h->h_value;
while (isascii(*e->e_msgid) && isspace(*e->e_msgid))
e->e_msgid++;
#if _FFR_MESSAGEID_MACRO
macdefine(&e->e_macro, A_PERM, macid("{msg_id}"),
e->e_msgid);
#endif /* _FFR_MESSAGEID_MACRO */
e->e_msgid);
}
}
if (tTd(32, 1))
@ -767,6 +841,60 @@ eatheader(e, full, log)
+ e->e_nrcpts * WkRecipFact;
}
/* check for DSN to properly set e_timeoutclass */
p = hvalue("content-type", e->e_header);
if (p != NULL)
{
bool oldsupr;
char **pvp;
char pvpbuf[MAXLINE];
extern unsigned char MimeTokenTab[256];
/* tokenize header */
oldsupr = SuprErrs;
SuprErrs = true;
pvp = prescan(p, '\0', pvpbuf, sizeof pvpbuf, NULL,
MimeTokenTab, false);
SuprErrs = oldsupr;
/* Check if multipart/report */
if (pvp != NULL && pvp[0] != NULL &&
pvp[1] != NULL && pvp[2] != NULL &&
sm_strcasecmp(*pvp++, "multipart") == 0 &&
strcmp(*pvp++, "/") == 0 &&
sm_strcasecmp(*pvp++, "report") == 0)
{
/* Look for report-type=delivery-status */
while (*pvp != NULL)
{
/* skip to semicolon separator */
while (*pvp != NULL && strcmp(*pvp, ";") != 0)
pvp++;
/* skip semicolon */
if (*pvp++ == NULL || *pvp == NULL)
break;
/* look for report-type */
if (sm_strcasecmp(*pvp++, "report-type") != 0)
continue;
/* skip equal */
if (*pvp == NULL || strcmp(*pvp, "=") != 0)
continue;
/* check value */
if (*++pvp != NULL &&
sm_strcasecmp(*pvp,
"delivery-status") == 0)
e->e_timeoutclass = TOC_DSN;
/* found report-type, no need to continue */
break;
}
}
}
/* message timeout priority */
p = hvalue("priority", e->e_header);
if (p != NULL)
@ -778,15 +906,11 @@ eatheader(e, full, log)
e->e_timeoutclass = TOC_NORMAL;
else if (sm_strcasecmp(p, "non-urgent") == 0)
e->e_timeoutclass = TOC_NONURGENT;
#if _FFR_QUEUERETURN_DSN
else if (bitset(EF_RESPONSE, e->e_flags))
e->e_timeoutclass = TOC_DSN;
#endif /* _FFR_QUEUERETURN_DSN */
}
#if _FFR_QUEUERETURN_DSN
else if (bitset(EF_RESPONSE, e->e_flags))
e->e_timeoutclass = TOC_DSN;
#endif /* _FFR_QUEUERETURN_DSN */
/* date message originated */
p = hvalue("posted-date", e->e_header);
@ -1240,12 +1364,8 @@ crackaddr(addr, e)
{
c = *q++;
if (quoteit && c == '"')
{
SM_APPEND_CHAR('\\');
SM_APPEND_CHAR(c);
}
else
SM_APPEND_CHAR(c);
SM_APPEND_CHAR(c);
}
if (quoteit)
{
@ -1407,7 +1527,7 @@ crackaddr(addr, e)
if (tTd(33, 1))
{
sm_dprintf("crackaddr=>`");
xputs(buf);
xputs(sm_debug_file(), buf);
sm_dprintf("'\n");
}
return buf;
@ -1460,7 +1580,7 @@ putheader(mci, hdr, e, flags)
if (tTd(34, 11))
{
sm_dprintf(" %s: ", h->h_field);
xputs(p);
xputs(sm_debug_file(), p);
}
/* Skip empty headers */
@ -1814,7 +1934,7 @@ commaize(h, p, oldstyle, mci, e)
char pvpbuf[PSBUFSIZE];
res = prescan(p, oldstyle ? ' ' : ',', pvpbuf,
sizeof pvpbuf, &oldp, NULL);
sizeof pvpbuf, &oldp, NULL, false);
p = oldp;
#if _FFR_IGNORE_BOGUS_ADDR
/* ignore addresses that can't be parsed */

View File

@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: mailq.1,v 8.19.2.1 2002/09/26 23:03:39 gshapiro Exp $
.\" $Id: mailq.1,v 8.20 2002/06/27 22:47:34 gshapiro Exp $
.\"
.TH MAILQ 1 "$Date: 2002/09/26 23:03:39 $"
.TH MAILQ 1 "$Date: 2002/06/27 22:47:34 $"
.SH NAME
mailq
\- print the mail queue
@ -55,6 +55,13 @@ Show the mail submission queue specified in
instead of the MTA queue specified in
.IR /etc/mail/sendmail.cf .
.TP
.B \-qL
Show the "lost" items in the mail queue instead of the normal queue items.
.TP
.B \-qQ
Show the quarantined items in the mail queue instead of the normal queue
items.
.TP
\fB\-q\fR[\fI!\fR]I substr
Limit processed jobs to those containing
.I substr
@ -62,6 +69,13 @@ as a substring of the queue id or not when
.I !
is specified.
.TP
\fB\-q\fR[\fI!\fR]Q substr
Limit processed jobs to quarantined jobs containing
.I substr
as a substring of the quarantine reason or not when
.I !
is specified.
.TP
\fB\-q\fR[\fI!\fR]R substr
Limit processed jobs to those containing
.I substr

View File

@ -14,7 +14,7 @@
#include <sendmail.h>
SM_RCSID("@(#)$Id: mci.c,v 8.205.2.4 2003/03/31 17:35:27 ca Exp $")
SM_RCSID("@(#)$Id: mci.c,v 8.211 2003/03/31 17:35:50 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@ -488,6 +488,7 @@ mci_setstat(mci, xstat, dstat, rstat)
** MCI_DUMP -- dump the contents of an MCI structure.
**
** Parameters:
** fp -- output file pointer
** mci -- the MCI structure to dump.
**
** Returns:
@ -530,7 +531,8 @@ static struct mcifbits MciFlags[] =
};
void
mci_dump(mci, logit)
mci_dump(fp, mci, logit)
SM_FILE_T *fp;
register MCI *mci;
bool logit;
{
@ -598,12 +600,13 @@ mci_dump(mci, logit)
if (logit)
sm_syslog(LOG_DEBUG, CurEnv->e_id, "%.1000s", buf);
else
(void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%s\n", buf);
(void) sm_io_fprintf(fp, SM_TIME_DEFAULT, "%s\n", buf);
}
/*
** MCI_DUMP_ALL -- print the entire MCI cache
**
** Parameters:
** fp -- output file pointer
** logit -- if set, log the result instead of printing
** to stdout.
**
@ -612,7 +615,8 @@ mci_dump(mci, logit)
*/
void
mci_dump_all(logit)
mci_dump_all(fp, logit)
SM_FILE_T *fp;
bool logit;
{
register int i;
@ -621,7 +625,7 @@ mci_dump_all(logit)
return;
for (i = 0; i < MaxMciCache; i++)
mci_dump(MciCache[i], logit);
mci_dump(fp, MciCache[i], logit);
}
/*
** MCI_LOCK_HOST -- Lock host while sending.
@ -926,7 +930,7 @@ mci_read_persistent(fp, mci)
case '.': /* end of file */
if (tTd(56, 93))
mci_dump(mci, false);
mci_dump(sm_debug_file(), mci, false);
return 0;
default:

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
* Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@ -13,7 +13,7 @@
#include <sendmail.h>
SM_RCSID("@(#)$Id: savemail.c,v 8.299.2.1 2002/10/23 15:08:47 ca Exp $")
SM_RCSID("@(#)$Id: savemail.c,v 8.303 2004/01/14 02:56:51 ca Exp $")
static void errbody __P((MCI *, ENVELOPE *, char *));
static bool pruneroute __P((char *));
@ -74,7 +74,7 @@ savemail(e, sendbody)
sm_dprintf("\nsavemail, errormode = %c, id = %s, ExitStat = %d\n e_from=",
e->e_errormode, e->e_id == NULL ? "NONE" : e->e_id,
ExitStat);
printaddr(&e->e_from, false);
printaddr(sm_debug_file(), &e->e_from, false);
}
if (e->e_id == NULL)
@ -178,7 +178,12 @@ savemail(e, sendbody)
** then write the error messages back to hir (sic).
*/
#if USE_TTYPATH
p = ttypath();
#else /* USE_TTYPATH */
p = NULL;
#endif /* USE_TTYPATH */
if (p == NULL || sm_io_reopen(SmFtStdio,
SM_TIME_DEFAULT,
p, SM_IO_WRONLY, NULL,
@ -518,11 +523,11 @@ returntosender(msg, returnq, flags, e)
{
sm_dprintf("\n*** Return To Sender: msg=\"%s\", depth=%d, e=%p, returnq=",
msg, returndepth, e);
printaddr(returnq, true);
printaddr(sm_debug_file(), returnq, true);
if (tTd(6, 20))
{
sm_dprintf("Sendq=");
printaddr(e->e_sendqueue, true);
printaddr(sm_debug_file(), e->e_sendqueue, true);
}
}

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
.\" Copyright (c) 1998-2003 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
.\" Copyright (c) 1988, 1991, 1993
@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: sendmail.8,v 8.51.2.3 2003/12/01 17:02:00 ca Exp $
.\" $Id: sendmail.8,v 8.57 2003/12/01 17:02:41 ca Exp $
.\"
.TH SENDMAIL 8 "$Date: 2003/12/01 17:02:00 $"
.TH SENDMAIL 8 "$Date: 2003/12/01 17:02:41 $"
.SH NAME
sendmail
\- an electronic mail transport agent
@ -153,6 +153,9 @@ Use alternate configuration file.
gives up any enhanced (set-user-ID or set-group-ID) privileges
if an alternate configuration file is specified.
.TP
.BI "\-D " logfile
Send debugging output to the indicated log file instead of stdout.
.TP
.BI \-d category . level...
Set the debugging flag for
.I category
@ -323,6 +326,13 @@ as a substring of the queue id or not when
.I !
is specified.
.TP
\fB\-q\fR[\fI!\fR]Q\fIsubstr\fR
Limit processed jobs to quarantined jobs containing
.I substr
as a substring of the quarantine reason or not when
.I !
is specified.
.TP
\fB\-q\fR[\fI!\fR]R\fIsubstr\fR
Limit processed jobs to those containing
.I substr
@ -337,6 +347,12 @@ as a substring of the sender or not when
.I !
is specified.
.TP
\fB\-Q\fR[reason]
Quarantine a normal queue items with the given reason or
unquarantine quarantined queue items if no reason is given.
This should only be used with some sort of item matching using
as described above.
.TP
.BI "\-R " return
Set the amount of the message to be returned
if the message bounces.

View File

@ -1,4 +1,4 @@
.\" Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
.\" Copyright (c) 1999-2002 Sendmail, Inc. and its suppliers.
.\" All rights reserved.
.\" Copyright (c) 1985, 1987, 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
.\" $Id: vacation.1,v 8.29.2.1 2002/06/21 21:28:06 ca Exp $
.\" $Id: vacation.1,v 8.34 2002/06/27 23:51:52 ca Exp $
.\"
.TH VACATION 1 "$Date: 2002/06/21 21:28:06 $"
.TH VACATION 1 "$Date: 2002/06/27 23:51:52 $"
.SH NAME
vacation
\- E-mail auto-responder
@ -26,9 +26,12 @@ vacation
.IR database ]
.RB [ \-i ]
.RB [ \-I ]
.RB [ \-j ]
.RB [ \-l ]
.RB [ \-m
.IR message ]
.RB [ \-R
.IR returnaddr ]
.RB [ \-r
.IR interval ]
.RB [ \-s
@ -118,6 +121,15 @@ This should only be used on the command line, not in your
.I .forward
file.
.TP
.B \-j
Respond to the message regardless of whether the login is listed as
a recipient for the message.
Do not use this flag unless you are sure of the consequences.
For example, this will cause
.i vacation
to reply to mailing list messages which may result in removing
you from the list.
.TP
.B \-l
List the content of the vacation database file including the address
and the associated time of the last auto-response to that address.
@ -134,6 +146,9 @@ Unless the
.I filename
starts with / it is relative to ~.
.TP
.BI \-R " returnaddr"
Set the reply envelope sender address
.TP
.BI \-r " interval"
Set the reply interval to
.I interval