diff options
Diffstat (limited to 'gnu/usr.sbin/sendmail/libmilter')
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/README | 11 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/libmilter.h | 7 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/listener.c | 26 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/main.c | 7 | ||||
-rw-r--r-- | gnu/usr.sbin/sendmail/libmilter/sm_gethost.c | 6 |
5 files changed, 38 insertions, 19 deletions
diff --git a/gnu/usr.sbin/sendmail/libmilter/README b/gnu/usr.sbin/sendmail/libmilter/README index f228dba21d2..2e7c69de064 100644 --- a/gnu/usr.sbin/sendmail/libmilter/README +++ b/gnu/usr.sbin/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: 1.5 $, Last updated $Date: 2001/02/28 02:43:51 $ +$Revision: 1.6 $, Last updated $Date: 2001/05/29 01:31:12 $ diff --git a/gnu/usr.sbin/sendmail/libmilter/libmilter.h b/gnu/usr.sbin/sendmail/libmilter/libmilter.h index 898edfc38bd..9109051adff 100644 --- a/gnu/usr.sbin/sendmail/libmilter/libmilter.h +++ b/gnu/usr.sbin/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[] = "@(#)$Sendmail: libmilter.h,v 8.3.6.10 2000/11/20 21:15:36 ca Exp $"; +static char MilterlId[] = "@(#)$Sendmail: 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/gnu/usr.sbin/sendmail/libmilter/listener.c b/gnu/usr.sbin/sendmail/libmilter/listener.c index abf9d0879b4..f197ff01cbc 100644 --- a/gnu/usr.sbin/sendmail/libmilter/listener.c +++ b/gnu/usr.sbin/sendmail/libmilter/listener.c @@ -9,7 +9,7 @@ */ #ifndef lint -static char id[] = "@(#)$Sendmail: listener.c,v 8.38.2.1.2.21 2001/02/14 02:20:40 gshapiro Exp $"; +static char id[] = "@(#)$Sendmail: 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/gnu/usr.sbin/sendmail/libmilter/main.c b/gnu/usr.sbin/sendmail/libmilter/main.c index 873eddafeff..521f149fca1 100644 --- a/gnu/usr.sbin/sendmail/libmilter/main.c +++ b/gnu/usr.sbin/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[] = "@(#)$Sendmail: main.c,v 8.34.4.9 2000/09/09 02:23:03 gshapiro Exp $"; +static char id[] = "@(#)$Sendmail: 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/gnu/usr.sbin/sendmail/libmilter/sm_gethost.c b/gnu/usr.sbin/sendmail/libmilter/sm_gethost.c index ce2813395fd..246b1947202 100644 --- a/gnu/usr.sbin/sendmail/libmilter/sm_gethost.c +++ b/gnu/usr.sbin/sendmail/libmilter/sm_gethost.c @@ -9,7 +9,7 @@ */ #ifndef lint -static char id[] = "@(#)$Sendmail: sm_gethost.c,v 8.7.8.6 2001/02/14 04:07:23 gshapiro Exp $"; +static char id[] = "@(#)$Sendmail: 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[] = "@(#)$Sendmail: sm_gethost.c,v 8.7.8.6 2001/02/14 04:07:23 gs ** 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) |