diff options
Diffstat (limited to 'contrib/sendmail/src/conf.c')
-rw-r--r-- | contrib/sendmail/src/conf.c | 140 |
1 files changed, 118 insertions, 22 deletions
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c index 381ca0a..573cd1d 100644 --- a/contrib/sendmail/src/conf.c +++ b/contrib/sendmail/src/conf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2005 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2006 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -14,13 +14,21 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: conf.c,v 8.1061 2005/03/07 17:18:44 ca Exp $") +SM_RCSID("@(#)$Id: conf.c,v 8.1081 2006/02/24 02:21:53 ca Exp $") #include <sendmail/pathnames.h> #if NEWDB # include "sm/bdb.h" #endif /* NEWDB */ +#ifdef DEC +# if NETINET6 +/* for the IPv6 device lookup */ +# define _SOCKADDR_LEN +# include <macros.h> +# endif /* NETINET6 */ +#endif /* DEC */ + # include <sys/ioctl.h> # include <sys/param.h> @@ -345,6 +353,7 @@ setdefaults(e) MaxMimeFieldLength = MaxMimeHeaderLength / 2; MaxForwardEntries = 0; FastSplit = 1; + MaxNOOPCommands = MAXNOOPCOMMANDS; #if SASL AuthMechanisms = newstr(AUTH_MECHANISMS); AuthRealm = NULL; @@ -2175,10 +2184,25 @@ shouldqueue(pri, ct) time_t ct; { bool rval; +#if _FFR_MEMSTAT + long memfree; +#endif /* _FFR_MEMSTAT */ if (tTd(3, 30)) sm_dprintf("shouldqueue: CurrentLA=%d, pri=%ld: ", CurrentLA, pri); + +#if _FFR_MEMSTAT + if (QueueLowMem > 0 && + sm_memstat_get(MemoryResource, &memfree) >= 0 && + memfree < QueueLowMem) + { + if (tTd(3, 30)) + sm_dprintf("true (memfree=%ld < QueueLowMem)\n", + memfree, QueueLowMem); + return true; + } +#endif /* _FFR_MEMSTAT */ if (CurrentLA < QueueLA) { if (tTd(3, 30)) @@ -2227,6 +2251,9 @@ refuseconnections(name, e, d, active) static int conncnt[MAXDAEMONS]; static time_t firstrejtime[MAXDAEMONS]; static time_t nextlogtime[MAXDAEMONS]; +#if _FFR_MEMSTAT + long memfree; +#endif /* _FFR_MEMSTAT */ #if XLA if (!xla_smtp_ok()) @@ -2263,6 +2290,19 @@ refuseconnections(name, e, d, active) conncnt[d] = 0; } + +#if _FFR_MEMSTAT + if (RefuseLowMem > 0 && + sm_memstat_get(MemoryResource, &memfree) >= 0 && + memfree < RefuseLowMem) + { +# define R_MSG_LM "rejecting connections on daemon %s: free memory: %ld" + sm_setproctitle(true, e, R_MSG_LM, name, memfree); + if (LogLevel > 8) + sm_syslog(LOG_NOTICE, NOQID, R_MSG_LM, name, memfree); + return true; + } +#endif /* _FFR_MEMSTAT */ sm_getla(); if (RefuseLA > 0 && CurrentLA >= RefuseLA) { @@ -3732,7 +3772,7 @@ chownsafe(fd, safedir) #if HASSETRLIMIT # ifdef RLIMIT_NEEDS_SYS_TIME_H -# include <sys/time.h> +# include <sm/time.h> # endif /* RLIMIT_NEEDS_SYS_TIME_H */ # include <sys/resource.h> #endif /* HASSETRLIMIT */ @@ -3794,6 +3834,13 @@ setvendor(vendor) return true; } #endif /* SUN_EXTENSIONS */ +#ifdef DEC + if (sm_strcasecmp(vendor, "Digital") == 0) + { + VendorCode = VENDOR_DEC; + return true; + } +#endif /* DEC */ #if defined(VENDOR_NAME) && defined(VENDOR_CODE) if (sm_strcasecmp(vendor, VENDOR_NAME) == 0) @@ -3885,8 +3932,8 @@ vendor_pre_defaults(e) ** /etc/mail/sendmail.cf without this */ - setuserenv("ISP", NULL); - setuserenv("SYSTYPE", NULL); + sm_setuserenv("ISP", NULL); + sm_setuserenv("SYSTYPE", NULL); #endif /* apollo */ } @@ -3900,7 +3947,7 @@ vendor_post_defaults(e) /* Makes sure the SOCK environment variable remains */ if (p = getextenv("SOCK")) - setuserenv("SOCK", p); + sm_setuserenv("SOCK", p); #endif /* __QNX__ */ #if defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES) sun_post_defaults(e); @@ -4676,7 +4723,7 @@ add_hostnames(sa) struct rtentry; struct mbuf; # ifndef SUNOS403 -# include <sys/time.h> +# include <sm/time.h> # endif /* ! SUNOS403 */ # if (_AIX4 >= 40300) && !defined(_NET_IF_H) # undef __P @@ -4817,7 +4864,13 @@ load_if_names() i += sizeof ifr->lifr_name + sa->sa.sa_len; else # endif /* BSD4_4_SOCKADDR */ +# ifdef DEC + /* fix for IPv6 size differences */ + i += sizeof ifr->ifr_name + + max(sizeof(ifr->ifr_addr), ifr->ifr_addr.sa_len); +# else /* DEC */ i += sizeof *ifr; +# endif /* DEC */ if (tTd(0, 20)) sm_dprintf("%s\n", anynet_ntoa(sa)); @@ -5310,8 +5363,8 @@ sm_syslog(level, id, fmt, va_alist) va_dcl #endif /* __STDC__ */ { - static char *buf = NULL; - static size_t bufsize; + char *buf; + size_t bufsize; char *begin, *end; int save_errno; int seq = 1; @@ -5335,11 +5388,8 @@ sm_syslog(level, id, fmt, va_alist) else idlen = strlen(id) + SyslogPrefixLen; - if (buf == NULL) - { - buf = buf0; - bufsize = sizeof buf0; - } + buf = buf0; + bufsize = sizeof buf0; for (;;) { @@ -5381,8 +5431,8 @@ sm_syslog(level, id, fmt, va_alist) (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s: %s\n", id, newstring); #endif /* LOG */ - if (buf == buf0) - buf = NULL; + if (buf != buf0) + sm_free(buf); errno = save_errno; return; } @@ -5446,8 +5496,8 @@ sm_syslog(level, id, fmt, va_alist) (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s[%d]: %s\n", id, seq, begin); #endif /* LOG */ - if (buf == buf0) - buf = NULL; + if (buf != buf0) + sm_free(buf); errno = save_errno; } /* @@ -5657,6 +5707,9 @@ char *CompileOptions[] = #if LDAPMAP "LDAPMAP", #endif /* LDAPMAP */ +#if LDAP_REFERRALS + "LDAP_REFERRALS", +#endif /* LDAP_REFERRALS */ #if LOG "LOG", #endif /* LOG */ @@ -6047,6 +6100,10 @@ char *FFRCompileOptions[] = /* What it says :-) */ "_FFR_DEPRECATE_MAILER_FLAG_I", #endif /* _FFR_DEPRECATE_MAILER_FLAG_I */ +#if _FFR_DM_ONE + /* deliver first TA in background, then queue */ + "_FFR_DM_ONE", +#endif /* _FFR_DM_ONE */ #if _FFR_DIGUNIX_SAFECHOWN /* Properly set SAFECHOWN (include/sm/conf.h) for Digital UNIX */ /* Problem noted by Anne Bennett of Concordia University */ @@ -6110,6 +6167,10 @@ char *FFRCompileOptions[] = /* Generate a ORCPT DSN arg if not already provided */ "_FFR_GEN_ORCPT", #endif /* _FFR_GEN_ORCPT */ +#if _FFR_LOG_GREET_PAUSE + /* log time for greet_pause delay; from Nik Clayton */ + "_FFR_LOG_GREET_PAUSE", +#endif /* _FFR_LOG_GREET_PAUSE */ #if _FFR_GROUPREADABLEAUTHINFOFILE /* Allow group readable DefaultAuthInfo file. */ "_FFR_GROUPREADABLEAUTHINFOFILE", @@ -6159,10 +6220,22 @@ char *FFRCompileOptions[] = /* Randall S. Winchester of the University of Maryland */ "_FFR_MAX_FORWARD_ENTRIES", #endif /* _FFR_MAX_FORWARD_ENTRIES */ +#if _FFR_MAXKEY + /* increase key size for LDAP lookups, see conf.h */ + "_FFR_MAXKEY", +#endif /* _FFR_MAXKEY */ +#if _FFR_MAXNOOPCOMMANDS + /* runtime option for "MaxNOOPCommands" */ + "_FFR_MAXNOOPCOMMANDS", +#endif /* _FFR_MAXNOOPCOMMANDS */ #if _FFR_MAX_SLEEP_TIME /* Limit sleep(2) time in libsm/clock.c */ "_FFR_MAX_SLEEP_TIME", #endif /* _FFR_MAX_SLEEP_TIME */ +#if _FFR_MEMSTAT + /* Check free memory */ + "_FFR_MEMSTAT", +#endif /* _FFR_MEMSTAT */ #if _FFR_MILTER_NAGLE /* milter: turn off Nagle ("cork" on Linux) */ /* John Gardiner Myers of Proofpoint */ @@ -6177,6 +6250,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_MSG_ACCEPT + /* allow to override "Message accepted for delivery" */ + "_FFR_MSG_ACCEPT", +#endif /* _FFR_MSG_ACCEPT */ #if _FFR_NODELAYDSN_ON_HOLD /* Do not issue a DELAY DSN for mailers that use the hold flag. */ /* Steven Pitzl */ @@ -6192,9 +6269,9 @@ char *FFRCompileOptions[] = #endif /* _FFR_LOG_NTRIES */ #if _FFR_PRIV_NOACTUALRECIPIENT /* - ** PrivacyOptions=noactualrecipient stops sendmail from putting - ** X-Actual-Recipient lines in DSNs revealing the actual - ** account that addresses map to. Patch from Dan Harkless. + ** PrivacyOptions=noactualrecipient stops sendmail from putting + ** X-Actual-Recipient lines in DSNs revealing the actual + ** account that addresses map to. Patch from Dan Harkless. */ "_FFR_PRIV_NOACTUALRECIPIENT", @@ -6213,7 +6290,7 @@ char *FFRCompileOptions[] = "_FFR_QUEUE_MACRO", #endif /* _FFR_QUEUE_MACRO */ #if _FFR_QUEUE_RUN_PARANOIA - /* Additional checks when doing queue runs. */ + /* Additional checks when doing queue runs; interval of checks */ "_FFR_QUEUE_RUN_PARANOIA", #endif /* _FFR_QUEUE_RUN_PARANOIA */ #if _FFR_QUEUE_SCHED_DBG @@ -6245,6 +6322,25 @@ char *FFRCompileOptions[] = /* Donated code (unused). */ "_FFR_SHM_STATUS", #endif /* _FFR_SHM_STATUS */ +#if _FFR_LDAP_SINGLEDN + /* + ** The LDAP database map code in Sendmail 8.12.10, when + ** given the -1 switch, would match only a single DN, + ** but was able to return multiple attributes for that + ** DN. In Sendmail 8.13 this "bug" was corrected to + ** only return if exactly one attribute matched. + ** + ** Unfortunately, our configuration uses the former + ** behaviour. Attached is a relatively simple patch + ** to 8.13.4 which adds a -2 switch (for lack of a + ** better option) which returns the single dn/multiple + ** attributes. + ** + ** Jeffrey T. Eaton, Carnegie-Mellon University + */ + + "_FFR_LDAP_SINGLEDN", +#endif /* _FFR_LDAP_SINGLEDN */ #if _FFR_SKIP_DOMAINS /* process every N'th domain instead of every N'th message */ "_FFR_SKIP_DOMAINS", |