summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/libmilter
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2001-05-28 17:08:52 +0000
committergshapiro <gshapiro@FreeBSD.org>2001-05-28 17:08:52 +0000
commit5338b6ff5f88e435da457fd0ec979a333012a0ef (patch)
treea5a76aa374529c5644a8991fe62c81f6b9b89964 /contrib/sendmail/libmilter
parent8d82727087db5182be90a20f20175cc720c5d1e5 (diff)
downloadFreeBSD-src-5338b6ff5f88e435da457fd0ec979a333012a0ef.zip
FreeBSD-src-5338b6ff5f88e435da457fd0ec979a333012a0ef.tar.gz
Import sendmail 8.11.4
Diffstat (limited to 'contrib/sendmail/libmilter')
-rw-r--r--contrib/sendmail/libmilter/README11
-rw-r--r--contrib/sendmail/libmilter/libmilter.h7
-rw-r--r--contrib/sendmail/libmilter/listener.c26
-rw-r--r--contrib/sendmail/libmilter/main.c7
-rw-r--r--contrib/sendmail/libmilter/sm_gethost.c6
5 files changed, 38 insertions, 19 deletions
diff --git a/contrib/sendmail/libmilter/README b/contrib/sendmail/libmilter/README
index 7c052ca..461d64f 100644
--- a/contrib/sendmail/libmilter/README
+++ b/contrib/sendmail/libmilter/README
@@ -10,7 +10,7 @@ file. It is necessary to first build libmilter.a, which can be done by
issuing the './Build' command in SRCDIR/libmilter .
NOTE: Both libmilter and the callouts in sendmail are marked as an FFR (For
-Future Release). If you intend to use them in 8.10.X, you must compiled
+Future Release). If you intend to use them in 8.11.X, you must compiled
both libmilter and sendmail with -D_FFR_MILTER defined. You can do this by
adding the following to your devtools/Site/site.config.m4 file:
@@ -97,7 +97,8 @@ T=S:10s;R:10s;E:5m
where 's' is seconds and 'm' is minutes.
Which filters are invoked and their sequencing is handled by the
-InputMailFilters option.
+InputMailFilters option. Note: if InputMailFilters is not defined no filters
+will be used.
O InputMailFilters=filter1, filter2, filter3
@@ -223,7 +224,7 @@ mlfi_envfrom(ctx, envfrom)
char **envfrom;
{
struct mlfiPriv *priv;
- int fd;
+ int fd = -1;
/* allocate some private memory */
priv = malloc(sizeof *priv);
@@ -244,6 +245,8 @@ mlfi_envfrom(ctx, envfrom)
if ((fd = mkstemp(priv->mlfi_fname)) < 0 ||
(priv->mlfi_fp = fdopen(fd, "w+")) == NULL)
{
+ if (fd >= 0)
+ (void) close(fd);
free(priv->mlfi_fname);
free(priv);
return SMFIS_TEMPFAIL;
@@ -421,4 +424,4 @@ main(argc, argv)
/* eof */
-$Revision: 8.9.2.1.2.14 $, Last updated $Date: 2001/02/21 23:08:19 $
+$Revision: 8.9.2.1.2.17 $, Last updated $Date: 2001/04/11 18:32:58 $
diff --git a/contrib/sendmail/libmilter/libmilter.h b/contrib/sendmail/libmilter/libmilter.h
index 358ba64..886cc4d 100644
--- a/contrib/sendmail/libmilter/libmilter.h
+++ b/contrib/sendmail/libmilter/libmilter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -17,7 +17,7 @@
# define EXTERN
# define INIT(x) = x
# ifndef lint
-static char MilterlId[] = "@(#)$Id: libmilter.h,v 8.3.6.10 2000/11/20 21:15:36 ca Exp $";
+static char MilterlId[] = "@(#)$Id: libmilter.h,v 8.3.6.14 2001/05/27 14:31:12 ca Exp $";
# endif /* ! lint */
#else /* _DEFINE */
# define EXTERN extern
@@ -58,7 +58,7 @@ typedef pthread_mutex_t smutex_t;
#define MILTER_VERSION 100
/* some defaults */
-#define MI_TIMEOUT 1800 /* default timeout for read/write */
+#define MI_TIMEOUT 7210 /* default timeout for read/write */
#define MI_CHK_TIME 5 /* checking whether to terminate */
#if SOMAXCONN > 20
@@ -70,6 +70,7 @@ typedef pthread_mutex_t smutex_t;
/* maximum number of repeated failures in mi_listener() */
#define MAX_FAILS_M 16 /* malloc() */
#define MAX_FAILS_T 16 /* thread creation */
+#define MAX_FAILS_A 16 /* accept() */
/* internal "commands", i.e., error codes */
#define SMFIC_TIMEOUT ((char) 1) /* timeout */
diff --git a/contrib/sendmail/libmilter/listener.c b/contrib/sendmail/libmilter/listener.c
index 6a1a801..6a59955 100644
--- a/contrib/sendmail/libmilter/listener.c
+++ b/contrib/sendmail/libmilter/listener.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: listener.c,v 8.38.2.1.2.21 2001/02/14 02:20:40 gshapiro Exp $";
+static char id[] = "@(#)$Id: listener.c,v 8.38.2.1.2.22 2001/05/16 17:15:58 ca Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -515,6 +515,8 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
int ret = MI_SUCCESS;
int mcnt = 0;
int tcnt = 0;
+ int acnt = 0;
+ int save_errno = 0;
sthread_t thread_id;
_SOCK_ADDR cliaddr;
SOCKADDR_LEN_T socksize;
@@ -574,10 +576,9 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
}
if (r < 0)
{
- int err = errno;
-
+ save_errno = errno;
(void) smutex_unlock(&L_Mutex);
- if (err == EINTR)
+ if (save_errno == EINTR)
continue;
ret = MI_FAILURE;
break;
@@ -593,6 +594,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
memset(&cliaddr, '\0', sizeof cliaddr);
connfd = accept(listenfd, (struct sockaddr *) &cliaddr,
&clilen);
+ save_errno = errno;
(void) smutex_unlock(&L_Mutex);
/*
@@ -610,14 +612,23 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
{
(void) close(connfd);
connfd = INVALID_SOCKET;
- errno = EINVAL;
+ save_errno = EINVAL;
}
if (!ValidSocket(connfd))
{
smi_log(SMI_LOG_ERR,
- "%s: accept() returned invalid socket",
- smfi->xxfi_name);
+ "%s: accept() returned invalid socket (%s)",
+ smfi->xxfi_name, strerror(save_errno));
+ if (save_errno == EINTR)
+ continue;
+ acnt++;
+ MI_SLEEP(acnt);
+ if (acnt >= MAX_FAILS_A)
+ {
+ ret = MI_FAILURE;
+ break;
+ }
continue;
}
@@ -643,6 +654,7 @@ mi_listener(conn, dbg, smfi, timeout, backlog)
continue;
}
mcnt = 0;
+ acnt = 0;
memset(ctx, '\0', sizeof *ctx);
ctx->ctx_sd = connfd;
ctx->ctx_dbg = dbg;
diff --git a/contrib/sendmail/libmilter/main.c b/contrib/sendmail/libmilter/main.c
index 7ea1ba7..6afebdb 100644
--- a/contrib/sendmail/libmilter/main.c
+++ b/contrib/sendmail/libmilter/main.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999-2000 Sendmail, Inc. and its suppliers.
+ * Copyright (c) 1999-2001 Sendmail, Inc. and its suppliers.
* All rights reserved.
*
* By using this file, you agree to the terms and conditions set
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: main.c,v 8.34.4.9 2000/09/09 02:23:03 gshapiro Exp $";
+static char id[] = "@(#)$Id: main.c,v 8.34.4.11 2001/05/07 22:06:37 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -131,9 +131,11 @@ smfi_setbacklog(obacklog)
return MI_SUCCESS;
}
+
int
smfi_main()
{
+
signal(SIGPIPE, SIG_IGN);
if (conn == NULL)
{
@@ -151,6 +153,7 @@ smfi_main()
return MI_FAILURE;
}
+
/* Startup the listener */
if (mi_listener(conn, dbg, smfi, timeout, backlog) != MI_SUCCESS)
return MI_FAILURE;
diff --git a/contrib/sendmail/libmilter/sm_gethost.c b/contrib/sendmail/libmilter/sm_gethost.c
index 32c8faf..a4fc665 100644
--- a/contrib/sendmail/libmilter/sm_gethost.c
+++ b/contrib/sendmail/libmilter/sm_gethost.c
@@ -9,7 +9,7 @@
*/
#ifndef lint
-static char id[] = "@(#)$Id: sm_gethost.c,v 8.7.8.6 2001/02/14 04:07:23 gshapiro Exp $";
+static char id[] = "@(#)$Id: sm_gethost.c,v 8.7.8.10 2001/05/09 20:57:12 gshapiro Exp $";
#endif /* ! lint */
#if _FFR_MILTER
@@ -29,7 +29,7 @@ static char id[] = "@(#)$Id: sm_gethost.c,v 8.7.8.6 2001/02/14 04:07:23 gshapiro
** Support IPv6 as well as IPv4.
*/
-#if NETINET6 && NEEDSGETIPNODE && __RES < 19990909
+#if NETINET6 && NEEDSGETIPNODE
# ifndef AI_V4MAPPED
# define AI_V4MAPPED 0 /* dummy */
@@ -75,7 +75,7 @@ freehostent(h)
return;
}
# endif /* _FFR_FREEHOSTENT */
-#endif /* NEEDSGETIPNODE && NETINET6 && __RES < 19990909 */
+#endif /* NEEDSGETIPNODE && NETINET6 */
struct hostent *
mi_gethostbyname(name, family)
OpenPOWER on IntegriCloud