summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/src
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r--contrib/sendmail/src/Makefile.m42
-rw-r--r--contrib/sendmail/src/conf.c41
-rw-r--r--contrib/sendmail/src/deliver.c7
-rw-r--r--contrib/sendmail/src/envelope.c23
-rw-r--r--contrib/sendmail/src/headers.c10
-rw-r--r--contrib/sendmail/src/macro.c70
-rw-r--r--contrib/sendmail/src/main.c30
-rw-r--r--contrib/sendmail/src/map.c317
-rw-r--r--contrib/sendmail/src/milter.c57
-rw-r--r--contrib/sendmail/src/mime.c14
-rw-r--r--contrib/sendmail/src/parseaddr.c4
-rw-r--r--contrib/sendmail/src/queue.c16
-rw-r--r--contrib/sendmail/src/readcf.c12
-rw-r--r--contrib/sendmail/src/recipient.c8
-rw-r--r--contrib/sendmail/src/sendmail.86
-rw-r--r--contrib/sendmail/src/sendmail.h35
-rw-r--r--contrib/sendmail/src/sm_resolve.c10
-rw-r--r--contrib/sendmail/src/srvrsmtp.c74
-rw-r--r--contrib/sendmail/src/usersmtp.c7
-rw-r--r--contrib/sendmail/src/util.c35
-rw-r--r--contrib/sendmail/src/version.c4
21 files changed, 503 insertions, 279 deletions
diff --git a/contrib/sendmail/src/Makefile.m4 b/contrib/sendmail/src/Makefile.m4
index 10c1122..b2bfa1a 100644
--- a/contrib/sendmail/src/Makefile.m4
+++ b/contrib/sendmail/src/Makefile.m4
@@ -1,4 +1,4 @@
-dnl $Id: Makefile.m4,v 8.107 2007/01/09 00:04:09 ca Exp $
+dnl $Id: Makefile.m4,v 8.112 2007/10/17 21:29:43 ca Exp $
include(confBUILDTOOLSDIR`/M4/switch.m4')
define(`confREQUIRE_LIBSM', `true')
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c
index a681575..0cbb88e 100644
--- a/contrib/sendmail/src/conf.c
+++ b/contrib/sendmail/src/conf.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: conf.c,v 8.1128 2007/04/03 21:32:29 ca Exp $")
+SM_RCSID("@(#)$Id: conf.c,v 8.1136 2007/10/10 00:06:45 ca Exp $")
#include <sm/sendmail.h>
#include <sendmail/pathnames.h>
@@ -5316,17 +5316,8 @@ sm_syslog(level, id, fmt, va_alist)
save_errno = errno;
if (id == NULL)
- {
id = "NOQUEUE";
- idlen = strlen(id) + SyslogPrefixLen;
- }
- else if (strcmp(id, NOQID) == 0)
- {
- id = "";
- idlen = SyslogPrefixLen;
- }
- else
- idlen = strlen(id) + SyslogPrefixLen;
+ idlen = strlen(id) + SyslogPrefixLen;
buf = buf0;
bufsize = sizeof(buf0);
@@ -6024,6 +6015,10 @@ char *OsCompileOptions[] =
char *FFRCompileOptions[] =
{
+#if _FFR_ADDR_TYPE_MODES
+ /* more info in {addr_type}, requires m4 changes! */
+ "_FFR_ADDR_TYPE_MODES",
+#endif /* _FFR_ADDR_TYPE_MODES */
#if _FFR_ALLOW_SASLINFO
/* DefaultAuthInfo can be specified by user. */
/* DefaultAuthInfo doesn't really work in 8.13 anymore. */
@@ -6094,6 +6089,10 @@ char *FFRCompileOptions[] =
"_FFR_DPO_CS",
#endif /* _FFR_DPO_CS */
+#if _FFR_DPRINTF_MAP
+ /* dprintf map for logging */
+ "_FFR_DPRINTF_MAP",
+#endif /* _FFR_DPRINTF_MAP */
#if _FFR_DROP_TRUSTUSER_WARNING
/*
** Don't issue this warning:
@@ -6222,6 +6221,10 @@ char *FFRCompileOptions[] =
/* Old mime7to8 code, the new is broken for at least one example. */
"_FFR_MIME7TO8_OLD",
#endif /* _FFR_MAX_SLEEP_TIME */
+#if _FFR_MORE_MACROS
+ /* allow more long macro names ("unprintable" characters). */
+ "_FFR_MORE_MACROS",
+#endif /* _FFR_MORE_MACROS */
#if _FFR_MSG_ACCEPT
/* allow to override "Message accepted for delivery" */
"_FFR_MSG_ACCEPT",
@@ -6235,6 +6238,10 @@ char *FFRCompileOptions[] =
/* Disable PIPELINING, delay client if used. */
"_FFR_NO_PIPE",
#endif /* _FFR_NO_PIPE */
+#if _FFR_LDAP_NETWORK_TIMEOUT
+ /* set LDAP_OPT_NETWORK_TIMEOUT if available (-c) */
+ "_FFR_LDAP_NETWORK_TIMEOUT",
+#endif /* _FFR_LDAP_NETWORK_TIMEOUT */
#if _FFR_LOG_NTRIES
/* log ntries=, from Nik Clayton of FreeBSD */
"_FFR_LOG_NTRIES",
@@ -6280,6 +6287,18 @@ char *FFRCompileOptions[] =
/* Random shuffle for queue sorting. */
"_FFR_RHS",
#endif /* _FFR_RHS */
+#if _FFR_RUNPQG
+ /*
+ ** allow -qGqueue_group -qp to work, i.e.,
+ ** restrict a persistent queue runner to a queue group.
+ */
+
+ "_FFR_RUNPQG",
+#endif /* _FFR_RUNPQG */
+#if _FFR_SESSID
+ /* session id (for logging) */
+ "_FFR_SESSID",
+#endif /* _FFR_SESSID */
#if _FFR_SHM_STATUS
/* Donated code (unused). */
"_FFR_SHM_STATUS",
diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c
index 01d5258..ed60e47 100644
--- a/contrib/sendmail/src/deliver.c
+++ b/contrib/sendmail/src/deliver.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sm/time.h>
-SM_RCSID("@(#)$Id: deliver.c,v 8.1012 2007/03/29 21:20:15 ca Exp $")
+SM_RCSID("@(#)$Id: deliver.c,v 8.1015 2007/10/17 21:35:30 ca Exp $")
#if HASSETUSERCONTEXT
# include <login_cap.h>
@@ -495,7 +495,7 @@ sendall(e, mode)
time_t now;
if (tTd(13, 29))
- sm_dprintf("No deliveries: auto-queuing\n");
+ sm_dprintf("No deliveries: auto-queueing\n");
mode = SM_QUEUE;
now = curtime();
@@ -3293,6 +3293,8 @@ do_transfer:
ok = (*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER);
if (ok)
ok = (*e->e_putbody)(mci, e, NULL);
+ if (ok && bitset(MCIF_INLONGLINE, mci->mci_flags))
+ ok = putline("", mci);
/*
** Ignore an I/O error that was caused by EPIPE.
@@ -3404,6 +3406,7 @@ do_transfer:
/* No recipients in list and no missing responses? */
if (tobuf[0] == '\0'
# if PIPELINING
+ && bitset(MCIF_PIPELINED, mci->mci_flags)
&& mci->mci_nextaddr == NULL
# endif /* PIPELINING */
)
diff --git a/contrib/sendmail/src/envelope.c b/contrib/sendmail/src/envelope.c
index a607a15..20b0ba2 100644
--- a/contrib/sendmail/src/envelope.c
+++ b/contrib/sendmail/src/envelope.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: envelope.c,v 8.302 2006/11/10 23:12:52 ca Exp $")
+SM_RCSID("@(#)$Id: envelope.c,v 8.304 2007/04/18 17:15:49 ca Exp $")
/*
** CLRSESSENVELOPE -- clear session oriented data in an envelope
@@ -75,7 +75,7 @@ newenvelope(e, parent, rpool)
register ENVELOPE *parent;
SM_RPOOL_T *rpool;
{
- int sendmode;
+ int sendmode, dm;
/*
** This code used to read:
@@ -86,8 +86,16 @@ newenvelope(e, parent, rpool)
** This meant macvalue() could go into an infinite loop.
*/
+ dm = DM_NOTSET;
if (parent != NULL)
+ {
+ char *str;
+
sendmode = parent->e_sendmode;
+ str = macvalue(macid("{deliveryMode}"), parent);
+ if (str != NULL)
+ dm = (int) str[0];
+ }
else
sendmode = DM_NOTSET;
@@ -105,9 +113,18 @@ newenvelope(e, parent, rpool)
e->e_parent = parent;
assign_queueid(e);
e->e_ctime = curtime();
+#if _FFR_SESSID
+ e->e_sessid = e->e_id;
+#endif /* _FFR_SESSID */
if (parent != NULL)
{
e->e_msgpriority = parent->e_msgsize;
+#if _FFR_SESSID
+ if (parent->e_sessid != NULL)
+ e->e_sessid = sm_rpool_strdup_x(rpool,
+ parent->e_sessid);
+#endif /* _FFR_SESSID */
+
if (parent->e_quarmsg == NULL)
{
e->e_quarmsg = NULL;
@@ -128,6 +145,8 @@ newenvelope(e, parent, rpool)
(void) sm_io_flush(CurEnv->e_xfp, SM_TIME_DEFAULT);
if (sendmode != DM_NOTSET)
e->e_sendmode = sendmode;
+ if (dm != DM_NOTSET)
+ set_delivery_mode(dm, e);
return e;
}
diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c
index bb78d22..8e70fed 100644
--- a/contrib/sendmail/src/headers.c
+++ b/contrib/sendmail/src/headers.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sm/sendmail.h>
-SM_RCSID("@(#)$Id: headers.c,v 8.310 2007/02/07 22:44:35 ca Exp $")
+SM_RCSID("@(#)$Id: headers.c,v 8.312 2007/06/19 18:52:11 ca Exp $")
static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *, bool));
static size_t fix_mime_header __P((HDR *, ENVELOPE *));
@@ -1865,7 +1865,8 @@ putheader(mci, hdr, e, flags)
if (bitset(H_FROM, h->h_flags))
oldstyle = false;
- commaize(h, p, oldstyle, mci, e);
+ commaize(h, p, oldstyle, mci, e,
+ PXLF_HEADER | PXLF_STRIPMQUOTE);
}
else
{
@@ -1977,6 +1978,7 @@ put_vanilla_header(h, v, mci)
** oldstyle -- true if this is an old style header.
** mci -- the connection information.
** e -- the envelope containing the message.
+** putflags -- flags for putxline()
**
** Returns:
** true iff header field was written successfully
@@ -1986,17 +1988,17 @@ put_vanilla_header(h, v, mci)
*/
bool
-commaize(h, p, oldstyle, mci, e)
+commaize(h, p, oldstyle, mci, e, putflags)
register HDR *h;
register char *p;
bool oldstyle;
register MCI *mci;
register ENVELOPE *e;
+ int putflags;
{
register char *obp;
int opos, omax, spaces;
bool firstone = true;
- int putflags = PXLF_HEADER | PXLF_STRIPMQUOTE;
char **res;
char obuf[MAXLINE + 3];
diff --git a/contrib/sendmail/src/macro.c b/contrib/sendmail/src/macro.c
index 8f0642f..cdde4d2 100644
--- a/contrib/sendmail/src/macro.c
+++ b/contrib/sendmail/src/macro.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2001, 2003, 2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2001, 2003, 2006, 2007 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: macro.c,v 8.102 2006/12/21 23:06:10 ca Exp $")
+SM_RCSID("@(#)$Id: macro.c,v 8.107 2007/08/06 22:29:02 ca Exp $")
#include <sm/sendmail.h>
#if MAXMACROID != (BITMAPBITS - 1)
@@ -21,8 +21,67 @@ SM_RCSID("@(#)$Id: macro.c,v 8.102 2006/12/21 23:06:10 ca Exp $")
#endif /* MAXMACROID != (BITMAPBITS - 1) */
static char *MacroName[MAXMACROID + 1]; /* macro id to name table */
-int NextMacroId = 0240; /* codes for long named macros */
+
+/*
+** Codes for long named macros.
+** See also macname():
+ * if not ASCII printable, look up the name *
+ if (n <= 0x20 || n > 0x7f)
+** First use 1 to NEXTMACROID_L, then use NEXTMACROID_H to MAXMACROID.
+*/
+
+#define NEXTMACROID_L 037
+#define NEXTMACROID_H 0240
+
+#if _FFR_MORE_MACROS
+/* table for next id in non-printable ASCII range: disallow some value */
+static int NextMIdTable[] =
+{
+ /* 0 nul */ 1,
+ /* 1 soh */ 2,
+ /* 2 stx */ 3,
+ /* 3 etx */ 4,
+ /* 4 eot */ 5,
+ /* 5 enq */ 6,
+ /* 6 ack */ 7,
+ /* 7 bel */ 8,
+ /* 8 bs */ 14,
+ /* 9 ht */ -1,
+ /* 10 nl */ -1,
+ /* 11 vt */ -1,
+ /* 12 np */ -1,
+ /* 13 cr */ -1,
+ /* 14 so */ 15,
+ /* 15 si */ 16,
+ /* 16 dle */ 17,
+ /* 17 dc1 */ 18,
+ /* 18 dc2 */ 19,
+ /* 19 dc3 */ 20,
+ /* 20 dc4 */ 21,
+ /* 21 nak */ 22,
+ /* 22 syn */ 23,
+ /* 23 etb */ 24,
+ /* 24 can */ 25,
+ /* 25 em */ 26,
+ /* 26 sub */ 27,
+ /* 27 esc */ 28,
+ /* 28 fs */ 29,
+ /* 29 gs */ 30,
+ /* 30 rs */ 31,
+ /* 31 us */ 32,
+ /* 32 sp */ -1,
+};
+
+#define NEXTMACROID(mid) ( \
+ (mid < NEXTMACROID_L) ? (NextMIdTable[mid]) : \
+ ((mid < NEXTMACROID_H) ? NEXTMACROID_H : (mid + 1)))
+
+int NextMacroId = 1; /* codes for long named macros */
/* see sendmail.h: Special characters in rewriting rules. */
+#else /* _FFR_MORE_MACROS */
+int NextMacroId = 0240; /* codes for long named macros */
+#define NEXTMACROID(mid) ((mid) + 1)
+#endif /* _FFR_MORE_MACROS */
/*
@@ -603,7 +662,7 @@ macid_parse(p, ep)
syserr("Macro/class name ({%s}) too long (%d chars max)",
mbuf, (int) (sizeof(mbuf) - 1));
}
- else if (mbuf[1] == '\0')
+ else if (mbuf[1] == '\0' && mbuf[0] >= 0x20)
{
/* ${x} == $x */
mid = bitidx(mbuf[0]);
@@ -627,7 +686,8 @@ macid_parse(p, ep)
else
{
MacroName[NextMacroId] = s->s_name;
- s->s_macro = mid = NextMacroId++;
+ s->s_macro = mid = NextMacroId;
+ NextMacroId = NEXTMACROID(NextMacroId);
}
}
p++;
diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c
index c11de46..8680add 100644
--- a/contrib/sendmail/src/main.c
+++ b/contrib/sendmail/src/main.c
@@ -26,7 +26,7 @@ SM_UNUSED(static char copyright[]) =
The Regents of the University of California. All rights reserved.\n";
#endif /* ! lint */
-SM_RCSID("@(#)$Id: main.c,v 8.962 2006/12/19 19:47:37 ca Exp $")
+SM_RCSID("@(#)$Id: main.c,v 8.963 2007/06/29 20:07:37 ca Exp $")
#if NETINET || NETINET6
@@ -2362,7 +2362,33 @@ main(argc, argv, envp)
if (QueueIntvl > 0)
{
- (void) runqueue(true, false, queuepersistent, true);
+#if _FFR_RUNPQG
+ if (qgrp != NOQGRP)
+ {
+ int rwgflags = RWG_NONE;
+
+ /*
+ ** To run a specific queue group mark it to
+ ** be run, select the work group it's in and
+ ** increment the work counter.
+ */
+
+ for (i = 0; i < NumQueue && Queue[i] != NULL;
+ i++)
+ Queue[i]->qg_nextrun = (time_t) -1;
+ Queue[qgrp]->qg_nextrun = 0;
+ if (Verbose)
+ rwgflags |= RWG_VERBOSE;
+ if (queuepersistent)
+ rwgflags |= RWG_PERSISTENT;
+ rwgflags |= RWG_FORCE;
+ (void) run_work_group(Queue[qgrp]->qg_wgrp,
+ rwgflags);
+ }
+ else
+#endif /* _FFR_RUNPQG */
+ (void) runqueue(true, false, queuepersistent,
+ true);
/*
** If queuepersistent but not in daemon mode then
diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c
index 510b7c9..4248fd9 100644
--- a/contrib/sendmail/src/map.c
+++ b/contrib/sendmail/src/map.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1992, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1992, 1993
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: map.c,v 8.696 2007/04/03 21:33:14 ca Exp $")
+SM_RCSID("@(#)$Id: map.c,v 8.699 2007/10/10 00:06:45 ca Exp $")
#if LDAPMAP
# include <sm/ldap.h>
@@ -3567,10 +3567,17 @@ ldapmap_lookup(map, name, av, statp)
if (VendorCode == VENDOR_SUN &&
strcmp(map->map_mname, "aliases.ldap") == 0)
{
- char answer[MAXNAME + 1];
int rc;
+#if defined(GETLDAPALIASBYNAME_VERSION) && (GETLDAPALIASBYNAME_VERSION >= 2)
+ extern char *__getldapaliasbyname();
+ char *answer;
+
+ answer = __getldapaliasbyname(name, &rc);
+#else
+ char answer[MAXNAME + 1];
rc = __getldapaliasbyname(name, answer, sizeof(answer));
+#endif
if (rc != 0)
{
if (tTd(38, 20))
@@ -3587,6 +3594,9 @@ ldapmap_lookup(map, name, av, statp)
result = map_rewrite(map, name, strlen(name), NULL);
else
result = map_rewrite(map, answer, strlen(answer), av);
+#if defined(GETLDAPALIASBYNAME_VERSION) && (GETLDAPALIASBYNAME_VERSION >= 2)
+ free(answer);
+#endif
return result;
}
#endif /* defined(SUN_EXTENSIONS) && defined(SUN_SIMPLIFIED_LDAP) && ... */
@@ -3965,17 +3975,16 @@ ldapmap_parseargs(map, args)
break;
switch (*++p)
{
- case 'N':
- map->map_mflags |= MF_INCLNULL;
- map->map_mflags &= ~MF_TRY0NULL;
+ case 'A':
+ map->map_mflags |= MF_APPEND;
break;
- case 'O':
- map->map_mflags &= ~MF_TRY1NULL;
+ case 'a':
+ map->map_app = ++p;
break;
- case 'o':
- map->map_mflags |= MF_OPTIONAL;
+ case 'D':
+ map->map_mflags |= MF_DEFER;
break;
case 'f':
@@ -3986,16 +3995,25 @@ ldapmap_parseargs(map, args)
map->map_mflags |= MF_MATCHONLY;
break;
- case 'A':
- map->map_mflags |= MF_APPEND;
+ case 'N':
+ map->map_mflags |= MF_INCLNULL;
+ map->map_mflags &= ~MF_TRY0NULL;
+ break;
+
+ case 'O':
+ map->map_mflags &= ~MF_TRY1NULL;
+ break;
+
+ case 'o':
+ map->map_mflags |= MF_OPTIONAL;
break;
case 'q':
map->map_mflags |= MF_KEEPQUOTES;
break;
- case 'a':
- map->map_app = ++p;
+ case 'S':
+ map->map_spacesub = *++p;
break;
case 'T':
@@ -4006,14 +4024,6 @@ ldapmap_parseargs(map, args)
map->map_mflags |= MF_NODEFER;
break;
- case 'S':
- map->map_spacesub = *++p;
- break;
-
- case 'D':
- map->map_mflags |= MF_DEFER;
- break;
-
case 'z':
if (*++p != '\\')
map->map_coldelim = *p;
@@ -4036,25 +4046,68 @@ ldapmap_parseargs(map, args)
break;
/* Start of ldapmap specific args */
- case 'V':
- if (*++p != '\\')
- lmap->ldap_attrsep = *p;
- else
- {
- switch (*++p)
- {
- case 'n':
- lmap->ldap_attrsep = '\n';
- break;
+ case '1':
+ map->map_mflags |= MF_SINGLEMATCH;
+ break;
- case 't':
- lmap->ldap_attrsep = '\t';
- break;
+# if _FFR_LDAP_SINGLEDN
+ case '2':
+ map->map_mflags |= MF_SINGLEDN;
+ break;
+# endif /* _FFR_LDAP_SINGLEDN */
- default:
- lmap->ldap_attrsep = '\\';
- }
+ case 'b': /* search base */
+ while (isascii(*++p) && isspace(*p))
+ continue;
+ lmap->ldap_base = p;
+ break;
+
+# if _FFR_LDAP_NETWORK_TIMEOUT
+ case 'c': /* network (connect) timeout */
+ while (isascii(*++p) && isspace(*p))
+ continue;
+ lmap->ldap_networktmo.tv_sec = atoi(p);
+ break;
+# endif /* _FFR_LDAP_NETWORK_TIMEOUT */
+
+ case 'd': /* Dn to bind to server as */
+ while (isascii(*++p) && isspace(*p))
+ continue;
+ lmap->ldap_binddn = p;
+ break;
+
+ case 'H': /* Use LDAP URI */
+# if !USE_LDAP_INIT
+ syserr("Must compile with -DUSE_LDAP_INIT to use LDAP URIs (-H) in map %s",
+ map->map_mname);
+ return false;
+# else /* !USE_LDAP_INIT */
+ if (lmap->ldap_host != NULL)
+ {
+ syserr("Can not specify both an LDAP host and an LDAP URI in map %s",
+ map->map_mname);
+ return false;
}
+ while (isascii(*++p) && isspace(*p))
+ continue;
+ lmap->ldap_uri = p;
+ break;
+# endif /* !USE_LDAP_INIT */
+
+ case 'h': /* ldap host */
+ while (isascii(*++p) && isspace(*p))
+ continue;
+ if (lmap->ldap_uri != NULL)
+ {
+ syserr("Can not specify both an LDAP host and an LDAP URI in map %s",
+ map->map_mname);
+ return false;
+ }
+ lmap->ldap_host = p;
+ break;
+
+ case 'K':
+ lmap->ldap_multi_args = true;
break;
case 'k': /* search field */
@@ -4063,22 +4116,69 @@ ldapmap_parseargs(map, args)
lmap->ldap_filter = p;
break;
- case 'v': /* attr to return */
+ case 'l': /* time limit */
while (isascii(*++p) && isspace(*p))
continue;
- lmap->ldap_attr[0] = p;
- lmap->ldap_attr[1] = NULL;
+ lmap->ldap_timelimit = atoi(p);
+ lmap->ldap_timeout.tv_sec = lmap->ldap_timelimit;
break;
- case '1':
- map->map_mflags |= MF_SINGLEMATCH;
+ case 'M': /* Method for binding */
+ while (isascii(*++p) && isspace(*p))
+ continue;
+
+ if (sm_strncasecmp(p, "LDAP_AUTH_", 10) == 0)
+ p += 10;
+
+ for (lam = LDAPAuthMethods;
+ lam != NULL && lam->lam_name != NULL; lam++)
+ {
+ if (sm_strncasecmp(p, lam->lam_name,
+ strlen(lam->lam_name)) == 0)
+ break;
+ }
+ if (lam->lam_name != NULL)
+ lmap->ldap_method = lam->lam_code;
+ else
+ {
+ /* bad config line */
+ if (!bitset(MCF_OPTFILE,
+ map->map_class->map_cflags))
+ {
+ char *ptr;
+
+ if ((ptr = strchr(p, ' ')) != NULL)
+ *ptr = '\0';
+ syserr("Method for binding must be [none|simple|krbv4] (not %s) in map %s",
+ p, map->map_mname);
+ if (ptr != NULL)
+ *ptr = ' ';
+ return false;
+ }
+ }
break;
-# if _FFR_LDAP_SINGLEDN
- case '2':
- map->map_mflags |= MF_SINGLEDN;
+ case 'n': /* retrieve attribute names only */
+ lmap->ldap_attrsonly = LDAPMAP_TRUE;
+ break;
+
+ /*
+ ** This is a string that is dependent on the
+ ** method used defined by 'M'.
+ */
+
+ case 'P': /* Secret password for binding */
+ while (isascii(*++p) && isspace(*p))
+ continue;
+ lmap->ldap_secret = p;
+ secretread = false;
+ break;
+
+ case 'p': /* ldap port */
+ while (isascii(*++p) && isspace(*p))
+ continue;
+ lmap->ldap_port = atoi(p);
break;
-# endif /* _FFR_LDAP_SINGLEDN */
/* args stolen from ldapsearch.c */
case 'R': /* don't auto chase referrals */
@@ -4089,10 +4189,6 @@ ldapmap_parseargs(map, args)
# endif /* LDAP_REFERRALS */
break;
- case 'n': /* retrieve attribute names only */
- lmap->ldap_attrsonly = LDAPMAP_TRUE;
- break;
-
case 'r': /* alias dereferencing */
while (isascii(*++p) && isspace(*p))
continue;
@@ -4163,114 +4259,33 @@ ldapmap_parseargs(map, args)
}
break;
- case 'h': /* ldap host */
- while (isascii(*++p) && isspace(*p))
- continue;
- if (lmap->ldap_uri != NULL)
- {
- syserr("Can not specify both an LDAP host and an LDAP URI in map %s",
- map->map_mname);
- return false;
- }
- lmap->ldap_host = p;
- break;
-
- case 'b': /* search base */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->ldap_base = p;
- break;
-
- case 'p': /* ldap port */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->ldap_port = atoi(p);
- break;
-
- case 'l': /* time limit */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->ldap_timelimit = atoi(p);
- lmap->ldap_timeout.tv_sec = lmap->ldap_timelimit;
- break;
-
- case 'Z':
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->ldap_sizelimit = atoi(p);
- break;
-
- case 'd': /* Dn to bind to server as */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->ldap_binddn = p;
- break;
-
- case 'M': /* Method for binding */
- while (isascii(*++p) && isspace(*p))
- continue;
-
- if (sm_strncasecmp(p, "LDAP_AUTH_", 10) == 0)
- p += 10;
-
- for (lam = LDAPAuthMethods;
- lam != NULL && lam->lam_name != NULL; lam++)
- {
- if (sm_strncasecmp(p, lam->lam_name,
- strlen(lam->lam_name)) == 0)
- break;
- }
- if (lam->lam_name != NULL)
- lmap->ldap_method = lam->lam_code;
+ case 'V':
+ if (*++p != '\\')
+ lmap->ldap_attrsep = *p;
else
{
- /* bad config line */
- if (!bitset(MCF_OPTFILE,
- map->map_class->map_cflags))
+ switch (*++p)
{
- char *ptr;
+ case 'n':
+ lmap->ldap_attrsep = '\n';
+ break;
- if ((ptr = strchr(p, ' ')) != NULL)
- *ptr = '\0';
- syserr("Method for binding must be [none|simple|krbv4] (not %s) in map %s",
- p, map->map_mname);
- if (ptr != NULL)
- *ptr = ' ';
- return false;
+ case 't':
+ lmap->ldap_attrsep = '\t';
+ break;
+
+ default:
+ lmap->ldap_attrsep = '\\';
}
}
-
break;
- /*
- ** This is a string that is dependent on the
- ** method used defined above.
- */
-
- case 'P': /* Secret password for binding */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->ldap_secret = p;
- secretread = false;
- break;
-
- case 'H': /* Use LDAP URI */
-# if !USE_LDAP_INIT
- syserr("Must compile with -DUSE_LDAP_INIT to use LDAP URIs (-H) in map %s",
- map->map_mname);
- return false;
-# else /* !USE_LDAP_INIT */
- if (lmap->ldap_host != NULL)
- {
- syserr("Can not specify both an LDAP host and an LDAP URI in map %s",
- map->map_mname);
- return false;
- }
+ case 'v': /* attr to return */
while (isascii(*++p) && isspace(*p))
continue;
- lmap->ldap_uri = p;
+ lmap->ldap_attr[0] = p;
+ lmap->ldap_attr[1] = NULL;
break;
-# endif /* !USE_LDAP_INIT */
case 'w':
/* -w should be for passwd, -P should be for version */
@@ -4297,8 +4312,10 @@ ldapmap_parseargs(map, args)
# endif /* LDAP_VERSION_MIN */
break;
- case 'K':
- lmap->ldap_multi_args = true;
+ case 'Z':
+ while (isascii(*++p) && isspace(*p))
+ continue;
+ lmap->ldap_sizelimit = atoi(p);
break;
default:
diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c
index 67d5eae..816c7bf 100644
--- a/contrib/sendmail/src/milter.c
+++ b/contrib/sendmail/src/milter.c
@@ -10,7 +10,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: milter.c,v 8.267 2007/02/27 22:21:12 ca Exp $")
+SM_RCSID("@(#)$Id: milter.c,v 8.269 2007/06/06 17:26:12 ca Exp $")
#if MILTER
# include <sm/sendmail.h>
@@ -51,7 +51,8 @@ static void milter_quit_filter __P((struct milter *, ENVELOPE *));
static void milter_abort_filter __P((struct milter *, ENVELOPE *));
static void milter_send_macros __P((struct milter *, char **, int,
ENVELOPE *));
-static int milter_negotiate __P((struct milter *, ENVELOPE *));
+static int milter_negotiate __P((struct milter *, ENVELOPE *,
+ milters_T *));
static void milter_per_connection_check __P((ENVELOPE *));
static char *milter_headers __P((struct milter *, ENVELOPE *, char *));
static void milter_addheader __P((struct milter *, char *, ssize_t,
@@ -1791,41 +1792,6 @@ milter_reset_df(e)
}
/*
-** MILTER_CAN_DELRCPTS -- can any milter filters delete recipients?
-**
-** Parameters:
-** none
-**
-** Returns:
-** true if any filter deletes recipients, false otherwise
-*/
-
-bool
-milter_can_delrcpts()
-{
- bool can = false;
- int i;
-
- if (tTd(64, 10))
- sm_dprintf("milter_can_delrcpts:");
-
- for (i = 0; InputFilters[i] != NULL; i++)
- {
- struct milter *m = InputFilters[i];
-
- if (bitset(SMFIF_DELRCPT, m->mf_fflags))
- {
- can = true;
- break;
- }
- }
- if (tTd(64, 10))
- sm_dprintf("%s\n", can ? "true" : "false");
-
- return can;
-}
-
-/*
** MILTER_QUIT_FILTER -- close down a single filter
**
** Parameters:
@@ -2406,15 +2372,17 @@ milter_getsymlist(m, buf, rlen, offset)
** Parameters:
** m -- milter filter structure.
** e -- current envelope.
+** milters -- milters structure.
**
** Returns:
** 0 on success, -1 otherwise
*/
static int
-milter_negotiate(m, e)
+milter_negotiate(m, e, milters)
struct milter *m;
ENVELOPE *e;
+ milters_T *milters;
{
char rcmd;
mi_int32 fvers, fflags, pflags;
@@ -2583,6 +2551,12 @@ milter_negotiate(m, e)
milter_getsymlist(m, response, rlen, MILTER_OPTLEN);
}
+ if (bitset(SMFIF_DELRCPT, m->mf_fflags))
+ milters->mis_flags |= MIS_FL_DEL_RCPT;
+ if (!bitset(SMFIP_NORCPT, m->mf_pflags) &&
+ !bitset(SMFIP_NR_RCPT, m->mf_pflags))
+ milters->mis_flags |= MIS_FL_REJ_RCPT;
+
if (tTd(64, 5))
sm_dprintf("milter_negotiate(%s): received: version %u, fflags 0x%x, pflags 0x%x\n",
m->mf_name, m->mf_fvers, m->mf_fflags, m->mf_pflags);
@@ -3784,6 +3758,7 @@ milter_replbody(response, rlen, newfilter, e)
** Parameters:
** e -- current envelope.
** state -- return state from response.
+** milters -- milters structure.
**
** Returns:
** true iff at least one filter is active
@@ -3791,15 +3766,17 @@ milter_replbody(response, rlen, newfilter, e)
/* ARGSUSED */
bool
-milter_init(e, state)
+milter_init(e, state, milters)
ENVELOPE *e;
char *state;
+ milters_T *milters;
{
int i;
if (tTd(64, 10))
sm_dprintf("milter_init\n");
+ memset(milters, '\0', sizeof(*milters));
*state = SMFIR_CONTINUE;
if (InputFilters[0] == NULL)
{
@@ -3821,7 +3798,7 @@ milter_init(e, state)
}
if (m->mf_sock < 0 ||
- milter_negotiate(m, e) < 0 ||
+ milter_negotiate(m, e, milters) < 0 ||
m->mf_state == SMFS_ERROR)
{
if (tTd(64, 5))
diff --git a/contrib/sendmail/src/mime.c b/contrib/sendmail/src/mime.c
index 48540a0..af71d79 100644
--- a/contrib/sendmail/src/mime.c
+++ b/contrib/sendmail/src/mime.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <string.h>
-SM_RCSID("@(#)$Id: mime.c,v 8.146 2006/08/16 16:52:11 ca Exp $")
+SM_RCSID("@(#)$Id: mime.c,v 8.147 2007/09/26 23:29:11 ca Exp $")
/*
** MIME support.
@@ -525,10 +525,14 @@ mime8to7(mci, header, e, boundaries, flags, level)
while (sm_io_fgets(e->e_dfp, SM_TIME_DEFAULT, buf, sizeof(buf))
!= NULL)
{
- bt = mimeboundary(buf, boundaries);
- if (bt != MBT_NOTSEP)
- break;
- if (!putline(buf, mci))
+ if (!bitset(MCIF_INLONGLINE, mci->mci_flags))
+ {
+ bt = mimeboundary(buf, boundaries);
+ if (bt != MBT_NOTSEP)
+ break;
+ }
+ if (!putxline(buf, strlen(buf), mci,
+ PXLF_MAPFROM|PXLF_NOADDEOL))
goto writeerr;
}
if (sm_io_eof(e->e_dfp))
diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c
index 9a14ec9..eca60f9 100644
--- a/contrib/sendmail/src/parseaddr.c
+++ b/contrib/sendmail/src/parseaddr.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: parseaddr.c,v 8.400 2006/12/21 00:24:06 ca Exp $")
+SM_RCSID("@(#)$Id: parseaddr.c,v 8.401 2007/09/27 23:33:59 ca Exp $")
#include <sm/sendmail.h>
#include "map.h"
@@ -217,7 +217,7 @@ parseaddr(addr, a, flags, delim, delimptr, e, isrcpt)
if (e->e_sendmode == SM_DEFER)
msg = "Deferring message until queue run";
if (tTd(20, 1))
- sm_dprintf("parseaddr: queuing message\n");
+ sm_dprintf("parseaddr: queueing message\n");
message(msg);
if (e->e_message == NULL && e->e_sendmode != SM_DEFER)
e->e_message = sm_rpool_strdup_x(e->e_rpool, msg);
diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c
index e0919d5..e80a035 100644
--- a/contrib/sendmail/src/queue.c
+++ b/contrib/sendmail/src/queue.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sm/sem.h>
-SM_RCSID("@(#)$Id: queue.c,v 8.972 2007/03/29 22:55:17 ca Exp $")
+SM_RCSID("@(#)$Id: queue.c,v 8.975 2007/06/18 20:08:40 ca Exp $")
#include <dirent.h>
@@ -427,7 +427,7 @@ queueup(e, announce, msync)
break;
if (LogLevel > 0 && (i % 32) == 0)
sm_syslog(LOG_ALERT, e->e_id,
- "queueup: cannot create %s, uid=%d: %s",
+ "queueup: cannot create %s, euid=%d: %s",
tf, (int) geteuid(),
sm_errstring(errno));
}
@@ -845,8 +845,8 @@ queueup(e, announce, msync)
if (bitset(H_FROM, h->h_flags))
oldstyle = false;
-
- commaize(h, h->h_value, oldstyle, &mcibuf, e);
+ commaize(h, h->h_value, oldstyle, &mcibuf, e,
+ PXLF_HEADER);
TrafficLogFile = savetrace;
}
@@ -2147,6 +2147,14 @@ run_work_group(wgrp, flags)
maxrunners = Queue[qgrp]->qg_maxqrun;
+ /*
+ ** If no runners are configured for this group but
+ ** the queue is "forced" then lets use 1 runner.
+ */
+
+ if (maxrunners == 0 && bitset(RWG_FORCE, flags))
+ maxrunners = 1;
+
/* No need to have more runners then there are jobs */
if (maxrunners > njobs)
maxrunners = njobs;
diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c
index bd57d80..0d0849b 100644
--- a/contrib/sendmail/src/readcf.c
+++ b/contrib/sendmail/src/readcf.c
@@ -14,7 +14,7 @@
#include <sendmail.h>
#include <sm/sendmail.h>
-SM_RCSID("@(#)$Id: readcf.c,v 8.663 2006/10/05 20:58:59 ca Exp $")
+SM_RCSID("@(#)$Id: readcf.c,v 8.664 2007/07/10 17:01:22 ca Exp $")
#if NETINET || NETINET6
# include <arpa/inet.h>
@@ -2245,6 +2245,10 @@ static struct optioninfo
# define O_EIGHT_BIT_ADDR_OK 0xdf
{ "EightBitAddrOK", O_EIGHT_BIT_ADDR_OK, OI_NONE },
#endif /* _FFR_EIGHT_BIT_ADDR_OK */
+#if _FFR_ADDR_TYPE_MODES
+# define O_ADDR_TYPE_MODES 0xe0
+ { "AddrTypeModes", O_ADDR_TYPE_MODES, OI_NONE },
+#endif /* _FFR_ADDR_TYPE_MODES */
{ NULL, '\0', OI_NONE }
};
@@ -3807,6 +3811,12 @@ setoption(opt, val, safe, sticky, e)
break;
#endif /* _FFR_EIGHT_BIT_ADDR_OK */
+#if _FFR_ADDR_TYPE_MODES
+ case O_ADDR_TYPE_MODES:
+ AddrTypeModes = atobool(val);
+ break;
+#endif /* _FFR_ADDR_TYPE_MODES */
+
default:
if (tTd(37, 1))
{
diff --git a/contrib/sendmail/src/recipient.c b/contrib/sendmail/src/recipient.c
index ea30adc..4064632 100644
--- a/contrib/sendmail/src/recipient.c
+++ b/contrib/sendmail/src/recipient.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: recipient.c,v 8.348 2007/03/19 21:33:09 ca Exp $")
+SM_RCSID("@(#)$Id: recipient.c,v 8.349 2007/07/10 17:01:22 ca Exp $")
static void includetimeout __P((int));
static ADDRESS *self_reference __P((ADDRESS *));
@@ -377,6 +377,12 @@ removefromlist(list, sendq, e)
{
(void) sm_strlcpy(bufp, denlstring(list, false, true), i);
+#if _FFR_ADDR_TYPE_MODES
+ if (AddrTypeModes)
+ macdefine(&e->e_macro, A_PERM, macid("{addr_type}"),
+ "e r d");
+ else
+#endif /* _FFR_ADDR_TYPE_MODES */
macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), "e r");
for (p = bufp; *p != '\0'; )
{
diff --git a/contrib/sendmail/src/sendmail.8 b/contrib/sendmail/src/sendmail.8
index 2d0284a..27b44d6 100644
--- a/contrib/sendmail/src/sendmail.8
+++ b/contrib/sendmail/src/sendmail.8
@@ -9,9 +9,9 @@
.\" the sendmail distribution.
.\"
.\"
-.\" $Id: sendmail.8,v 8.57 2003/12/01 17:02:41 ca Exp $
+.\" $Id: sendmail.8,v 8.58 2007/08/02 05:42:33 ca Exp $
.\"
-.TH SENDMAIL 8 "$Date: 2003/12/01 17:02:41 $"
+.TH SENDMAIL 8 "$Date: 2007/08/02 05:42:33 $"
.SH NAME
sendmail
\- an electronic mail transport agent
@@ -314,7 +314,7 @@ empty in the previous queue run.
Process saved messages in the queue once and do not fork(),
but run in the foreground.
.TP
-\fB\-q\fRG name
+\fB\-q\fRG\fIname\fR
Process jobs in queue group called
.I name
only.
diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h
index 51f2426..82ab6a9 100644
--- a/contrib/sendmail/src/sendmail.h
+++ b/contrib/sendmail/src/sendmail.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -52,7 +52,7 @@
#ifdef _DEFINE
# ifndef lint
-SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1042 2007/02/27 22:21:13 ca Exp $";
+SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.1052 2007/10/05 23:06:30 ca Exp $";
# endif /* ! lint */
#endif /* _DEFINE */
@@ -324,7 +324,8 @@ typedef struct address ADDRESS;
(s) == QS_RETRY)
#define QS_IS_ATTEMPTED(s) ((s) == QS_QUEUEUP || \
(s) == QS_RETRY || \
- (s) == QS_SENT)
+ (s) == QS_SENT || \
+ (s) == QS_DISCARDED)
#define QS_IS_DEAD(s) ((s) >= QS_DONTSEND)
@@ -728,6 +729,7 @@ MCI
#if _FFR_IGNORE_EXT_ON_HELO
# define MCIF_HELO 0x00800000 /* we used HELO: ignore extensions */
#endif /* _FFR_IGNORE_EXT_ON_HELO */
+#define MCIF_INLONGLINE 0x01000000 /* in the middle of a long line */
#define MCIF_ONLY_EHLO 0x10000000 /* use only EHLO in smtpinit */
/* states */
@@ -824,7 +826,7 @@ extern struct hdrinfo HdrInfo[];
/* functions */
extern void addheader __P((char *, char *, int, ENVELOPE *, bool));
extern unsigned long chompheader __P((char *, int, HDR **, ENVELOPE *));
-extern bool commaize __P((HDR *, char *, bool, MCI *, ENVELOPE *));
+extern bool commaize __P((HDR *, char *, bool, MCI *, ENVELOPE *, int));
extern HDR *copyheader __P((HDR *, SM_RPOOL_T *));
extern void eatheader __P((ENVELOPE *, bool, bool));
extern char *hvalue __P((char *, HDR *));
@@ -894,6 +896,9 @@ struct envelope
char *e_bodytype; /* type of message body */
SM_FILE_T *e_dfp; /* data file */
char *e_id; /* code for this entry in queue */
+#if _FFR_SESSID
+ char *e_sessid; /* session ID for this envelope */
+#endif /* _FFR_SESSID */
int e_qgrp; /* queue group (index into queues) */
int e_qdir; /* index into queue directories */
int e_dfqgrp; /* data file queue group index */
@@ -1725,6 +1730,17 @@ struct milter
#endif /* _FFR_MILTER_CHECK */
};
+struct milters
+{
+ mi_int32 mis_flags; /* filter flags */
+};
+typedef struct milters milters_T;
+
+#define MIS_FL_NONE 0x00000000 /* no requirements... */
+#define MIS_FL_DEL_RCPT 0x00000001 /* can delete rcpt */
+#define MIS_FL_REJ_RCPT 0x00000002 /* can reject rcpt */
+
+
/* MTA flags */
# define SMF_REJECT 'R' /* Reject connection on filter fail */
# define SMF_TEMPFAIL 'T' /* tempfail connection on failure */
@@ -2082,10 +2098,7 @@ extern unsigned char tTdvect[100]; /* trace vector */
** The "no queue id" queue id for sm_syslog
*/
-#define NOQID "*~*"
-
-/* use id or NOQID (to avoid NOQUEUE in logfile) */
-#define E_ID(id) ((id) == NULL ? NOQID : (id))
+#define NOQID ""
#define CURHOSTNAME (CurHostName == NULL ? "local" : CurHostName)
@@ -2161,6 +2174,9 @@ extern unsigned char tTdvect[100]; /* trace vector */
** Global variables.
*/
+#if _FFR_ADDR_TYPE_MODES
+EXTERN bool AddrTypeModes; /* addr_type: extra "mode" information */
+#endif /* _FFR_ADDR_TYPE_MODES */
EXTERN bool AllowBogusHELO; /* allow syntax errors on HELO command */
EXTERN bool CheckAliases; /* parse addresses during newaliases */
#if _FFR_QUEUE_RUN_PARANOIA
@@ -2435,8 +2451,7 @@ extern int opencontrolsocket __P((void));
extern void milter_config __P((char *, struct milter **, int));
extern void milter_setup __P((char *));
extern void milter_set_option __P((char *, char *, bool));
-extern bool milter_can_delrcpts __P((void));
-extern bool milter_init __P((ENVELOPE *, char *));
+extern bool milter_init __P((ENVELOPE *, char *, milters_T *));
extern void milter_quit __P((ENVELOPE *));
extern void milter_abort __P((ENVELOPE *));
extern char *milter_connect __P((char *, SOCKADDR, ENVELOPE *, char *));
diff --git a/contrib/sendmail/src/sm_resolve.c b/contrib/sendmail/src/sm_resolve.c
index d2cf96d..035a9e5 100644
--- a/contrib/sendmail/src/sm_resolve.c
+++ b/contrib/sendmail/src/sm_resolve.c
@@ -46,7 +46,7 @@
# if NAMED_BIND
# include "sm_resolve.h"
-SM_RCSID("$Id: sm_resolve.c,v 8.34 2006/08/15 23:24:58 ca Exp $")
+SM_RCSID("$Id: sm_resolve.c,v 8.35 2007/06/25 16:20:14 ca Exp $")
static struct stot
{
@@ -168,6 +168,7 @@ parse_dns_reply(data, len)
int len;
{
unsigned char *p;
+ ushort ans_cnt, ui;
int status;
size_t l;
char host[MAXHOSTNAMELEN];
@@ -196,11 +197,15 @@ parse_dns_reply(data, len)
dns_free_data(r);
return NULL;
}
+
+ ans_cnt = ntohs((ushort) r->dns_r_h.ancount);
+
p += status;
GETSHORT(r->dns_r_q.dns_q_type, p);
GETSHORT(r->dns_r_q.dns_q_class, p);
rr = &r->dns_r_head;
- while (p < data + len)
+ ui = 0;
+ while (p < data + len && ui < ans_cnt)
{
int type, class, ttl, size, txtlen;
@@ -210,6 +215,7 @@ parse_dns_reply(data, len)
dns_free_data(r);
return NULL;
}
+ ++ui;
p += status;
GETSHORT(type, p);
GETSHORT(class, p);
diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c
index 1f067b1..514a5e6 100644
--- a/contrib/sendmail/src/srvrsmtp.c
+++ b/contrib/sendmail/src/srvrsmtp.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2007 Sendmail, Inc. and its suppliers.
* All rights reserved.
* Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
* Copyright (c) 1988, 1993
@@ -17,7 +17,7 @@
# include <libmilter/mfdef.h>
#endif /* MILTER */
-SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.960 2007/02/07 20:18:47 ca Exp $")
+SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.967 2007/10/01 16:22:14 ca Exp $")
#include <sm/time.h>
#include <sm/fdset.h>
@@ -349,14 +349,18 @@ static SM_DEBUG_T DebugLeakSmtp = SM_DEBUG_INITIALIZER("leak_smtp",
typedef struct
{
- bool sm_gotmail; /* mail command received */
- unsigned int sm_nrcpts; /* number of successful RCPT commands */
- bool sm_discard;
+ bool sm_gotmail; /* mail command received */
+ unsigned int sm_nrcpts; /* number of successful RCPT commands */
+ bool sm_discard;
#if MILTER
- bool sm_milterize;
- bool sm_milterlist; /* any filters in the list? */
+ bool sm_milterize;
+ bool sm_milterlist; /* any filters in the list? */
+ milters_T sm_milters;
+
+ /* e_nrcpts from envelope before recipient() call */
+ unsigned int sm_e_nrcpts_orig;
#endif /* MILTER */
- char *sm_quarmsg; /* carry quarantining across messages */
+ char *sm_quarmsg; /* carry quarantining across messages */
} SMTP_T;
static bool smtp_data __P((SMTP_T *, ENVELOPE *));
@@ -907,7 +911,7 @@ smtp(nullserver, d_flags, e)
char state;
/* initialize mail filter connection */
- smtp.sm_milterlist = milter_init(e, &state);
+ smtp.sm_milterlist = milter_init(e, &state, &smtp.sm_milters);
switch (state)
{
case SMFIR_REJECT:
@@ -1285,7 +1289,7 @@ smtp(nullserver, d_flags, e)
{
authenticating = SASL_NOT_AUTH;
- /* rfc 2254 4. */
+ /* RFC 2554 4. */
message("501 5.0.0 AUTH aborted");
RESET_SASLCONN;
continue;
@@ -1304,7 +1308,7 @@ smtp(nullserver, d_flags, e)
{
authenticating = SASL_NOT_AUTH;
- /* rfc 2254 4. */
+ /* RFC 2554 4. */
message("501 5.5.4 cannot decode AUTH parameter %s",
inp);
# if SASL >= 20000
@@ -1658,7 +1662,21 @@ smtp(nullserver, d_flags, e)
break;
}
- if (ismore)
+ /*
+ ** RFC 2554 4.
+ ** Unlike a zero-length client answer to a
+ ** 334 reply, a zero- length initial response
+ ** is sent as a single equals sign ("=").
+ */
+
+ if (ismore && *q == '=' && *(q + 1) == '\0')
+ {
+ /* will be free()d, don't use in=""; */
+ in = xalloc(1);
+ *in = '\0';
+ inlen = 0;
+ }
+ else if (ismore)
{
/* could this be shorter? XXX */
# if SASL >= 20000
@@ -2503,6 +2521,7 @@ smtp(nullserver, d_flags, e)
(void) memset(&addr_st, '\0', sizeof(addr_st));
a = NULL;
milter_rcpt_added = false;
+ smtp.sm_e_nrcpts_orig = e->e_nrcpts;
#endif
if (BadRcptThrottle > 0 &&
n_badrcpts >= BadRcptThrottle)
@@ -2558,13 +2577,18 @@ smtp(nullserver, d_flags, e)
#if MILTER
/*
** Do not expand recipients at RCPT time (in the call
- ** to recipient()). If they are expanded, it
- ** is impossible for removefromlist() to figure
- ** out the expanded members of the original
- ** recipient and mark them as QS_DONTSEND.
+ ** to recipient()) if a milter can delete or reject
+ ** a RCPT. If they are expanded, it is impossible
+ ** for removefromlist() to figure out the expanded
+ ** members of the original recipient and mark them
+ ** as QS_DONTSEND.
*/
- e->e_flags |= EF_VRFYONLY;
+ if (!(smtp.sm_milterlist && smtp.sm_milterize &&
+ !bitset(EF_DISCARD, e->e_flags)) &&
+ (smtp.sm_milters.mis_flags &
+ (MIS_FL_DEL_RCPT|MIS_FL_REJ_RCPT)) != 0)
+ e->e_flags |= EF_VRFYONLY;
milter_cmd_done = false;
milter_cmd_safe = false;
#endif /* MILTER */
@@ -2799,6 +2823,8 @@ smtp(nullserver, d_flags, e)
{
(void) removefromlist(addr, &e->e_sendqueue, e);
milter_cmd_fail = false;
+ if (smtp.sm_e_nrcpts_orig < e->e_nrcpts)
+ e->e_nrcpts = smtp.sm_e_nrcpts_orig;
}
#endif /* MILTER */
}
@@ -3557,8 +3583,19 @@ smtp_data(smtp, e)
if (aborting)
{
+ ADDRESS *q;
+
/* Log who the mail would have gone to */
logundelrcpts(e, e->e_message, 8, false);
+
+ /*
+ ** If something above refused the message, we still haven't
+ ** accepted responsibility for it. Don't send DSNs.
+ */
+
+ for (q = e->e_sendqueue; q != NULL; q = q->q_next)
+ q->q_flags &= ~Q_PINGFLAGS;
+
flush_errors(true);
buffer_errors();
goto abortmessage;
@@ -4026,8 +4063,7 @@ reset_mail_esmtp_args(e)
macdefine(&e->e_macro, A_PERM, macid("{dsn_envid}"), NULL);
/* "ret" */
- e->e_flags &= EF_RET_PARAM;
- e->e_flags &= EF_NO_BODY_RETN;
+ e->e_flags &= ~(EF_RET_PARAM|EF_NO_BODY_RETN);
macdefine(&e->e_macro, A_TEMP, macid("{dsn_ret}"), NULL);
#if SASL
diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c
index 622bbb8..724f10c 100644
--- a/contrib/sendmail/src/usersmtp.c
+++ b/contrib/sendmail/src/usersmtp.c
@@ -13,7 +13,7 @@
#include <sendmail.h>
-SM_RCSID("@(#)$Id: usersmtp.c,v 8.469 2006/12/13 20:11:15 ca Exp $")
+SM_RCSID("@(#)$Id: usersmtp.c,v 8.470 2007/10/17 21:35:30 ca Exp $")
#include <sysexits.h>
@@ -2703,8 +2703,9 @@ smtpdata(m, mci, e, ctladdr, xstart)
}
/* terminate the message */
- if (sm_io_fprintf(mci->mci_out, SM_TIME_DEFAULT, ".%s", m->m_eol) ==
- SM_IO_EOF)
+ if (sm_io_fprintf(mci->mci_out, SM_TIME_DEFAULT, "%s.%s",
+ bitset(MCIF_INLONGLINE, mci->mci_flags) ? m->m_eol : "",
+ m->m_eol) == SM_IO_EOF)
goto writeerr;
if (TrafficLogFile != NULL)
(void) sm_io_fprintf(TrafficLogFile, SM_TIME_DEFAULT,
diff --git a/contrib/sendmail/src/util.c b/contrib/sendmail/src/util.c
index af781ef..95d2f9a 100644
--- a/contrib/sendmail/src/util.c
+++ b/contrib/sendmail/src/util.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1998-2007 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: util.c,v 8.410 2006/12/18 18:36:44 ca Exp $")
+SM_RCSID("@(#)$Id: util.c,v 8.413 2007/09/26 23:29:11 ca Exp $")
#include <sm/sendmail.h>
#include <sysexits.h>
@@ -1154,7 +1154,8 @@ putxline(l, len, mci, pxflags)
/* output last part */
if (l[0] == '.' && slop == 0 &&
- bitnset(M_XDOT, mci->mci_mailer->m_flags))
+ bitnset(M_XDOT, mci->mci_mailer->m_flags) &&
+ !bitset(MCIF_INLONGLINE, mci->mci_flags))
{
if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT, '.') ==
SM_IO_EOF)
@@ -1169,7 +1170,8 @@ putxline(l, len, mci, pxflags)
else if (l[0] == 'F' && slop == 0 &&
bitset(PXLF_MAPFROM, pxflags) &&
strncmp(l, "From ", 5) == 0 &&
- bitnset(M_ESCFROM, mci->mci_mailer->m_flags))
+ bitnset(M_ESCFROM, mci->mci_mailer->m_flags) &&
+ !bitset(MCIF_INLONGLINE, mci->mci_flags))
{
if (sm_io_putc(mci->mci_out, SM_TIME_DEFAULT, '>') ==
SM_IO_EOF)
@@ -1188,13 +1190,19 @@ putxline(l, len, mci, pxflags)
if (TrafficLogFile != NULL)
(void) sm_io_putc(TrafficLogFile, SM_TIME_DEFAULT,
'\n');
- if ((!bitset(PXLF_NOADDEOL, pxflags) || !noeol) &&
- sm_io_fputs(mci->mci_out, SM_TIME_DEFAULT,
- mci->mci_mailer->m_eol) == SM_IO_EOF)
+ if ((!bitset(PXLF_NOADDEOL, pxflags) || !noeol))
{
- dead = true;
- break;
+ mci->mci_flags &= ~MCIF_INLONGLINE;
+ if (sm_io_fputs(mci->mci_out, SM_TIME_DEFAULT,
+ mci->mci_mailer->m_eol) == SM_IO_EOF)
+ {
+ dead = true;
+ break;
+ }
}
+ else
+ mci->mci_flags |= MCIF_INLONGLINE;
+
if (l < end && *l == '\n')
{
if (*++l != ' ' && *l != '\t' && *l != '\0' &&
@@ -2813,7 +2821,14 @@ count_open_connections(hostaddr)
if (hostaddr == NULL)
return 0;
- n = 0;
+
+ /*
+ ** Initialize to 1 instead of 0 because this code gets called
+ ** before proc_list_add() gets called, so we (the daemon child
+ ** for this connection) don't count ourselves.
+ */
+
+ n = 1;
for (i = 0; i < ProcListSize; i++)
{
if (ProcListVec[i].proc_pid == NO_PID)
diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c
index 6bdfd11..ee09fc9 100644
--- a/contrib/sendmail/src/version.c
+++ b/contrib/sendmail/src/version.c
@@ -13,6 +13,6 @@
#include <sm/gen.h>
-SM_RCSID("@(#)$Id: version.c,v 8.191 2007/04/03 21:21:18 ca Exp $")
+SM_RCSID("@(#)$Id: version.c,v 8.199 2007/10/31 16:04:12 ca Exp $")
-char Version[] = "8.14.1";
+char Version[] = "8.14.2";
OpenPOWER on IntegriCloud