Deleted Added
full compact
conf.c (102533) conf.c (110563)
1/*
2 * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1988, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
11 *
1/*
2 * Copyright (c) 1998-2002 Sendmail, Inc. and its suppliers.
3 * All rights reserved.
4 * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
5 * Copyright (c) 1988, 1993
6 * The Regents of the University of California. All rights reserved.
7 *
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
11 *
12 * $FreeBSD: head/contrib/sendmail/src/conf.c 102533 2002-08-28 18:12:33Z gshapiro $
12 * $FreeBSD: head/contrib/sendmail/src/conf.c 110563 2003-02-08 20:35:51Z gshapiro $
13 *
14 */
15
16#include <sendmail.h>
17
13 *
14 */
15
16#include <sendmail.h>
17
18SM_RCSID("@(#)$Id: conf.c,v 8.972.2.5 2002/08/16 14:56:01 ca Exp $")
18SM_RCSID("@(#)$Id: conf.c,v 8.972.2.25 2002/12/12 21:19:29 ca Exp $")
19
20#include <sendmail/pathnames.h>
21
22# include <sys/ioctl.h>
23# include <sys/param.h>
24
25#include <limits.h>
26#if NETINET || NETINET6
27# include <arpa/inet.h>
28#endif /* NETINET || NETINET6 */
29#if HASULIMIT && defined(HPUX11)
30# include <ulimit.h>
31#endif /* HASULIMIT && defined(HPUX11) */
32
19
20#include <sendmail/pathnames.h>
21
22# include <sys/ioctl.h>
23# include <sys/param.h>
24
25#include <limits.h>
26#if NETINET || NETINET6
27# include <arpa/inet.h>
28#endif /* NETINET || NETINET6 */
29#if HASULIMIT && defined(HPUX11)
30# include <ulimit.h>
31#endif /* HASULIMIT && defined(HPUX11) */
32
33
34static void setupmaps __P((void));
35static void setupmailers __P((void));
36static void setupqueues __P((void));
37static int get_num_procs_online __P((void));
38
39
40/*
41** CONF.C -- Sendmail Configuration Tables.

--- 319 unchanged lines hidden (view full) ---

361 memset(&ConnectOnlyTo, '\0', sizeof ConnectOnlyTo);
362 DataFileBufferSize = 4096;
363 XscriptFileBufferSize = 4096;
364 for (i = 0; i < MAXRWSETS; i++)
365 RuleSetNames[i] = NULL;
366#if MILTER
367 InputFilters[0] = NULL;
368#endif /* MILTER */
33static void setupmaps __P((void));
34static void setupmailers __P((void));
35static void setupqueues __P((void));
36static int get_num_procs_online __P((void));
37
38
39/*
40** CONF.C -- Sendmail Configuration Tables.

--- 319 unchanged lines hidden (view full) ---

360 memset(&ConnectOnlyTo, '\0', sizeof ConnectOnlyTo);
361 DataFileBufferSize = 4096;
362 XscriptFileBufferSize = 4096;
363 for (i = 0; i < MAXRWSETS; i++)
364 RuleSetNames[i] = NULL;
365#if MILTER
366 InputFilters[0] = NULL;
367#endif /* MILTER */
368#if _FFR_REJECT_LOG
369 RejectLogInterval = 3 HOURS;
370#endif /* _FFR_REJECT_LOG */
371#if _FFR_REQ_DIR_FSYNC_OPT
372 RequiresDirfsync = true;
373#endif /* _FFR_REQ_DIR_FSYNC_OPT */
369 setupmaps();
370 setupqueues();
371 setupmailers();
372 setupheaders();
373}
374
375
376/*

--- 1790 unchanged lines hidden (view full) ---

2167refuseconnections(name, e, d, active)
2168 char *name;
2169 ENVELOPE *e;
2170 int d;
2171 bool active;
2172{
2173 static time_t lastconn[MAXDAEMONS];
2174 static int conncnt[MAXDAEMONS];
374 setupmaps();
375 setupqueues();
376 setupmailers();
377 setupheaders();
378}
379
380
381/*

--- 1790 unchanged lines hidden (view full) ---

2172refuseconnections(name, e, d, active)
2173 char *name;
2174 ENVELOPE *e;
2175 int d;
2176 bool active;
2177{
2178 static time_t lastconn[MAXDAEMONS];
2179 static int conncnt[MAXDAEMONS];
2180#if _FFR_REJECT_LOG
2181 static time_t firstrejtime[MAXDAEMONS];
2182 static time_t nextlogtime[MAXDAEMONS];
2183#endif /* _FFR_REJECT_LOG */
2175
2176#if XLA
2177 if (!xla_smtp_ok())
2178 return true;
2179#endif /* XLA */
2180
2181 if (ConnRateThrottle > 0)
2182 {

--- 21 unchanged lines hidden (view full) ---

2204 }
2205 else if (now != lastconn[d])
2206 conncnt[d] = 0;
2207 }
2208
2209 sm_getla();
2210 if (RefuseLA > 0 && CurrentLA >= RefuseLA)
2211 {
2184
2185#if XLA
2186 if (!xla_smtp_ok())
2187 return true;
2188#endif /* XLA */
2189
2190 if (ConnRateThrottle > 0)
2191 {

--- 21 unchanged lines hidden (view full) ---

2213 }
2214 else if (now != lastconn[d])
2215 conncnt[d] = 0;
2216 }
2217
2218 sm_getla();
2219 if (RefuseLA > 0 && CurrentLA >= RefuseLA)
2220 {
2221# if _FFR_REJECT_LOG
2222 time_t now;
2223
2224# define R2_MSG_LA "have been rejecting connections on daemon %s for %s"
2225# endif /* _FFR_REJECT_LOG */
2212# define R_MSG_LA "rejecting connections on daemon %s: load average: %d"
2213 sm_setproctitle(true, e, R_MSG_LA, name, CurrentLA);
2214 if (LogLevel > 8)
2226# define R_MSG_LA "rejecting connections on daemon %s: load average: %d"
2227 sm_setproctitle(true, e, R_MSG_LA, name, CurrentLA);
2228 if (LogLevel > 8)
2215 sm_syslog(LOG_INFO, NOQID, R_MSG_LA, name, CurrentLA);
2229 sm_syslog(LOG_NOTICE, NOQID, R_MSG_LA, name, CurrentLA);
2230#if _FFR_REJECT_LOG
2231 now = curtime();
2232 if (firstrejtime[d] == 0)
2233 {
2234 firstrejtime[d] = now;
2235 nextlogtime[d] = now + RejectLogInterval;
2236 }
2237 else if (nextlogtime[d] < now)
2238 {
2239 sm_syslog(LOG_ERR, NOQID, R2_MSG_LA, name,
2240 pintvl(now - firstrejtime[d], true));
2241 nextlogtime[d] = now + RejectLogInterval;
2242 }
2243#endif /* _FFR_REJECT_LOG */
2216 return true;
2217 }
2244 return true;
2245 }
2246#if _FFR_REJECT_LOG
2247 else
2248 firstrejtime[d] = 0;
2249#endif /* _FFR_REJECT_LOG */
2218
2219 if (DelayLA > 0 && CurrentLA >= DelayLA)
2220 {
2221 time_t now;
2222 static time_t log_delay = (time_t) 0;
2223
2224# define MIN_DELAY_LOG 90 /* wait before logging this again */
2225# define D_MSG_LA "delaying connections on daemon %s: load average=%d >= %d"

--- 838 unchanged lines hidden (view full) ---

3064# endif /* defined(_AIX3) || defined(_AIX4) */
3065# if defined(__svr4__) || defined(__svr5__)
3066 "/bin/ksh", /* Korn shell */
3067 "/usr/bin/ksh",
3068# endif /* defined(__svr4__) || defined(__svr5__) */
3069# ifdef sgi
3070 "/sbin/sh", /* SGI's shells really live in /sbin */
3071 "/usr/bin/sh",
2250
2251 if (DelayLA > 0 && CurrentLA >= DelayLA)
2252 {
2253 time_t now;
2254 static time_t log_delay = (time_t) 0;
2255
2256# define MIN_DELAY_LOG 90 /* wait before logging this again */
2257# define D_MSG_LA "delaying connections on daemon %s: load average=%d >= %d"

--- 838 unchanged lines hidden (view full) ---

3096# endif /* defined(_AIX3) || defined(_AIX4) */
3097# if defined(__svr4__) || defined(__svr5__)
3098 "/bin/ksh", /* Korn shell */
3099 "/usr/bin/ksh",
3100# endif /* defined(__svr4__) || defined(__svr5__) */
3101# ifdef sgi
3102 "/sbin/sh", /* SGI's shells really live in /sbin */
3103 "/usr/bin/sh",
3072 "/sbin/bsh", /* classic borne shell */
3104 "/sbin/bsh", /* classic Bourne shell */
3073 "/bin/bsh",
3074 "/usr/bin/bsh",
3075 "/sbin/csh", /* standard csh */
3076 "/bin/csh",
3077 "/usr/bin/csh",
3105 "/bin/bsh",
3106 "/usr/bin/bsh",
3107 "/sbin/csh", /* standard csh */
3108 "/bin/csh",
3109 "/usr/bin/csh",
3078 "/sbin/jsh", /* classic borne shell w/ job control*/
3110 "/sbin/jsh", /* classic Bourne shell w/ job control*/
3079 "/bin/jsh",
3080 "/usr/bin/jsh",
3081 "/bin/ksh", /* Korn shell */
3082 "/sbin/ksh",
3083 "/usr/bin/ksh",
3084 "/sbin/tcsh", /* Extended csh */
3085 "/bin/tcsh",
3086 "/usr/bin/tcsh",

--- 589 unchanged lines hidden (view full) ---

3676*/
3677
3678#if HASSETRLIMIT
3679# ifdef RLIMIT_NEEDS_SYS_TIME_H
3680# include <sys/time.h>
3681# endif /* RLIMIT_NEEDS_SYS_TIME_H */
3682# include <sys/resource.h>
3683#endif /* HASSETRLIMIT */
3111 "/bin/jsh",
3112 "/usr/bin/jsh",
3113 "/bin/ksh", /* Korn shell */
3114 "/sbin/ksh",
3115 "/usr/bin/ksh",
3116 "/sbin/tcsh", /* Extended csh */
3117 "/bin/tcsh",
3118 "/usr/bin/tcsh",

--- 589 unchanged lines hidden (view full) ---

3708*/
3709
3710#if HASSETRLIMIT
3711# ifdef RLIMIT_NEEDS_SYS_TIME_H
3712# include <sys/time.h>
3713# endif /* RLIMIT_NEEDS_SYS_TIME_H */
3714# include <sys/resource.h>
3715#endif /* HASSETRLIMIT */
3684#ifndef FD_SETSIZE
3685# define FD_SETSIZE 256
3686#endif /* ! FD_SETSIZE */
3687
3688void
3689resetlimits()
3690{
3691#if HASSETRLIMIT
3692 struct rlimit lim;
3693
3694 lim.rlim_cur = lim.rlim_max = RLIM_INFINITY;

--- 2187 unchanged lines hidden (view full) ---

5882 "_FFR_CHK_QUEUE",
5883#endif /* _FFR_CHK_QUEUE */
5884#if _FFR_CONTROL_MSTAT
5885 "_FFR_CONTROL_MSTAT",
5886#endif /* _FFR_CONTROL_MSTAT */
5887#if _FFR_DAEMON_NETUNIX
5888 "_FFR_DAEMON_NETUNIX",
5889#endif /* _FFR_DAEMON_NETUNIX */
3716
3717void
3718resetlimits()
3719{
3720#if HASSETRLIMIT
3721 struct rlimit lim;
3722
3723 lim.rlim_cur = lim.rlim_max = RLIM_INFINITY;

--- 2187 unchanged lines hidden (view full) ---

5911 "_FFR_CHK_QUEUE",
5912#endif /* _FFR_CHK_QUEUE */
5913#if _FFR_CONTROL_MSTAT
5914 "_FFR_CONTROL_MSTAT",
5915#endif /* _FFR_CONTROL_MSTAT */
5916#if _FFR_DAEMON_NETUNIX
5917 "_FFR_DAEMON_NETUNIX",
5918#endif /* _FFR_DAEMON_NETUNIX */
5919#if _FFR_DEAL_WITH_ERROR_SSL
5920 "_FFR_DEAL_WITH_ERROR_SSL",
5921#endif /* _FFR_DEAL_WITH_ERROR_SSL */
5890#if _FFR_DEPRECATE_MAILER_FLAG_I
5891 "_FFR_DEPRECATE_MAILER_FLAG_I",
5892#endif /* _FFR_DEPRECATE_MAILER_FLAG_I */
5893#if _FFR_DIGUNIX_SAFECHOWN
5894/* Problem noted by Anne Bennett of Concordia University */
5895 "_FFR_DIGUNIX_SAFECHOWN",
5896#endif /* _FFR_DIGUNIX_SAFECHOWN */
5897#if _FFR_DNSMAP_ALIASABLE

--- 57 unchanged lines hidden (view full) ---

5955#if _FFR_LDAP_URI
5956 "_FFR_LDAP_URI",
5957#endif /* _FFR_LDAP_URI */
5958#if _FFR_MAX_FORWARD_ENTRIES
5959/* Randall S. Winchester of the University of Maryland */
5960 "_FFR_MAX_FORWARD_ENTRIES",
5961#endif /* _FFR_MAX_FORWARD_ENTRIES */
5962#if MILTER
5922#if _FFR_DEPRECATE_MAILER_FLAG_I
5923 "_FFR_DEPRECATE_MAILER_FLAG_I",
5924#endif /* _FFR_DEPRECATE_MAILER_FLAG_I */
5925#if _FFR_DIGUNIX_SAFECHOWN
5926/* Problem noted by Anne Bennett of Concordia University */
5927 "_FFR_DIGUNIX_SAFECHOWN",
5928#endif /* _FFR_DIGUNIX_SAFECHOWN */
5929#if _FFR_DNSMAP_ALIASABLE

--- 57 unchanged lines hidden (view full) ---

5987#if _FFR_LDAP_URI
5988 "_FFR_LDAP_URI",
5989#endif /* _FFR_LDAP_URI */
5990#if _FFR_MAX_FORWARD_ENTRIES
5991/* Randall S. Winchester of the University of Maryland */
5992 "_FFR_MAX_FORWARD_ENTRIES",
5993#endif /* _FFR_MAX_FORWARD_ENTRIES */
5994#if MILTER
5995# if _FFR_MILTER_421
5996 "_FFR_MILTER_421",
5997# endif /* _FFR_MILTER_421 */
5963# if _FFR_MILTER_PERDAEMON
5964 "_FFR_MILTER_PERDAEMON",
5965# endif /* _FFR_MILTER_PERDAEMON */
5966#endif /* MILTER */
5967#if _FFR_NODELAYDSN_ON_HOLD
5968/* Steven Pitzl */
5969 "_FFR_NODELAYDSN_ON_HOLD",
5970#endif /* _FFR_NODELAYDSN_ON_HOLD */
5998# if _FFR_MILTER_PERDAEMON
5999 "_FFR_MILTER_PERDAEMON",
6000# endif /* _FFR_MILTER_PERDAEMON */
6001#endif /* MILTER */
6002#if _FFR_NODELAYDSN_ON_HOLD
6003/* Steven Pitzl */
6004 "_FFR_NODELAYDSN_ON_HOLD",
6005#endif /* _FFR_NODELAYDSN_ON_HOLD */
5971#if _FFR_NONSTOP_PERSISTENCE
5972/* Suggested by Jan Krueger of digitalanswers communications consulting gmbh. */
5973 "_FFR_NONSTOP_PERSISTENCE",
5974#endif /* _FFR_NONSTOP_PERSISTENCE */
5975#if _FFR_NO_PIPE
5976 "_FFR_NO_PIPE",
5977#endif /* _FFR_NO_PIPE */
5978#if _FFR_QUARANTINE
5979 "_FFR_QUARANTINE",
5980#endif /* _FFR_QUARANTINE */
5981#if _FFR_QUEUEDELAY
5982 "_FFR_QUEUEDELAY",

--- 9 unchanged lines hidden (view full) ---

5992 "_FFR_QUEUE_RUN_PARANOIA",
5993#endif /* _FFR_QUEUE_RUN_PARANOIA */
5994#if _FFR_QUEUE_SCHED_DBG
5995 "_FFR_QUEUE_SCHED_DBG",
5996#endif /* _FFR_QUEUE_SCHED_DBG */
5997#if _FFR_REDIRECTEMPTY
5998 "_FFR_REDIRECTEMPTY",
5999#endif /* _FFR_REDIRECTEMPTY */
6006#if _FFR_NO_PIPE
6007 "_FFR_NO_PIPE",
6008#endif /* _FFR_NO_PIPE */
6009#if _FFR_QUARANTINE
6010 "_FFR_QUARANTINE",
6011#endif /* _FFR_QUARANTINE */
6012#if _FFR_QUEUEDELAY
6013 "_FFR_QUEUEDELAY",

--- 9 unchanged lines hidden (view full) ---

6023 "_FFR_QUEUE_RUN_PARANOIA",
6024#endif /* _FFR_QUEUE_RUN_PARANOIA */
6025#if _FFR_QUEUE_SCHED_DBG
6026 "_FFR_QUEUE_SCHED_DBG",
6027#endif /* _FFR_QUEUE_SCHED_DBG */
6028#if _FFR_REDIRECTEMPTY
6029 "_FFR_REDIRECTEMPTY",
6030#endif /* _FFR_REDIRECTEMPTY */
6031#if _FFR_REJECT_LOG
6032 "_FFR_REJECT_LOG",
6033#endif /* _FFR_REJECT_LOG */
6034#if _FFR_REQ_DIR_FSYNC_OPT
6035 "_FFR_REQ_DIR_FSYNC_OPT",
6036#endif /* _FFR_REQ_DIR_FSYNC_OPT */
6000#if _FFR_RESET_MACRO_GLOBALS
6001 "_FFR_RESET_MACRO_GLOBALS",
6002#endif /* _FFR_RESET_MACRO_GLOBALS */
6003#if _FFR_RESPOND_ALL
6004 /* in vacation */
6005 "_FFR_RESPOND_ALL",
6006#endif /* _FFR_RESPOND_ALL */
6007#if _FFR_RHS

--- 16 unchanged lines hidden (view full) ---

6024#endif /* _FFR_SMTP_SSL */
6025#if _FFR_SOFT_BOUNCE
6026 "_FFR_SOFT_BOUNCE",
6027#endif /* _FFR_SOFT_BOUNCE */
6028#if _FFR_SPT_ALIGN
6029/* Chris Adams of HiWAAY Informations Services */
6030 "_FFR_SPT_ALIGN",
6031#endif /* _FFR_SPT_ALIGN */
6037#if _FFR_RESET_MACRO_GLOBALS
6038 "_FFR_RESET_MACRO_GLOBALS",
6039#endif /* _FFR_RESET_MACRO_GLOBALS */
6040#if _FFR_RESPOND_ALL
6041 /* in vacation */
6042 "_FFR_RESPOND_ALL",
6043#endif /* _FFR_RESPOND_ALL */
6044#if _FFR_RHS

--- 16 unchanged lines hidden (view full) ---

6061#endif /* _FFR_SMTP_SSL */
6062#if _FFR_SOFT_BOUNCE
6063 "_FFR_SOFT_BOUNCE",
6064#endif /* _FFR_SOFT_BOUNCE */
6065#if _FFR_SPT_ALIGN
6066/* Chris Adams of HiWAAY Informations Services */
6067 "_FFR_SPT_ALIGN",
6068#endif /* _FFR_SPT_ALIGN */
6069#if _FFR_STRIPBACKSL
6070 "_FFR_STRIPBACKSL",
6071#endif /* _FFR_STRIPBACKSL */
6032#if _FFR_TIMERS
6033 "_FFR_TIMERS",
6034#endif /* _FFR_TIMERS */
6035#if _FFR_TLS_1
6036 "_FFR_TLS_1",
6037#endif /* _FFR_TLS_1 */
6038#if _FFR_TRUSTED_QF
6039 "_FFR_TRUSTED_QF",
6040#endif /* _FFR_TRUSTED_QF */
6041#if _FFR_USE_SETLOGIN
6042/* Peter Philipp */
6043 "_FFR_USE_SETLOGIN",
6044#endif /* _FFR_USE_SETLOGIN */
6045 NULL
6046};
6047
6072#if _FFR_TIMERS
6073 "_FFR_TIMERS",
6074#endif /* _FFR_TIMERS */
6075#if _FFR_TLS_1
6076 "_FFR_TLS_1",
6077#endif /* _FFR_TLS_1 */
6078#if _FFR_TRUSTED_QF
6079 "_FFR_TRUSTED_QF",
6080#endif /* _FFR_TRUSTED_QF */
6081#if _FFR_USE_SETLOGIN
6082/* Peter Philipp */
6083 "_FFR_USE_SETLOGIN",
6084#endif /* _FFR_USE_SETLOGIN */
6085 NULL
6086};
6087