diff options
Diffstat (limited to 'contrib/sendmail/src')
-rw-r--r-- | contrib/sendmail/src/conf.c | 556 | ||||
-rw-r--r-- | contrib/sendmail/src/conf.h | 16 | ||||
-rw-r--r-- | contrib/sendmail/src/err.c | 47 | ||||
-rw-r--r-- | contrib/sendmail/src/headers.c | 289 | ||||
-rw-r--r-- | contrib/sendmail/src/mailq.1 | 25 | ||||
-rw-r--r-- | contrib/sendmail/src/mci.c | 35 | ||||
-rw-r--r-- | contrib/sendmail/src/savemail.c | 142 | ||||
-rw-r--r-- | contrib/sendmail/src/sendmail.8 | 7 |
8 files changed, 506 insertions, 611 deletions
diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c index a681575..f299d5c 100644 --- a/contrib/sendmail/src/conf.c +++ b/contrib/sendmail/src/conf.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2007 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 @@ -9,21 +9,18 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * + * $FreeBSD$ */ #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.1082 2006/03/22 22:49:33 ca Exp $") -#include <sm/sendmail.h> #include <sendmail/pathnames.h> #if NEWDB # include "sm/bdb.h" #endif /* NEWDB */ -#include <daemon.h> -#include "map.h" - #ifdef DEC # if NETINET6 /* for the IPv6 device lookup */ @@ -162,7 +159,9 @@ struct prival PrivacyValues[] = { "noreceipts", PRIV_NORECEIPTS }, { "nobodyreturn", PRIV_NOBODYRETN }, { "goaway", PRIV_GOAWAY }, +#if _FFR_PRIV_NOACTUALRECIPIENT { "noactualrecipient", PRIV_NOACTUALRECIPIENT }, +#endif /* _FFR_PRIV_NOACTUALRECIPIENT */ { NULL, 0 } }; @@ -380,7 +379,7 @@ setdefaults(e) InetMode = AF_INET; #endif /* NETINET6 */ ControlSocketName = NULL; - memset(&ConnectOnlyTo, '\0', sizeof(ConnectOnlyTo)); + memset(&ConnectOnlyTo, '\0', sizeof ConnectOnlyTo); DataFileBufferSize = 4096; XscriptFileBufferSize = 4096; for (i = 0; i < MAXRWSETS; i++) @@ -415,7 +414,7 @@ setdefuser() (void) sm_strlcpy(defuserbuf, (defpwent == NULL || defpwent->pw_name == NULL) ? "nobody" : defpwent->pw_name, - sizeof(defuserbuf)); + sizeof defuserbuf); if (tTd(37, 4)) sm_dprintf("setdefuser: DefUid=%d, DefUser=%s\n", (int) DefUid, DefUser); @@ -434,7 +433,7 @@ setupqueues() char buf[100]; MaxRunnersPerQueue = 1; - (void) sm_strlcpy(buf, "mqueue, P=/var/spool/mqueue", sizeof(buf)); + (void) sm_strlcpy(buf, "mqueue, P=/var/spool/mqueue", sizeof buf); makequeue(buf, false); } /* @@ -447,15 +446,15 @@ setupmailers() char buf[100]; (void) sm_strlcpy(buf, "prog, P=/bin/sh, F=lsouDq9, T=X-Unix/X-Unix/X-Unix, A=sh -c \201u", - sizeof(buf)); + sizeof buf); makemailer(buf); (void) sm_strlcpy(buf, "*file*, P=[FILE], F=lsDFMPEouq9, T=X-Unix/X-Unix/X-Unix, A=FILE \201u", - sizeof(buf)); + sizeof buf); makemailer(buf); (void) sm_strlcpy(buf, "*include*, P=/dev/null, F=su, A=INCLUDE \201u", - sizeof(buf)); + sizeof buf); makemailer(buf); initerrmailers(); } @@ -666,13 +665,6 @@ setupmaps() socket_map_lookup, null_map_store); #endif /* SOCKETMAP */ -#if _FFR_DPRINTF_MAP - /* dprintf map -- logs information to syslog */ - MAPDEF("dprintf", NULL, 0, - dprintf_map_parseargs, null_map_open, null_map_close, - dprintf_map_lookup, null_map_store); -#endif /* _FFR_DPRINTF_MAP */ - if (tTd(38, 2)) { /* bogus map -- always return tempfail */ @@ -713,16 +705,69 @@ inithostmaps() char buf[MAXLINE]; /* + ** Set up default hosts maps. + */ + +#if 0 + nmaps = switch_map_find("hosts", maptype, mapreturn); + for (i = 0; i < nmaps; i++) + { + if (strcmp(maptype[i], "files") == 0 && + stab("hosts.files", ST_MAP, ST_FIND) == NULL) + { + (void) sm_strlcpy(buf, "hosts.files text -k 0 -v 1 /etc/hosts", + sizeof buf); + (void) makemapentry(buf); + } +# if NAMED_BIND + else if (strcmp(maptype[i], "dns") == 0 && + stab("hosts.dns", ST_MAP, ST_FIND) == NULL) + { + (void) sm_strlcpy(buf, "hosts.dns dns A", sizeof buf); + (void) makemapentry(buf); + } +# endif /* NAMED_BIND */ +# if NISPLUS + else if (strcmp(maptype[i], "nisplus") == 0 && + stab("hosts.nisplus", ST_MAP, ST_FIND) == NULL) + { + (void) sm_strlcpy(buf, "hosts.nisplus nisplus -k name -v address hosts.org_dir", + sizeof buf); + (void) makemapentry(buf); + } +# endif /* NISPLUS */ +# if NIS + else if (strcmp(maptype[i], "nis") == 0 && + stab("hosts.nis", ST_MAP, ST_FIND) == NULL) + { + (void) sm_strlcpy(buf, "hosts.nis nis -k 0 -v 1 hosts.byname", + sizeof buf); + (void) makemapentry(buf); + } +# endif /* NIS */ +# if NETINFO + else if (strcmp(maptype[i], "netinfo") == 0 && + stab("hosts.netinfo", ST_MAP, ST_FIND) == NULL) + { + (void) sm_strlcpy(buf, "hosts.netinfo netinfo -v name /machines", + sizeof buf); + (void) makemapentry(buf); + } +# endif /* NETINFO */ + } +#endif /* 0 */ + + /* ** Make sure we have a host map. */ if (stab("host", ST_MAP, ST_FIND) == NULL) { /* user didn't initialize: set up host map */ - (void) sm_strlcpy(buf, "host host", sizeof(buf)); + (void) sm_strlcpy(buf, "host host", sizeof buf); #if NAMED_BIND if (ConfigLevel >= 2) - (void) sm_strlcat(buf, " -a. -D", sizeof(buf)); + (void) sm_strlcat(buf, " -a. -D", sizeof buf); #endif /* NAMED_BIND */ (void) makemapentry(buf); } @@ -738,7 +783,7 @@ inithostmaps() stab("aliases.files", ST_MAP, ST_FIND) == NULL) { (void) sm_strlcpy(buf, "aliases.files null", - sizeof(buf)); + sizeof buf); (void) makemapentry(buf); } #if NISPLUS @@ -746,7 +791,7 @@ inithostmaps() stab("aliases.nisplus", ST_MAP, ST_FIND) == NULL) { (void) sm_strlcpy(buf, "aliases.nisplus nisplus -kalias -vexpansion mail_aliases.org_dir", - sizeof(buf)); + sizeof buf); (void) makemapentry(buf); } #endif /* NISPLUS */ @@ -755,7 +800,7 @@ inithostmaps() stab("aliases.nis", ST_MAP, ST_FIND) == NULL) { (void) sm_strlcpy(buf, "aliases.nis nis mail.aliases", - sizeof(buf)); + sizeof buf); (void) makemapentry(buf); } #endif /* NIS */ @@ -764,7 +809,7 @@ inithostmaps() stab("aliases.netinfo", ST_MAP, ST_FIND) == NULL) { (void) sm_strlcpy(buf, "aliases.netinfo netinfo -z, /aliases", - sizeof(buf)); + sizeof buf); (void) makemapentry(buf); } #endif /* NETINFO */ @@ -773,28 +818,66 @@ inithostmaps() stab("aliases.hesiod", ST_MAP, ST_FIND) == NULL) { (void) sm_strlcpy(buf, "aliases.hesiod hesiod aliases", - sizeof(buf)); + sizeof buf); (void) makemapentry(buf); } #endif /* HESIOD */ -#if LDAPMAP && defined(SUN_EXTENSIONS) && \ - defined(SUN_SIMPLIFIED_LDAP) && HASLDAPGETALIASBYNAME - else if (strcmp(maptype[i], "ldap") == 0 && - stab("aliases.ldap", ST_MAP, ST_FIND) == NULL) + } + if (stab("aliases", ST_MAP, ST_FIND) == NULL) + { + (void) sm_strlcpy(buf, "aliases switch aliases", sizeof buf); + (void) makemapentry(buf); + } + +#if 0 /* "user" map class is a better choice */ + /* + ** Set up default users maps. + */ + + nmaps = switch_map_find("passwd", maptype, mapreturn); + for (i = 0; i < nmaps; i++) + { + if (strcmp(maptype[i], "files") == 0 && + stab("users.files", ST_MAP, ST_FIND) == NULL) { - (void) strlcpy(buf, "aliases.ldap ldap -b . -h localhost -k mail=%0 -v mailgroup", + (void) sm_strlcpy(buf, "users.files text -m -z: -k0 -v6 /etc/passwd", sizeof buf); (void) makemapentry(buf); } -#endif /* LDAPMAP && defined(SUN_EXTENSIONS) && ... */ +# if NISPLUS + else if (strcmp(maptype[i], "nisplus") == 0 && + stab("users.nisplus", ST_MAP, ST_FIND) == NULL) + { + (void) sm_strlcpy(buf, "users.nisplus nisplus -m -kname -vhome passwd.org_dir", + sizeof buf); + (void) makemapentry(buf); + } +# endif /* NISPLUS */ +# if NIS + else if (strcmp(maptype[i], "nis") == 0 && + stab("users.nis", ST_MAP, ST_FIND) == NULL) + { + (void) sm_strlcpy(buf, "users.nis nis -m passwd.byname", + sizeof buf); + (void) makemapentry(buf); + } +# endif /* NIS */ +# if HESIOD + else if (strcmp(maptype[i], "hesiod") == 0 && + stab("users.hesiod", ST_MAP, ST_FIND) == NULL) + { + (void) sm_strlcpy(buf, "users.hesiod hesiod", sizeof buf); + (void) makemapentry(buf); + } +# endif /* HESIOD */ } - if (stab("aliases", ST_MAP, ST_FIND) == NULL) + if (stab("users", ST_MAP, ST_FIND) == NULL) { - (void) sm_strlcpy(buf, "aliases switch aliases", sizeof(buf)); + (void) sm_strlcpy(buf, "users switch -m passwd", sizeof buf); (void) makemapentry(buf); } +#endif /* 0 */ } - /* ** SWITCH_MAP_FIND -- find the list of types associated with a map ** @@ -961,7 +1044,7 @@ switch_map_find(service, maptype, mapreturn) char buf[MAXLINE]; while (sm_io_fgets(fp, SM_TIME_DEFAULT, buf, - sizeof(buf)) != NULL) + sizeof buf) != NULL) { register char *p; @@ -1244,25 +1327,6 @@ checkcompat(to, e) #endif /* EXAMPLE_CODE */ return EX_OK; } - -#ifdef SUN_EXTENSIONS -static void -init_md_sun() -{ - struct stat sbuf; - - /* Check for large file descriptor */ - if (fstat(fileno(stdin), &sbuf) < 0) - { - if (errno == EOVERFLOW) - { - perror("stdin"); - exit(EX_NOINPUT); - } - } -} -#endif /* SUN_EXTENSIONS */ - /* ** INIT_MD -- do machine dependent initializations ** @@ -1295,7 +1359,7 @@ init_md(argc, argv) /* keep gethostby*() from stripping the local domain name */ set_domain_trim_off(); #endif /* _CONVEX_SOURCE */ -#if defined(__QNX__) && !defined(__QNXNTO__) +#ifdef __QNX__ /* ** Due to QNX's network distributed nature, you can target a tcpip ** stack on a different node in the qnx network; this patch lets @@ -1464,12 +1528,12 @@ getla() { # ifdef _AUX_SOURCE (void) sm_strlcpy(Nl[X_AVENRUN].n_name, LA_AVENRUN, - sizeof(Nl[X_AVENRUN].n_name)); + sizeof Nl[X_AVENRUN].n_name); Nl[1].n_name[0] = '\0'; # endif /* _AUX_SOURCE */ # if defined(_AIX3) || defined(_AIX4) - if (knlist(Nl, 1, sizeof(Nl[0])) < 0) + if (knlist(Nl, 1, sizeof Nl[0]) < 0) # else /* defined(_AIX3) || defined(_AIX4) */ if (nlist(_PATH_UNIX, Nl) < 0) # endif /* defined(_AIX3) || defined(_AIX4) */ @@ -1942,7 +2006,7 @@ getla() } } - r = read(afd, &avenrun, sizeof(avenrun)); + r = read(afd, &avenrun, sizeof avenrun); if (tTd(3, 5)) sm_dprintf("getla: avenrun = %d\n", avenrun); @@ -2089,7 +2153,7 @@ sm_getla() char labuf[8]; CurrentLA = getla(); - (void) sm_snprintf(labuf, sizeof(labuf), "%d", CurrentLA); + (void) sm_snprintf(labuf, sizeof labuf, "%d", CurrentLA); macdefine(&GlobalMacros, A_TEMP, macid("{load_avg}"), labuf); } /* @@ -2145,18 +2209,26 @@ shouldqueue(pri, ct) sm_dprintf("false (CurrentLA < QueueLA)\n"); return false; } +# if 0 /* this code is reported to cause oscillation around RefuseLA */ + if (CurrentLA >= RefuseLA && QueueLA < RefuseLA) + { + if (tTd(3, 30)) + sm_dprintf("TRUE (CurrentLA >= RefuseLA)\n"); + return true; + } +# endif /* 0 */ rval = pri > (QueueFactor / (CurrentLA - QueueLA + 1)); if (tTd(3, 30)) sm_dprintf("%s (by calculation)\n", rval ? "true" : "false"); return rval; } - /* ** REFUSECONNECTIONS -- decide if connections should be refused ** ** Parameters: +** name -- daemon name (for error messages only) ** e -- the current envelope. -** dn -- number of daemon. +** d -- number of daemon ** active -- was this daemon actually active? ** ** Returns: @@ -2169,16 +2241,16 @@ shouldqueue(pri, ct) */ bool -refuseconnections(e, dn, active) +refuseconnections(name, e, d, active) + char *name; ENVELOPE *e; - int dn; + int d; bool active; { static time_t lastconn[MAXDAEMONS]; static int conncnt[MAXDAEMONS]; static time_t firstrejtime[MAXDAEMONS]; static time_t nextlogtime[MAXDAEMONS]; - int limit; #if _FFR_MEMSTAT long memfree; #endif /* _FFR_MEMSTAT */ @@ -2188,8 +2260,8 @@ refuseconnections(e, dn, active) return true; #endif /* XLA */ - SM_ASSERT(dn >= 0); - SM_ASSERT(dn < MAXDAEMONS); + SM_ASSERT(d >= 0); + SM_ASSERT(d < MAXDAEMONS); if (ConnRateThrottle > 0) { time_t now; @@ -2197,27 +2269,25 @@ refuseconnections(e, dn, active) now = curtime(); if (active) { - if (now != lastconn[dn]) + if (now != lastconn[d]) { - lastconn[dn] = now; - conncnt[dn] = 1; + lastconn[d] = now; + conncnt[d] = 1; } - else if (conncnt[dn]++ > ConnRateThrottle) + else if (conncnt[d]++ > ConnRateThrottle) { #define D_MSG_CRT "deferring connections on daemon %s: %d per second" /* sleep to flatten out connection load */ sm_setproctitle(true, e, D_MSG_CRT, - Daemons[dn].d_name, - ConnRateThrottle); + name, ConnRateThrottle); if (LogLevel > 8) sm_syslog(LOG_INFO, NOQID, D_MSG_CRT, - Daemons[dn].d_name, - ConnRateThrottle); + name, ConnRateThrottle); (void) sleep(1); } } - else if (now != lastconn[dn]) - conncnt[dn] = 0; + else if (now != lastconn[d]) + conncnt[d] = 0; } @@ -2227,47 +2297,40 @@ refuseconnections(e, dn, active) memfree < RefuseLowMem) { # define R_MSG_LM "rejecting connections on daemon %s: free memory: %ld" - sm_setproctitle(true, e, R_MSG_LM, Daemons[dn].d_name, memfree); + sm_setproctitle(true, e, R_MSG_LM, name, memfree); if (LogLevel > 8) - sm_syslog(LOG_NOTICE, NOQID, R_MSG_LM, - Daemons[dn].d_name, memfree); + sm_syslog(LOG_NOTICE, NOQID, R_MSG_LM, name, memfree); return true; } #endif /* _FFR_MEMSTAT */ sm_getla(); - limit = (Daemons[dn].d_refuseLA != DPO_NOTSET) ? - Daemons[dn].d_refuseLA : RefuseLA; - if (limit > 0 && CurrentLA >= limit) + if (RefuseLA > 0 && CurrentLA >= RefuseLA) { time_t now; # define R_MSG_LA "rejecting connections on daemon %s: load average: %d" # define R2_MSG_LA "have been rejecting connections on daemon %s for %s" - sm_setproctitle(true, e, R_MSG_LA, Daemons[dn].d_name, - CurrentLA); + sm_setproctitle(true, e, R_MSG_LA, name, CurrentLA); if (LogLevel > 8) - sm_syslog(LOG_NOTICE, NOQID, R_MSG_LA, - Daemons[dn].d_name, CurrentLA); + sm_syslog(LOG_NOTICE, NOQID, R_MSG_LA, name, CurrentLA); now = curtime(); - if (firstrejtime[dn] == 0) + if (firstrejtime[d] == 0) { - firstrejtime[dn] = now; - nextlogtime[dn] = now + RejectLogInterval; + firstrejtime[d] = now; + nextlogtime[d] = now + RejectLogInterval; } - else if (nextlogtime[dn] < now) + else if (nextlogtime[d] < now) { - sm_syslog(LOG_ERR, NOQID, R2_MSG_LA, Daemons[dn].d_name, - pintvl(now - firstrejtime[dn], true)); - nextlogtime[dn] = now + RejectLogInterval; + sm_syslog(LOG_ERR, NOQID, R2_MSG_LA, name, + pintvl(now - firstrejtime[d], true)); + nextlogtime[d] = now + RejectLogInterval; } return true; } else - firstrejtime[dn] = 0; + firstrejtime[d] = 0; - limit = (Daemons[dn].d_delayLA != DPO_NOTSET) ? - Daemons[dn].d_delayLA : DelayLA; - if (limit > 0 && CurrentLA >= limit) + if (DelayLA > 0 && CurrentLA >= DelayLA) { time_t now; static time_t log_delay = (time_t) 0; @@ -2275,37 +2338,32 @@ refuseconnections(e, dn, active) # define MIN_DELAY_LOG 90 /* wait before logging this again */ # define D_MSG_LA "delaying connections on daemon %s: load average=%d >= %d" /* sleep to flatten out connection load */ - sm_setproctitle(true, e, D_MSG_LA, Daemons[dn].d_name, limit); + sm_setproctitle(true, e, D_MSG_LA, name, DelayLA); if (LogLevel > 8 && (now = curtime()) > log_delay) { sm_syslog(LOG_INFO, NOQID, D_MSG_LA, - Daemons[dn].d_name, CurrentLA, limit); + name, CurrentLA, DelayLA); log_delay = now + MIN_DELAY_LOG; } (void) sleep(1); } - limit = (Daemons[dn].d_maxchildren != DPO_NOTSET) ? - Daemons[dn].d_maxchildren : MaxChildren; - if (limit > 0 && CurChildren >= limit) + if (MaxChildren > 0 && CurChildren >= MaxChildren) { proc_list_probe(); - if (CurChildren >= limit) + if (CurChildren >= MaxChildren) { #define R_MSG_CHILD "rejecting connections on daemon %s: %d children, max %d" sm_setproctitle(true, e, R_MSG_CHILD, - Daemons[dn].d_name, CurChildren, - limit); + name, CurChildren, MaxChildren); if (LogLevel > 8) sm_syslog(LOG_INFO, NOQID, R_MSG_CHILD, - Daemons[dn].d_name, CurChildren, - limit); + name, CurChildren, MaxChildren); return true; } } return false; } - /* ** SETPROCTITLE -- set process title for ps ** @@ -2434,7 +2492,7 @@ initsetproctitle(argc, argv, envp) { for (i = 0; envp[i] != NULL; i++) continue; - environ = (char **) xalloc(sizeof(char *) * (i + 1)); + environ = (char **) xalloc(sizeof (char *) * (i + 1)); for (i = 0; envp[i] != NULL; i++) environ[i] = newstr(envp[i]); environ[i] = NULL; @@ -2603,7 +2661,7 @@ sm_setproctitle(status, e, fmt, va_alist) /* print the argument string */ SM_VA_START(ap, fmt); - (void) sm_vsnprintf(buf, sizeof(buf), fmt, ap); + (void) sm_vsnprintf(buf, sizeof buf, fmt, ap); SM_VA_END(ap); if (status) @@ -2613,7 +2671,7 @@ sm_setproctitle(status, e, fmt, va_alist) { char prefix[SPT_BUFSIZE]; - expand(ProcTitlePrefix, prefix, sizeof(prefix), e); + expand(ProcTitlePrefix, prefix, sizeof prefix, e); setproctitle("%s: %s", prefix, buf); } else @@ -2831,7 +2889,7 @@ uname(name) char buf[MAXLINE]; while (sm_io_fgets(file, SM_TIME_DEFAULT, - buf, sizeof(buf)) != NULL) + buf, sizeof buf) != NULL) { if (sm_io_sscanf(buf, "#define sysname \"%*[^\"]\"", NODE_LENGTH, name->nodename) > 0) @@ -3205,7 +3263,7 @@ usershellok(user, shell) return false; } - while (sm_io_fgets(shellf, SM_TIME_DEFAULT, buf, sizeof(buf)) != NULL) + while (sm_io_fgets(shellf, SM_TIME_DEFAULT, buf, sizeof buf) != NULL) { register char *p, *q; @@ -3277,7 +3335,7 @@ usershellok(user, shell) long freediskspace(dir, bsize) - const char *dir; + char *dir; long *bsize; { # if SFS_TYPE == SFS_NONE @@ -3315,7 +3373,7 @@ freediskspace(dir, bsize) if (stat(dir, &statbuf) == 0 && ustat(statbuf.st_dev, &fs) == 0) # else /* SFS_TYPE == SFS_USTAT */ # if SFS_TYPE == SFS_4ARGS - if (statfs(dir, &fs, sizeof(fs), 0) == 0) + if (statfs(dir, &fs, sizeof fs, 0) == 0) # else /* SFS_TYPE == SFS_4ARGS */ # if SFS_TYPE == SFS_STATVFS if (statvfs(dir, &fs) == 0) @@ -3520,7 +3578,7 @@ lockfile(fd, filename, ext, type) if (ext == NULL) ext = ""; - memset(&lfd, '\0', sizeof(lfd)); + memset(&lfd, '\0', sizeof lfd); if (bitset(LOCK_UN, type)) lfd.l_type = F_UNLCK; else if (bitset(LOCK_EX, type)) @@ -3885,8 +3943,11 @@ vendor_post_defaults(e) ENVELOPE *e; { #ifdef __QNX__ + char *p; + /* Makes sure the SOCK environment variable remains */ - sm_setuserenv("SOCK", NULL); + if (p = getextenv("SOCK")) + sm_setuserenv("SOCK", p); #endif /* __QNX__ */ #if defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES) sun_post_defaults(e); @@ -3982,7 +4043,7 @@ validate_connection(sap, hostname, e) connection_rate_check(sap, e); if (rscheck("check_relay", hostname, anynet_ntoa(sap), - e, RSF_RMCOMM|RSF_COUNT, 3, NULL, NOQID, NULL) != EX_OK) + e, RSF_RMCOMM|RSF_COUNT, 3, NULL, NOQID) != EX_OK) { static char reject[BUFSIZ*2]; extern char MsgBuf[]; @@ -3991,9 +4052,9 @@ validate_connection(sap, hostname, e) sm_dprintf(" ... validate_connection: BAD (rscheck)\n"); if (strlen(MsgBuf) >= 3) - (void) sm_strlcpy(reject, MsgBuf, sizeof(reject)); + (void) sm_strlcpy(reject, MsgBuf, sizeof reject); else - (void) sm_strlcpy(reject, "Access denied", sizeof(reject)); + (void) sm_strlcpy(reject, "Access denied", sizeof reject); return reject; } @@ -4310,12 +4371,12 @@ sm_gethostbyname(name, family) if (nmaps >= 0) { /* try short name */ - if (strlen(name) > sizeof(hbuf) - 1) + if (strlen(name) > sizeof hbuf - 1) { errno = save_errno; return NULL; } - (void) sm_strlcpy(hbuf, name, sizeof(hbuf)); + (void) sm_strlcpy(hbuf, name, sizeof hbuf); (void) shorten_hostname(hbuf); /* if it hasn't been shortened, there's no point */ @@ -4367,7 +4428,7 @@ sm_gethostbyname(name, family) memmove(&ia6, h->h_addr_list[i], IN6ADDRSZ); addr = anynet_ntop(&ia6, - buf6, sizeof(buf6)); + buf6, sizeof buf6); #else /* NETINET6 */ memmove(&ia, h->h_addr_list[i], INADDRSZ); @@ -4606,8 +4667,7 @@ add_hostnames(sa) if (tTd(0, 4)) sm_dprintf("\ta.k.a.: %s\n", hp->h_name); - if (sm_snprintf(hnb, sizeof(hnb), "[%s]", hp->h_name) < - sizeof(hnb) + if (sm_snprintf(hnb, sizeof hnb, "[%s]", hp->h_name) < sizeof hnb && !wordinclass((char *) hnb, 'w')) setclass('w', hnb); } @@ -4625,8 +4685,8 @@ add_hostnames(sa) setclass('w', *ha); if (tTd(0, 4)) sm_dprintf("\ta.k.a.: %s\n", *ha); - if (sm_snprintf(hnb, sizeof(hnb), - "[%s]", *ha) < sizeof(hnb) && + if (sm_snprintf(hnb, sizeof hnb, + "[%s]", *ha) < sizeof hnb && !wordinclass((char *) hnb, 'w')) setclass('w', hnb); } @@ -4739,7 +4799,7 @@ load_if_names() return; } - len = lifc.lifc_len = numifs * sizeof(struct lifreq); + len = lifc.lifc_len = numifs * sizeof (struct lifreq); buf = lifc.lifc_buf = xalloc(lifc.lifc_len); # ifndef __hpux lifc.lifc_family = AF_UNSPEC; @@ -4796,20 +4856,20 @@ load_if_names() ** don't try to use it. */ - if ((len - i) < sizeof(*ifr)) + if ((len - i) < sizeof *ifr) break; # ifdef BSD4_4_SOCKADDR - if (sa->sa.sa_len > sizeof(ifr->lifr_addr)) - i += sizeof(ifr->lifr_name) + sa->sa.sa_len; + if (sa->sa.sa_len > sizeof ifr->lifr_addr) + 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) + + i += sizeof ifr->ifr_name + max(sizeof(ifr->ifr_addr), ifr->ifr_addr.sa_len); # else /* DEC */ - i += sizeof(*ifr); + i += sizeof *ifr; # endif /* DEC */ if (tTd(0, 20)) @@ -4863,18 +4923,18 @@ load_if_names() ia6 = sa->sin6.sin6_addr; if (IN6_IS_ADDR_UNSPECIFIED(&ia6)) { - addr = anynet_ntop(&ia6, buf6, sizeof(buf6)); + addr = anynet_ntop(&ia6, buf6, sizeof buf6); message("WARNING: interface %s is UP with %s address", name, addr == NULL ? "(NULL)" : addr); continue; } /* save IP address in text from */ - addr = anynet_ntop(&ia6, buf6, sizeof(buf6)); + addr = anynet_ntop(&ia6, buf6, sizeof buf6); if (addr != NULL) - (void) sm_snprintf(ip_addr, sizeof(ip_addr), + (void) sm_snprintf(ip_addr, sizeof ip_addr, "[%.*s]", - (int) sizeof(ip_addr) - 3, + (int) sizeof ip_addr - 3, addr); break; @@ -4889,8 +4949,8 @@ load_if_names() } /* save IP address in text from */ - (void) sm_snprintf(ip_addr, sizeof(ip_addr), "[%.*s]", - (int) sizeof(ip_addr) - 3, inet_ntoa(ia)); + (void) sm_snprintf(ip_addr, sizeof ip_addr, "[%.*s]", + (int) sizeof ip_addr - 3, inet_ntoa(ia)); break; } @@ -4946,7 +5006,7 @@ load_if_names() (void) close(s); return; } - ifc.ifc_len = numifs * sizeof(struct ifreq); + ifc.ifc_len = numifs * sizeof (struct ifreq); ifc.ifc_buf = xalloc(ifc.ifc_len); if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) { @@ -4985,15 +5045,15 @@ load_if_names() ** don't try to use it. */ - if ((ifc.ifc_len - i) < sizeof(*ifr)) + if ((ifc.ifc_len - i) < sizeof *ifr) break; # ifdef BSD4_4_SOCKADDR - if (sa->sa.sa_len > sizeof(ifr->ifr_addr)) - i += sizeof(ifr->ifr_name) + sa->sa.sa_len; + if (sa->sa.sa_len > sizeof ifr->ifr_addr) + i += sizeof ifr->ifr_name + sa->sa.sa_len; else # endif /* BSD4_4_SOCKADDR */ - i += sizeof(*ifr); + i += sizeof *ifr; if (tTd(0, 20)) sm_dprintf("%s\n", anynet_ntoa(sa)); @@ -5038,8 +5098,8 @@ load_if_names() } /* save IP address in text from */ - (void) sm_snprintf(ip_addr, sizeof(ip_addr), "[%.*s]", - (int) sizeof(ip_addr) - 3, + (void) sm_snprintf(ip_addr, sizeof ip_addr, "[%.*s]", + (int) sizeof ip_addr - 3, inet_ntoa(ia)); break; @@ -5062,7 +5122,7 @@ load_if_names() ia6 = sa->sin6.sin6_addr; if (IN6_IS_ADDR_UNSPECIFIED(&ia6)) { - addr = anynet_ntop(&ia6, buf6, sizeof(buf6)); + addr = anynet_ntop(&ia6, buf6, sizeof buf6); message("WARNING: interface %s is UP with %s address", ifr->ifr_name, addr == NULL ? "(NULL)" : addr); @@ -5070,11 +5130,11 @@ load_if_names() } /* save IP address in text from */ - addr = anynet_ntop(&ia6, buf6, sizeof(buf6)); + addr = anynet_ntop(&ia6, buf6, sizeof buf6); if (addr != NULL) - (void) sm_snprintf(ip_addr, sizeof(ip_addr), + (void) sm_snprintf(ip_addr, sizeof ip_addr, "[%.*s]", - (int) sizeof(ip_addr) - 3, + (int) sizeof ip_addr - 3, addr); break; @@ -5153,7 +5213,7 @@ get_num_procs_online() mib[0] = CTL_HW; mib[1] = HW_NCPU; - sz = (size_t) sizeof(nproc); + sz = (size_t) sizeof nproc; (void) sysctl(mib, 2, &nproc, &sz, NULL, 0); # endif /* defined(CTL_HW) && defined(HW_NCPU) */ #else /* USESYSCTL */ @@ -5329,7 +5389,7 @@ sm_syslog(level, id, fmt, va_alist) idlen = strlen(id) + SyslogPrefixLen; buf = buf0; - bufsize = sizeof(buf0); + bufsize = sizeof buf0; for (;;) { @@ -5359,19 +5419,9 @@ sm_syslog(level, id, fmt, va_alist) { #if LOG if (*id == '\0') - { - if (tTd(89, 8)) - sm_dprintf("%s\n", newstring); - else - syslog(level, "%s", newstring); - } + syslog(level, "%s", newstring); else - { - if (tTd(89, 8)) - sm_dprintf("%s: %s\n", id, newstring); - else - syslog(level, "%s: %s", id, newstring); - } + syslog(level, "%s: %s", id, newstring); #else /* LOG */ /*XXX should do something more sensible */ if (*id == '\0') @@ -5423,10 +5473,7 @@ sm_syslog(level, id, fmt, va_alist) save = *end; *end = 0; #if LOG - if (tTd(89, 8)) - sm_dprintf("%s[%d]: %s ...\n", id, seq++, begin); - else - syslog(level, "%s[%d]: %s ...", id, seq++, begin); + syslog(level, "%s[%d]: %s ...", id, seq++, begin); #else /* LOG */ (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s[%d]: %s ...\n", id, seq++, begin); @@ -5435,31 +5482,20 @@ sm_syslog(level, id, fmt, va_alist) begin = end; } if (seq >= 999) - { #if LOG - if (tTd(89, 8)) - sm_dprintf("%s[%d]: log terminated, too many parts\n", - id, seq); - else - syslog(level, "%s[%d]: log terminated, too many parts", - id, seq); + syslog(level, "%s[%d]: log terminated, too many parts", + id, seq); #else /* LOG */ (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s[%d]: log terminated, too many parts\n", id, seq); #endif /* LOG */ - } else if (*begin != '\0') - { #if LOG - if (tTd(89, 8)) - sm_dprintf("%s[%d]: %s\n", id, seq, begin); - else - syslog(level, "%s[%d]: %s", id, seq, begin); + syslog(level, "%s[%d]: %s", id, seq, begin); #else /* LOG */ (void) sm_io_fprintf(smioerr, SM_TIME_DEFAULT, "%s[%d]: %s\n", id, seq, begin); #endif /* LOG */ - } if (buf != buf0) sm_free(buf); errno = save_errno; @@ -5498,7 +5534,7 @@ hard_syslog(pri, msg, va_alist) SM_VA_LOCAL_DECL SM_VA_START(ap, msg); - (void) sm_vsnprintf(buf, sizeof(buf), msg, ap); + (void) sm_vsnprintf(buf, sizeof buf, msg, ap); SM_VA_END(ap); for (i = MAXSYSLOGTRIES; --i >= 0 && syslog(pri, CAST "%s", buf) < 0; ) @@ -5756,9 +5792,6 @@ char *CompileOptions[] = #if SCANF "SCANF", #endif /* SCANF */ -#if SM_LDAP_ERROR_ON_MISSING_ARGS - "SM_LDAP_ERROR_ON_MISSING_ARGS", -#endif /* SM_LDAP_ERROR_ON_MISSING_ARGS */ #if SMTPDEBUG "SMTPDEBUG", #endif /* SMTPDEBUG */ @@ -5853,9 +5886,6 @@ char *OsCompileOptions[] = #if HASINITGROUPS "HASINITGROUPS", #endif /* HASINITGROUPS */ -#if HASLDAPGETALIASBYNAME - "HASLDAPGETALIASBYNAME", -#endif /* HASLDAPGETALIASBYNAME */ #if HASLSTAT "HASLSTAT", #endif /* HASLSTAT */ @@ -5928,9 +5958,6 @@ char *OsCompileOptions[] = #if O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL "LOCK_ON_OPEN", #endif /* O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL */ -#if MILTER_NO_NAGLE - "MILTER_NO_NAGLE ", -#endif /* MILTER_NO_NAGLE */ #if NEEDFSYNC "NEEDFSYNC", #endif /* NEEDFSYNC */ @@ -6033,10 +6060,22 @@ char *FFRCompileOptions[] = /* Better truncation of list of MX records for dns map. */ "_FFR_BESTMX_BETTER_TRUNCATION", #endif /* _FFR_BESTMX_BETTER_TRUNCATION */ +#if _FFR_BLOCK_PROXIES + /* + ** Try to deal with open HTTP proxies that are used to send spam + ** by recognizing some commands from them. + */ + + "_FFR_BLOCK_PROXIES", +#endif /* _FFR_BLOCK_PROXIES */ #if _FFR_CATCH_BROKEN_MTAS /* Deal with MTAs that send a reply during the DATA phase. */ "_FFR_CATCH_BROKEN_MTAS", #endif /* _FFR_CATCH_BROKEN_MTAS */ +#if _FFR_CHECK_EOM + /* Enable check_eom ruleset */ + "_FFR_CHECK_EOM", +#endif /* _FFR_CHECK_EOM */ #if _FFR_CHK_QUEUE /* Stricter checks about queue directory permissions. */ "_FFR_CHK_QUEUE", @@ -6045,6 +6084,10 @@ char *FFRCompileOptions[] = /* Don't try to send mail if its size exceeds SIZE= of server. */ "_FFR_CLIENT_SIZE", #endif /* _FFR_CLIENT_SIZE */ +#if _FFR_CONTROL_MSTAT + /* Extended daemon status. */ + "_FFR_CONTROL_MSTAT", +#endif /* _FFR_CONTROL_MSTAT */ #if _FFR_CRLPATH /* CRLPath; needs documentation; Al Smith */ "_FFR_CRLPATH", @@ -6066,11 +6109,27 @@ char *FFRCompileOptions[] = /* Problem noted by Anne Bennett of Concordia University */ "_FFR_DIGUNIX_SAFECHOWN", #endif /* _FFR_DIGUNIX_SAFECHOWN */ +#if _FFR_DM_PER_DAEMON + /* DeliveryMode per DaemonPortOptions: 'D' */ + "_FFR_DM_PER_DAEMON", +#endif /* _FFR_DM_PER_DAEMON */ #if _FFR_DNSMAP_ALIASABLE /* Allow dns map type to be used for aliases. */ /* Don Lewis of TDK */ "_FFR_DNSMAP_ALIASABLE", #endif /* _FFR_DNSMAP_ALIASABLE */ +#if _FFR_DNSMAP_BASE + /* Specify a "base" domain for DNS lookups. */ + "_FFR_DNSMAP_BASE", +#endif /* _FFR_DNSMAP_BASE */ +#if _FFR_DNSMAP_MULTI + /* Allow multiple return values for DNS map. */ + "_FFR_DNSMAP_MULTI", +# if _FFR_DNSMAP_MULTILIMIT + /* Limit number of return values for DNS map. */ + "_FFR_DNSMAP_MULTILIMIT", +# endif /* _FFR_DNSMAP_MULTILIMIT */ +#endif /* _FFR_DNSMAP_MULTI */ #if _FFR_DONTLOCKFILESFORREAD_OPTION /* Enable DontLockFilesForRead option. */ "_FFR_DONTLOCKFILESFORREAD_OPTION", @@ -6079,21 +6138,6 @@ char *FFRCompileOptions[] = /* Allow usernames with '.' */ "_FFR_DOTTED_USERNAMES", #endif /* _FFR_DOTTED_USERNAMES */ -#if _FFR_DPO_CS - /* - ** Make DaemonPortOptions case sensitive. - ** For some unknown reasons the code converted every option - ** to uppercase (first letter only, as that's the only one that - ** is actually checked). This prevented all new lower case options - ** from working... - ** The documentation doesn't say anything about case (in)sensitivity, - ** which means it should be case sensitive by default, - ** but it's not a good idea to change this within a patch release, - ** so let's delay this to 8.15. - */ - - "_FFR_DPO_CS", -#endif /* _FFR_DPO_CS */ #if _FFR_DROP_TRUSTUSER_WARNING /* ** Don't issue this warning: @@ -6103,27 +6147,10 @@ char *FFRCompileOptions[] = "_FFR_DROP_TRUSTUSER_WARNING", #endif /* _FFR_DROP_TRUSTUSER_WARNING */ -#if _FFR_EIGHT_BIT_ADDR_OK - /* EightBitAddrOK: allow 8-bit e-mail addresses */ - "_FFR_EIGHT_BIT_ADDR_OK", -#endif /* _FFR_EIGHT_BIT_ADDR_OK */ #if _FFR_EXTRA_MAP_CHECK /* perform extra checks on $( $) in R lines */ "_FFR_EXTRA_MAP_CHECK", #endif /* _FFR_EXTRA_MAP_CHECK */ -#if _FFR_GETHBN_ExFILE - /* - ** According to Motonori Nakamura some gethostbyname() - ** implementations (TurboLinux?) may (temporarily) fail - ** due to a lack of file discriptors. Enabling this FFR - ** will check errno for EMFILE and ENFILE and in case of a match - ** cause a temporary error instead of a permanent error. - ** The right solution is of course to file a bug against those - ** systems such that they actually set h_errno = TRY_AGAIN. - */ - - "_FFR_GETHBN_ExFILE", -#endif /* _FFR_GETHBN_ExFILE */ #if _FFR_FIX_DASHT /* ** If using -t, force not sending to argv recipients, even @@ -6140,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", @@ -6153,6 +6184,14 @@ char *FFRCompileOptions[] = /* Peter Eriksson of Linkopings universitet */ "_FFR_HANDLE_ISO8859_GECOS", #endif /* _FFR_HANDLE_ISO8859_GECOS */ +#if _FFR_HDR_TYPE + /* Set 'h' in {addr_type} for headers. */ + "_FFR_HDR_TYPE", +#endif /* _FFR_HDR_TYPE */ +#if _FFR_HELONAME + /* option to set heloname; Nik Clayton of FreeBSD */ + "_FFR_HELONAME", +#endif /* _FFR_HELONAME */ #if _FFR_HPUX_NSSWITCH /* Use nsswitch on HP-UX */ "_FFR_HPUX_NSSWITCH", @@ -6181,6 +6220,14 @@ 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", @@ -6189,35 +6236,16 @@ char *FFRCompileOptions[] = /* Check free memory */ "_FFR_MEMSTAT", #endif /* _FFR_MEMSTAT */ -#if _FFR_MILTER_CHECK - "_FFR_MILTER_CHECK", -#endif /* _FFR_MILTER_CHECK */ -#if _FFR_MILTER_CONVERT_ALL_LF_TO_CRLF - /* - ** milter_body() uses the same conversion algorithm as putbody() - ** to translate the "local" df format (\n) to SMTP format (\r\n). - ** However, putbody() and mime8to7() use different conversion - ** algorithms. - ** If the input date does not follow the SMTP standard - ** (e.g., if it has "naked \r"s), then the output from putbody() - ** and mime8to7() will most likely be different. - ** By turning on this FFR milter_body() will try to "imitate" - ** mime8to7(). - ** Note: there is no (simple) way to deal with both conversions - ** in a consistent manner. Moreover, as the "GiGo" principle applies, - ** it's not really worth to fix it. - */ - - "_FFR_MILTER_CONVERT_ALL_LF_TO_CRLF", -#endif /* _FFR_MILTER_CONVERT_ALL_LF_TO_CRLF */ -#if _FFR_MILTER_CHECK_REJECTIONS_TOO - /* - ** Also send RCPTs that are rejected by check_rcpt to a milter - ** (if requested during option negotiation). - */ - - "_FFR_MILTER_CHECK_REJECTIONS_TOO", -#endif /* _FFR_MILTER_CHECK_REJECTIONS_TOO */ +#if _FFR_MILTER_NAGLE + /* milter: turn off Nagle ("cork" on Linux) */ + /* John Gardiner Myers of Proofpoint */ + "_FFR_MILTER_NAGLE ", +#endif /* _FFR_MILTER_NAGLE */ +#if _FFR_MILTER_NOHDR_RESP + /* milter: no response expected when sending headers */ + /* John Gardiner Myers of Proofpoint */ + "_FFR_MILTER_NOHDR_RESP", +#endif /* _FFR_MILTER_NOHDR_RESP */ #if _FFR_MIME7TO8_OLD /* Old mime7to8 code, the new is broken for at least one example. */ "_FFR_MIME7TO8_OLD", @@ -6239,9 +6267,15 @@ char *FFRCompileOptions[] = /* log ntries=, from Nik Clayton of FreeBSD */ "_FFR_LOG_NTRIES", #endif /* _FFR_LOG_NTRIES */ -#if _FFR_QF_PARANOIA - "_FFR_QF_PARANOIA", -#endif /* _FFR_QF_PARANOIA */ +#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. + */ + + "_FFR_PRIV_NOACTUALRECIPIENT", +#endif /* _FFR_PRIV_NOACTUALRECIPIENT */ #if _FFR_QUEUEDELAY /* Exponential queue delay; disabled in 8.13 since it isn't used. */ "_FFR_QUEUEDELAY", @@ -6280,6 +6314,10 @@ char *FFRCompileOptions[] = /* Random shuffle for queue sorting. */ "_FFR_RHS", #endif /* _FFR_RHS */ +#if _FFR_SELECT_SHM + /* Auto-select of shared memory key */ + "_FFR_SELECT_SHM", +#endif /* _FFR_SELECT_SHM */ #if _FFR_SHM_STATUS /* Donated code (unused). */ "_FFR_SHM_STATUS", @@ -6311,6 +6349,10 @@ char *FFRCompileOptions[] = /* Use select(2) in libsm/clock.c to emulate sleep(2) */ "_FFR_SLEEP_USE_SELECT ", #endif /* _FFR_SLEEP_USE_SELECT */ +#if _FFR_SOFT_BOUNCE + /* Turn all errors into temporary errors. */ + "_FFR_SOFT_BOUNCE", +#endif /* _FFR_SOFT_BOUNCE */ #if _FFR_SPT_ALIGN /* ** It looks like the Compaq Tru64 5.1A now aligns argv and envp to 64 diff --git a/contrib/sendmail/src/conf.h b/contrib/sendmail/src/conf.h index f1386c4..ab23bca 100644 --- a/contrib/sendmail/src/conf.h +++ b/contrib/sendmail/src/conf.h @@ -10,7 +10,10 @@ * the sendmail distribution. * * - * $Id: conf.h,v 8.574 2006/11/29 00:36:06 ca Exp $ + * $Id: conf.h,v 8.570 2005/12/09 18:37:27 ca Exp $ + * + * $FreeBSD$ + * */ /* @@ -60,11 +63,6 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ **********************************************************************/ #define MAXLINE 2048 /* max line length */ -#if SASL -# define MAXINPLINE 12288 /* max input line length (for AUTH) */ -#else /* SASL */ -# define MAXINPLINE MAXLINE /* max input line length */ -#endif /* SASL */ #define MAXNAME 256 /* max length of a name */ #ifndef MAXAUTHINFO # define MAXAUTHINFO 100 /* max length of authinfo token */ @@ -76,7 +74,11 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ #define MAXMXHOSTS 100 /* max # of MX records for one host */ #define SMTPLINELIM 990 /* max SMTP line length */ #define MAXUDBKEY 128 /* max size of a database key (udb only) */ -#define MAXKEY 1024 /* max size of a database key */ +#if _FFR_MAXKEY +# define MAXKEY 1024 /* max size of a database key */ +#else /* _FFR_MAXKEY */ +# define MAXKEY (MAXNAME + 1) /* max size of a database key */ +#endif /* _FFR_MAXKEY */ #define MEMCHUNKSIZE 1024 /* chunk size for memory allocation */ #define MAXUSERENVIRON 100 /* max envars saved, must be >= 3 */ #define MAXMAPSTACK 12 /* max # of stacked or sequenced maps */ diff --git a/contrib/sendmail/src/err.c b/contrib/sendmail/src/err.c index 5825666..5a0b5b1 100644 --- a/contrib/sendmail/src/err.c +++ b/contrib/sendmail/src/err.c @@ -13,7 +13,7 @@ #include <sendmail.h> -SM_RCSID("@(#)$Id: err.c,v 8.196 2006/11/10 23:14:08 ca Exp $") +SM_RCSID("@(#)$Id: err.c,v 8.191 2003/01/10 02:16:46 ca Exp $") #if LDAPMAP # include <lber.h> @@ -109,7 +109,7 @@ fatal_error(exc) */ char MsgBuf[BUFSIZ*2]; /* text of most recent message */ -static char HeldMessageBuf[sizeof(MsgBuf)]; /* for held messages */ +static char HeldMessageBuf[sizeof MsgBuf]; /* for held messages */ #if NAMED_BIND && !defined(NO_DATA) # define NO_DATA NO_ADDRESS @@ -208,7 +208,7 @@ syserr(fmt, va_alist) else { user = ubuf; - (void) sm_snprintf(ubuf, sizeof(ubuf), "UID%d", (int) RealUid); + (void) sm_snprintf(ubuf, sizeof ubuf, "UID%d", (int) RealUid); } if (LogLevel > 0) @@ -320,9 +320,9 @@ usrerr(fmt, va_alist) { char buf[MAXLINE]; - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Postmaster warning: %.*s", - (int) sizeof(buf) - 22, errtxt); + (int) sizeof buf - 22, errtxt); CurEnv->e_message = sm_rpool_strdup_x(CurEnv->e_rpool, buf); } @@ -407,9 +407,9 @@ usrerrenh(enhsc, fmt, va_alist) { char buf[MAXLINE]; - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Postmaster warning: %.*s", - (int) sizeof(buf) - 22, errtxt); + (int) sizeof buf - 22, errtxt); CurEnv->e_message = sm_rpool_strdup_x(CurEnv->e_rpool, buf); } @@ -528,7 +528,8 @@ nmessage(msg, va_alist) case '5': if (CurEnv->e_rpool == NULL && CurEnv->e_message != NULL) sm_free(CurEnv->e_message); - CurEnv->e_message = sm_rpool_strdup_x(CurEnv->e_rpool, errtxt); + CurEnv->e_message = + sm_rpool_strdup_x(CurEnv->e_rpool, errtxt); break; } } @@ -557,9 +558,8 @@ putoutmsg(msg, holdmsg, heldmsg) bool holdmsg; bool heldmsg; { - char msgcode = msg[0]; char *errtxt = msg; - char *id; + char msgcode = msg[0]; /* display for debugging */ if (tTd(54, 8)) @@ -571,7 +571,6 @@ putoutmsg(msg, holdmsg, heldmsg) msg[0] = '5'; else if (msgcode == '8') msg[0] = '4'; - id = (CurEnv != NULL) ? CurEnv->e_id : NULL; /* output to transcript if serious */ if (!heldmsg && CurEnv != NULL && CurEnv->e_xfp != NULL && @@ -580,7 +579,7 @@ putoutmsg(msg, holdmsg, heldmsg) msg); if (LogLevel > 14 && (OpMode == MD_SMTP || OpMode == MD_DAEMON)) - sm_syslog(LOG_INFO, id, + sm_syslog(LOG_INFO, CurEnv->e_id, "--- %s%s%s", msg, holdmsg ? " (hold)" : "", heldmsg ? " (held)" : ""); @@ -596,7 +595,7 @@ putoutmsg(msg, holdmsg, heldmsg) msg[0] = msgcode; if (HeldMessageBuf[0] == '5' && msgcode == '4') return; - (void) sm_strlcpy(HeldMessageBuf, msg, sizeof(HeldMessageBuf)); + (void) sm_strlcpy(HeldMessageBuf, msg, sizeof HeldMessageBuf); return; } @@ -651,7 +650,7 @@ putoutmsg(msg, holdmsg, heldmsg) /* can't call syserr, 'cause we are using MsgBuf */ HoldErrs = true; if (LogLevel > 0) - sm_syslog(LOG_CRIT, id, + sm_syslog(LOG_CRIT, CurEnv->e_id, "SYSERR: putoutmsg (%s): error on output channel sending \"%s\": %s", CURHOSTNAME, shortenstring(msg, MAXSHORTSTR), sm_errstring(errno)); @@ -824,7 +823,7 @@ fmtmsg(eb, to, num, enhsc, eno, fmt, ap) { char del; int l; - int spaceleft = sizeof(MsgBuf); + int spaceleft = sizeof MsgBuf; char *errtxt; /* output the reply code */ @@ -837,13 +836,15 @@ fmtmsg(eb, to, num, enhsc, eno, fmt, ap) del = '-'; else del = ' '; +#if _FFR_SOFT_BOUNCE if (SoftBounce && num[0] == '5') { /* replace 5 by 4 */ (void) sm_snprintf(eb, spaceleft, "4%2.2s%c", num + 1, del); } else - (void) sm_snprintf(eb, spaceleft, "%3.3s%c", num, del); +#endif /* _FFR_SOFT_BOUNCE */ + (void) sm_snprintf(eb, spaceleft, "%3.3s%c", num, del); eb += 4; spaceleft -= 4; @@ -865,11 +866,13 @@ fmtmsg(eb, to, num, enhsc, eno, fmt, ap) eb += l; spaceleft -= l; } +#if _FFR_SOFT_BOUNCE if (SoftBounce && eb[-l] == '5') { /* replace 5 by 4 */ eb[-l] = '4'; } +#endif /* _FFR_SOFT_BOUNCE */ errtxt = eb; /* output the file name and line number */ @@ -1003,7 +1006,7 @@ sm_errstring(errnum) err = strerror(errnum); if (err == NULL) { - (void) sm_snprintf(errbuf, sizeof(errbuf), + (void) sm_snprintf(errbuf, sizeof errbuf, "Error %d", errnum); err = errbuf; } @@ -1047,14 +1050,14 @@ sm_errstring(errnum) case EHOSTDOWN: if (CurHostName == NULL) break; - (void) sm_snprintf(buf, sizeof(buf), "Host %s is down", + (void) sm_snprintf(buf, sizeof buf, "Host %s is down", shortenstring(CurHostName, MAXSHORTSTR)); return buf; case ECONNREFUSED: if (CurHostName == NULL) break; - (void) sm_strlcpyn(buf, sizeof(buf), 2, "Connection refused by ", + (void) sm_strlcpyn(buf, sizeof buf, 2, "Connection refused by ", shortenstring(CurHostName, MAXSHORTSTR)); return buf; @@ -1124,7 +1127,7 @@ sm_errstring(errnum) if (dnsmsg != NULL) { bp = buf; - bp += sm_strlcpy(bp, "Name server: ", sizeof(buf)); + bp += sm_strlcpy(bp, "Name server: ", sizeof buf); if (CurHostName != NULL) { (void) sm_strlcpyn(bp, SPACELEFT(buf, bp), 2, @@ -1144,7 +1147,7 @@ sm_errstring(errnum) err = strerror(errnum); if (err == NULL) { - (void) sm_snprintf(buf, sizeof(buf), "Error %d", errnum); + (void) sm_snprintf(buf, sizeof buf, "Error %d", errnum); return buf; } return err; @@ -1152,7 +1155,7 @@ sm_errstring(errnum) if (errnum > 0 && errnum < sys_nerr) return sys_errlist[errnum]; - (void) sm_snprintf(buf, sizeof(buf), "Error %d", errnum); + (void) sm_snprintf(buf, sizeof buf, "Error %d", errnum); return buf; #endif /* HASSTRERROR */ } diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c index bb78d22..383a053 100644 --- a/contrib/sendmail/src/headers.c +++ b/contrib/sendmail/src/headers.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2004, 2006, 2007 Sendmail, Inc. and its suppliers. + * Copyright (c) 1998-2004, 2006 Sendmail, Inc. and its suppliers. * All rights reserved. * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved. * Copyright (c) 1988, 1993 @@ -9,14 +9,14 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * + * $FreeBSD$ */ #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.291 2006/03/24 01:01:56 ca Exp $") -static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *, bool)); +static HDR *allocheader __P((char *, char *, int, SM_RPOOL_T *)); static size_t fix_mime_header __P((HDR *, ENVELOPE *)); static int priencode __P((char *)); static bool put_vanilla_header __P((HDR *, char *, MCI *)); @@ -44,11 +44,10 @@ setupheaders() s->s_header.hi_ruleset = NULL; } } - /* -** DOCHOMPHEADER -- process and save a header line. +** CHOMPHEADER -- process and save a header line. ** -** Called by chompheader. +** Called by collect, readcf, and readqf to deal with header lines. ** ** Parameters: ** line -- header as a text line. @@ -65,14 +64,13 @@ setupheaders() */ static struct hdrinfo NormalHeader = { NULL, 0, NULL }; -static unsigned long dochompheader __P((char *, int, HDR **, ENVELOPE *)); -static unsigned long -dochompheader(line, pflag, hdrp, e) +unsigned long +chompheader(line, pflag, hdrp, e) char *line; int pflag; HDR **hdrp; - ENVELOPE *e; + register ENVELOPE *e; { unsigned char mid = '\0'; register char *p; @@ -88,6 +86,13 @@ dochompheader(line, pflag, hdrp, e) bool nullheader = false; BITMAP256 mopts; + if (tTd(31, 6)) + { + sm_dprintf("chompheader: "); + xputs(sm_debug_file(), line); + sm_dprintf("\n"); + } + headeronly = hdrp != NULL; if (!headeronly) hdrp = &e->e_header; @@ -183,6 +188,10 @@ hse: return 0; } *fvalue = '\0'; + + /* strip field value on front */ + if (*p == ' ') + p++; fvalue = p; /* if the field is null, go ahead and use the default */ @@ -200,7 +209,7 @@ hse: { char hbuf[50]; - (void) expand(fvalue, hbuf, sizeof(hbuf), e); + (void) expand(fvalue, hbuf, sizeof hbuf, e); for (p = hbuf; isascii(*p) && isspace(*p); ) p++; if ((*p++ & 0377) == CALLSUBR) @@ -348,8 +357,9 @@ hse: macdefine(&e->e_macro, A_TEMP, macid("{hdr_name}"), fname); - (void) sm_snprintf(qval, sizeof(qval), "%d", k); + (void) sm_snprintf(qval, sizeof qval, "%d", k); macdefine(&e->e_macro, A_TEMP, macid("{hdrlen}"), qval); +#if _FFR_HDR_TYPE if (bitset(H_FROM, hi->hi_flags)) macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), "h s"); @@ -357,10 +367,11 @@ hse: macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), "h r"); else +#endif /* _FFR_HDR_TYPE */ macdefine(&e->e_macro, A_PERM, macid("{addr_type}"), "h"); (void) rscheck(rs, fvalue, NULL, e, rscheckflags, 3, - NULL, e->e_id, NULL); + NULL, e->e_id); } } @@ -413,18 +424,18 @@ hse: { /* copy conditions from default case */ memmove((char *) mopts, (char *) h->h_mflags, - sizeof(mopts)); + sizeof mopts); } h->h_macro = mid; } } /* create a new node */ - h = (HDR *) sm_rpool_malloc_x(e->e_rpool, sizeof(*h)); + h = (HDR *) sm_rpool_malloc_x(e->e_rpool, sizeof *h); h->h_field = sm_rpool_strdup_x(e->e_rpool, fname); h->h_value = sm_rpool_strdup_x(e->e_rpool, fvalue); h->h_link = NULL; - memmove((char *) h->h_mflags, (char *) mopts, sizeof(mopts)); + memmove((char *) h->h_mflags, (char *) mopts, sizeof mopts); h->h_macro = mid; *hp = h; h->h_flags = hi->hi_flags; @@ -450,97 +461,25 @@ hse: return h->h_flags; } - -/* -** CHOMPHEADER -- process and save a header line. -** -** Called by collect, readcf, and readqf to deal with header lines. -** This is just a wrapper for dochompheader(). -** -** Parameters: -** line -- header as a text line. -** pflag -- flags for chompheader() (from sendmail.h) -** hdrp -- a pointer to the place to save the header. -** e -- the envelope including this header. -** -** Returns: -** flags for this header. -** -** Side Effects: -** The header is saved on the header list. -** Contents of 'line' are destroyed. -*/ - - -unsigned long -chompheader(line, pflag, hdrp, e) - char *line; - int pflag; - HDR **hdrp; - register ENVELOPE *e; -{ - unsigned long rval; - - if (tTd(31, 6)) - { - sm_dprintf("chompheader: "); - xputs(sm_debug_file(), line); - sm_dprintf("\n"); - } - - /* quote this if user (not config file) input */ - if (bitset(pflag, CHHDR_USER)) - { - char xbuf[MAXLINE]; - char *xbp = NULL; - int xbufs; - - xbufs = sizeof(xbuf); - xbp = quote_internal_chars(line, xbuf, &xbufs); - if (tTd(31, 7)) - { - sm_dprintf("chompheader: quoted: "); - xputs(sm_debug_file(), xbp); - sm_dprintf("\n"); - } - rval = dochompheader(xbp, pflag, hdrp, e); - if (xbp != xbuf) - sm_free(xbp); - } - else - rval = dochompheader(line, pflag, hdrp, e); - - return rval; -} - /* ** ALLOCHEADER -- allocate a header entry ** ** Parameters: -** field -- the name of the header field (will not be copied). -** value -- the value of the field (will be copied). +** field -- the name of the header field. +** value -- the value of the field. ** flags -- flags to add to h_flags. ** rp -- resource pool for allocations -** space -- add leading space? ** ** Returns: ** Pointer to a newly allocated and populated HDR. -** -** Notes: -** o field and value must be in internal format, i.e., -** metacharacters must be "quoted", see quote_internal_chars(). -** o maybe add more flags to decide: -** - what to copy (field/value) -** - whether to convert value to an internal format */ static HDR * -allocheader(field, value, flags, rp, space) +allocheader(field, value, flags, rp) char *field; char *value; int flags; SM_RPOOL_T *rp; - bool space; { HDR *h; STAB *s; @@ -549,23 +488,9 @@ allocheader(field, value, flags, rp, space) s = stab(field, ST_HEADER, ST_FIND); /* allocate space for new header */ - h = (HDR *) sm_rpool_malloc_x(rp, sizeof(*h)); + h = (HDR *) sm_rpool_malloc_x(rp, sizeof *h); h->h_field = field; - if (space) - { - size_t l; - char *n; - - l = strlen(value); - SM_ASSERT(l + 2 > l); - n = sm_rpool_malloc_x(rp, l + 2); - n[0] = ' '; - n[1] = '\0'; - sm_strlcpy(n + 1, value, l + 1); - h->h_value = n; - } - else - h->h_value = sm_rpool_strdup_x(rp, value); + h->h_value = sm_rpool_strdup_x(rp, value); h->h_flags = flags; if (s != NULL) h->h_flags |= s->s_header.hi_flags; @@ -574,36 +499,30 @@ allocheader(field, value, flags, rp, space) return h; } - /* ** ADDHEADER -- add a header entry to the end of the queue. ** ** This bypasses the special checking of chompheader. ** ** Parameters: -** field -- the name of the header field (will not be copied). -** value -- the value of the field (will be copied). +** field -- the name of the header field. +** value -- the value of the field. ** flags -- flags to add to h_flags. ** e -- envelope. -** space -- add leading space? ** ** Returns: ** none. ** ** Side Effects: ** adds the field on the list of headers for this envelope. -** -** Notes: field and value must be in internal format, i.e., -** metacharacters must be "quoted", see quote_internal_chars(). */ void -addheader(field, value, flags, e, space) +addheader(field, value, flags, e) char *field; char *value; int flags; ENVELOPE *e; - bool space; { register HDR *h; HDR **hp; @@ -617,51 +536,41 @@ addheader(field, value, flags, e, space) } /* allocate space for new header */ - h = allocheader(field, value, flags, e->e_rpool, space); + h = allocheader(field, value, flags, e->e_rpool); h->h_link = *hp; *hp = h; } - /* ** INSHEADER -- insert a header entry at the specified index +** ** This bypasses the special checking of chompheader. ** ** Parameters: ** idx -- index into the header list at which to insert -** field -- the name of the header field (will be copied). -** value -- the value of the field (will be copied). +** field -- the name of the header field. +** value -- the value of the field. ** flags -- flags to add to h_flags. ** e -- envelope. -** space -- add leading space? ** ** Returns: ** none. ** ** Side Effects: ** inserts the field on the list of headers for this envelope. -** -** Notes: -** - field and value must be in internal format, i.e., -** metacharacters must be "quoted", see quote_internal_chars(). -** - the header list contains headers that might not be -** sent "out" (see putheader(): "skip"), hence there is no -** reliable way to insert a header at an exact position -** (except at the front or end). */ void -insheader(idx, field, value, flags, e, space) +insheader(idx, field, value, flags, e) int idx; char *field; char *value; int flags; ENVELOPE *e; - bool space; { HDR *h, *srch, *last = NULL; /* allocate space for new header */ - h = allocheader(field, value, flags, e->e_rpool, space); + h = allocheader(field, value, flags, e->e_rpool); /* find insertion position */ for (srch = e->e_header; srch != NULL && idx > 0; @@ -685,7 +594,6 @@ insheader(idx, field, value, flags, e, space) srch->h_link = h; } } - /* ** HVALUE -- return value of a header. ** @@ -697,7 +605,7 @@ insheader(idx, field, value, flags, e, space) ** header -- the header list. ** ** Returns: -** pointer to the value part (internal format). +** pointer to the value part. ** NULL if not found. ** ** Side Effects: @@ -719,7 +627,6 @@ hvalue(field, header) } return NULL; } - /* ** ISHEADER -- predicate telling if argument is a header. ** @@ -747,9 +654,8 @@ bool isheader(h) char *h; { - char *s; + register char *s = h; - s = h; if (s[0] == '-' && s[1] == '-') return false; @@ -765,7 +671,6 @@ isheader(h) return (*s == ':'); } - /* ** EATHEADER -- run through the stored header and extract info. ** @@ -830,7 +735,7 @@ eatheader(e, full, log) for (h = e->e_header; h != NULL; h = h->h_link) { if (tTd(32, 1)) - sm_dprintf("%s:", h->h_field); + sm_dprintf("%s: ", h->h_field); if (h->h_value == NULL) { if (tTd(32, 1)) @@ -848,13 +753,12 @@ eatheader(e, full, log) xputs(sm_debug_file(), h->h_value); sm_dprintf(") "); } - expand(h->h_value, buf, sizeof(buf), e); - if (buf[0] != '\0' && - (buf[0] != ' ' || buf[1] != '\0')) + expand(h->h_value, buf, sizeof buf, e); + if (buf[0] != '\0') { if (bitset(H_FROM, h->h_flags)) expand(crackaddr(buf, e), - buf, sizeof(buf), e); + buf, sizeof buf, e); h->h_value = sm_rpool_strdup_x(e->e_rpool, buf); h->h_flags &= ~H_DEFAULT; } @@ -918,7 +822,7 @@ eatheader(e, full, log) if (hopcnt > e->e_hopcount) { e->e_hopcount = hopcnt; - (void) sm_snprintf(buf, sizeof(buf), "%d", e->e_hopcount); + (void) sm_snprintf(buf, sizeof buf, "%d", e->e_hopcount); macdefine(&e->e_macro, A_TEMP, 'c', buf); } @@ -949,7 +853,7 @@ eatheader(e, full, log) /* tokenize header */ oldsupr = SuprErrs; SuprErrs = true; - pvp = prescan(p, '\0', pvpbuf, sizeof(pvpbuf), NULL, + pvp = prescan(p, '\0', pvpbuf, sizeof pvpbuf, NULL, MimeTokenTab, false); SuprErrs = oldsupr; @@ -1071,7 +975,6 @@ eatheader(e, full, log) e->e_flags &= ~EF_LOGSENDER; } } - /* ** LOGSENDER -- log sender information ** @@ -1102,8 +1005,8 @@ logsender(e, msgid) size_t l; l = strlen(msgid); - if (l > sizeof(mbuf) - 1) - l = sizeof(mbuf) - 1; + if (l > sizeof mbuf - 1) + l = sizeof mbuf - 1; memmove(mbuf, msgid, l); mbuf[l] = '\0'; p = mbuf; @@ -1123,7 +1026,7 @@ logsender(e, msgid) else { name = hbuf; - (void) sm_snprintf(hbuf, sizeof(hbuf), "%.80s", RealHostName); + (void) sm_snprintf(hbuf, sizeof hbuf, "%.80s", RealHostName); if (RealHostAddr.sa.sa_family != 0) { p = &hbuf[strlen(hbuf)]; @@ -1202,7 +1105,6 @@ logsender(e, msgid) "%.400srelay=%s", sbuf, name); #endif /* (SYSLOG_BUFSIZE) >= 256 */ } - /* ** PRIENCODE -- encode external priority names into internal values. ** @@ -1231,7 +1133,6 @@ priencode(p) /* unknown priority */ return 0; } - /* ** CRACKADDR -- parse an address and turn it into a macro ** @@ -1314,22 +1215,17 @@ crackaddr(addr, e) if (tTd(33, 1)) sm_dprintf("crackaddr(%s)\n", addr); - buflim = bufend = &buf[sizeof(buf) - 1]; - bp = bufhead = buf; - - /* skip over leading spaces but preserve them */ + /* strip leading spaces */ while (*addr != '\0' && isascii(*addr) && isspace(*addr)) - { - SM_APPEND_CHAR(*addr); addr++; - } - bufhead = bp; /* ** Start by assuming we have no angle brackets. This will be ** adjusted later if we find them. */ + buflim = bufend = &buf[sizeof(buf) - 1]; + bp = bufhead = buf; p = addrhead = addr; copylev = anglelev = cmtlev = realcmtlev = 0; bracklev = 0; @@ -1637,7 +1533,6 @@ crackaddr(addr, e) } return buf; } - /* ** PUTHEADER -- put the header part of a message from the in-core copy ** @@ -1685,7 +1580,7 @@ putheader(mci, hdr, e, flags) if (tTd(34, 11)) { - sm_dprintf(" %s:", h->h_field); + sm_dprintf(" %s: ", h->h_field); xputs(sm_debug_file(), p); } @@ -1826,7 +1721,7 @@ putheader(mci, hdr, e, flags) if (bitset(H_DEFAULT, h->h_flags) || bitset(H_BINDLATE, h->h_flags)) { - expand(p, buf, sizeof(buf), e); + expand(p, buf, sizeof buf, e); p = buf; if (*p == '\0') { @@ -1847,7 +1742,7 @@ putheader(mci, hdr, e, flags) else { /* no other recipient headers: truncate value */ - (void) sm_strlcpyn(obuf, sizeof(obuf), 2, + (void) sm_strlcpyn(obuf, sizeof obuf, 2, h->h_field, ":"); if (!putline(obuf, mci)) goto writeerr; @@ -1891,7 +1786,7 @@ putheader(mci, hdr, e, flags) goto writeerr; if (hvalue("Content-Type", e->e_header) == NULL) { - (void) sm_snprintf(obuf, sizeof(obuf), + (void) sm_snprintf(obuf, sizeof obuf, "Content-Type: text/plain; charset=%s", defcharset(e)); if (!putline(obuf, mci)) @@ -1907,7 +1802,6 @@ putheader(mci, hdr, e, flags) writeerr: return false; } - /* ** PUT_VANILLA_HEADER -- output a fairly ordinary header ** @@ -1931,10 +1825,10 @@ put_vanilla_header(h, v, mci) int putflags; char obuf[MAXLINE + 256]; /* additional length for h_field */ - putflags = PXLF_HEADER | PXLF_STRIPMQUOTE; + putflags = PXLF_HEADER; if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags)) putflags |= PXLF_STRIP8BIT; - (void) sm_snprintf(obuf, sizeof(obuf), "%.200s:", h->h_field); + (void) sm_snprintf(obuf, sizeof obuf, "%.200s: ", h->h_field); obp = obuf + strlen(obuf); while ((nlp = strchr(v, '\n')) != NULL) { @@ -1967,7 +1861,6 @@ put_vanilla_header(h, v, mci) writeerr: return false; } - /* ** COMMAIZE -- output a header field, making a comma-translated list. ** @@ -1982,7 +1875,7 @@ put_vanilla_header(h, v, mci) ** true iff header field was written successfully ** ** Side Effects: -** outputs "p" to "mci". +** outputs "p" to file "fp". */ bool @@ -1994,9 +1887,10 @@ commaize(h, p, oldstyle, mci, e) register ENVELOPE *e; { register char *obp; - int opos, omax, spaces; + int opos; + int omax; bool firstone = true; - int putflags = PXLF_HEADER | PXLF_STRIPMQUOTE; + int putflags = PXLF_HEADER; char **res; char obuf[MAXLINE + 3]; @@ -2006,44 +1900,20 @@ commaize(h, p, oldstyle, mci, e) */ if (tTd(14, 2)) - sm_dprintf("commaize(%s:%s)\n", h->h_field, p); + sm_dprintf("commaize(%s: %s)\n", h->h_field, p); if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags)) putflags |= PXLF_STRIP8BIT; obp = obuf; - (void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.200s:", h->h_field); - /* opos = strlen(obp); instead of the next 3 lines? */ - opos = strlen(h->h_field) + 1; - if (opos > 201) - opos = 201; - obp += opos; - - spaces = 0; - while (*p != '\0' && isascii(*p) && isspace(*p)) - { - ++spaces; - ++p; - } - if (spaces > 0) - { - SM_ASSERT(sizeof(obuf) > opos * 2); - - /* - ** Restrict number of spaces to half the length of buffer - ** so the header field body can be put in here too. - ** Note: this is a hack... - */ - - if (spaces > sizeof(obuf) / 2) - spaces = sizeof(obuf) / 2; - (void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%*s", spaces, - ""); - opos += spaces; - obp += spaces; - SM_ASSERT(obp < &obuf[MAXLINE]); - } + (void) sm_snprintf(obp, SPACELEFT(obuf, obp), "%.200s: ", + h->h_field); + /* opos = strlen(obp); */ + opos = strlen(h->h_field) + 2; + if (opos > 202) + opos = 202; + obp += opos; omax = mci->mci_mailer->m_linelimit - 2; if (omax < 0 || omax > 78) omax = 78; @@ -2079,7 +1949,7 @@ commaize(h, p, oldstyle, mci, e) char pvpbuf[PSBUFSIZE]; res = prescan(p, oldstyle ? ' ' : ',', pvpbuf, - sizeof(pvpbuf), &oldp, ExtTokenTab, false); + sizeof pvpbuf, &oldp, NULL, false); p = oldp; #if _FFR_IGNORE_BOGUS_ADDR /* ignore addresses that can't be parsed */ @@ -2157,7 +2027,7 @@ commaize(h, p, oldstyle, mci, e) if (!putxline(obuf, strlen(obuf), mci, putflags)) goto writeerr; obp = obuf; - (void) sm_strlcpy(obp, " ", sizeof(obuf)); + (void) sm_strlcpy(obp, " ", sizeof obuf); opos = strlen(obp); obp += opos; opos += strlen(name); @@ -2173,10 +2043,10 @@ commaize(h, p, oldstyle, mci, e) firstone = false; *p = savechar; } - if (obp < &obuf[sizeof(obuf)]) + if (obp < &obuf[sizeof obuf]) *obp = '\0'; else - obuf[sizeof(obuf) - 1] = '\0'; + obuf[sizeof obuf - 1] = '\0'; return putxline(obuf, strlen(obuf), mci, putflags); writeerr: @@ -2210,7 +2080,7 @@ copyheader(header, rpool) while (header != NULL) { - newhdr = (HDR *) sm_rpool_malloc_x(rpool, sizeof(*newhdr)); + newhdr = (HDR *) sm_rpool_malloc_x(rpool, sizeof *newhdr); STRUCTCOPY(*header, *newhdr); *tail = newhdr; tail = &newhdr->h_link; @@ -2220,7 +2090,6 @@ copyheader(header, rpool) return ret; } - /* ** FIX_MIME_HEADER -- possibly truncate/rebalance parameters in a MIME header ** diff --git a/contrib/sendmail/src/mailq.1 b/contrib/sendmail/src/mailq.1 index 62f123c..f67a9dd 100644 --- a/contrib/sendmail/src/mailq.1 +++ b/contrib/sendmail/src/mailq.1 @@ -1,4 +1,4 @@ -.\" Copyright (c) 1998-2000, 2002, 2007 Sendmail, Inc. and its suppliers. +.\" Copyright (c) 1998-2000, 2002 Sendmail, Inc. and its suppliers. .\" All rights reserved. .\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved. .\" Copyright (c) 1985, 1990, 1993 @@ -9,9 +9,9 @@ .\" the sendmail distribution. .\" .\" -.\" $Id: mailq.1,v 8.21 2007/03/22 18:21:27 ca Exp $ +.\" $Id: mailq.1,v 8.20 2002/06/27 22:47:34 gshapiro Exp $ .\" -.TH MAILQ 1 "$Date: 2007/03/22 18:21:27 $" +.TH MAILQ 1 "$Date: 2002/06/27 22:47:34 $" .SH NAME mailq \- print the mail queue @@ -104,25 +104,6 @@ and the name of the alias this command expanded from, if any. Moreover, status messages for each recipient are printed if available. .PP -Several sendmail.cf options influence the behavior of the -.B mailq -utility: -The number of items printed per queue group is restricted by -.B MaxQueueRunSize -if that value is set. -The status character -.B * -is not printed for some values of -.B QueueSortOrder, -e.g., -filename, -random, -modification, and -none, -unless a -.B -q -option is used to limit the processed jobs. -.PP The .B mailq utility exits 0 on success, and >0 if an error occurs. diff --git a/contrib/sendmail/src/mci.c b/contrib/sendmail/src/mci.c index ae33f66..1726379 100644 --- a/contrib/sendmail/src/mci.c +++ b/contrib/sendmail/src/mci.c @@ -9,11 +9,12 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * + * $FreeBSD$ */ #include <sendmail.h> -SM_RCSID("@(#)$Id: mci.c,v 8.218 2006/08/15 23:24:57 ca Exp $") +SM_RCSID("@(#)$Id: mci.c,v 8.217 2006/04/18 01:27:36 ca Exp $") #if NETINET || NETINET6 # include <arpa/inet.h> @@ -140,8 +141,8 @@ mci_scan(savemci) if (MciCache == NULL) { /* first call */ - MciCache = (MCI **) sm_pmalloc_x(MaxMciCache * sizeof(*MciCache)); - memset((char *) MciCache, '\0', MaxMciCache * sizeof(*MciCache)); + MciCache = (MCI **) sm_pmalloc_x(MaxMciCache * sizeof *MciCache); + memset((char *) MciCache, '\0', MaxMciCache * sizeof *MciCache); return &MciCache[0]; } @@ -309,7 +310,7 @@ mci_get(host, m) extern SOCKADDR CurHostAddr; /* clear CurHostAddr so we don't get a bogus address with this name */ - memset(&CurHostAddr, '\0', sizeof(CurHostAddr)); + memset(&CurHostAddr, '\0', sizeof CurHostAddr); /* clear out any expired connections */ (void) mci_scan(NULL); @@ -374,7 +375,7 @@ mci_get(host, m) { /* get peer host address */ /* (this should really be in the mci struct) */ - SOCKADDR_LEN_T socklen = sizeof(CurHostAddr); + SOCKADDR_LEN_T socklen = sizeof CurHostAddr; (void) getpeername(sm_io_getinfo(mci->mci_in, SM_IO_WHAT_FD, NULL), @@ -464,10 +465,10 @@ mci_new(rpool) register MCI *mci; if (rpool == NULL) - mci = (MCI *) sm_malloc_x(sizeof(*mci)); + mci = (MCI *) sm_malloc_x(sizeof *mci); else - mci = (MCI *) sm_rpool_malloc_x(rpool, sizeof(*mci)); - memset((char *) mci, '\0', sizeof(*mci)); + mci = (MCI *) sm_rpool_malloc_x(rpool, sizeof *mci); + memset((char *) mci, '\0', sizeof *mci); mci->mci_rpool = sm_rpool_new_x(NULL); mci->mci_macro.mac_rpool = mci->mci_rpool; return mci; @@ -726,7 +727,7 @@ mci_lock_host_statfile(mci) sm_dprintf("mci_lock_host: attempting to lock %s\n", mci->mci_host); - if (mci_generate_persistent_path(mci->mci_host, fname, sizeof(fname), + if (mci_generate_persistent_path(mci->mci_host, fname, sizeof fname, true) < 0) { /* of course this should never happen */ @@ -856,7 +857,7 @@ mci_load_persistent(mci) sm_dprintf("mci_load_persistent: Attempting to load persistent information for %s\n", mci->mci_host); - if (mci_generate_persistent_path(mci->mci_host, fname, sizeof(fname), + if (mci_generate_persistent_path(mci->mci_host, fname, sizeof fname, false) < 0) { /* Not much we can do if the file isn't there... */ @@ -945,7 +946,7 @@ mci_read_persistent(fp, mci) sm_io_rewind(fp, SM_TIME_DEFAULT); ver = -1; LineNumber = 0; - while (sm_io_fgets(fp, SM_TIME_DEFAULT, buf, sizeof(buf)) != NULL) + while (sm_io_fgets(fp, SM_TIME_DEFAULT, buf, sizeof buf) != NULL) { LineNumber++; p = strchr(buf, '\n'); @@ -1170,7 +1171,7 @@ mci_traverse_persistent(action, pathname) continue; (void) sm_strlcpy(newptr, e->d_name, - sizeof(newpath) - + sizeof newpath - (newptr - newpath)); if (StopRequest) @@ -1300,7 +1301,7 @@ mci_print_persistent(pathname, hostname) } FileName = pathname; - memset(&mcib, '\0', sizeof(mcib)); + memset(&mcib, '\0', sizeof mcib); if (mci_read_persistent(fp, &mcib) < 0) { syserr("%s: could not read status file", pathname); @@ -1332,7 +1333,7 @@ mci_print_persistent(pathname, hostname) { char buf[80]; - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Unknown mailer error %d", mcib.mci_exitstat); (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "%.*s\n", @@ -1479,12 +1480,12 @@ mci_generate_persistent_path(host, path, pathlen, createflag) return -1; /* make certain this is not a bracketed host number */ - if (strlen(host) > sizeof(t_host) - 1) + if (strlen(host) > sizeof t_host - 1) return -1; if (host[0] == '[') - (void) sm_strlcpy(t_host, host + 1, sizeof(t_host)); + (void) sm_strlcpy(t_host, host + 1, sizeof t_host); else - (void) sm_strlcpy(t_host, host, sizeof(t_host)); + (void) sm_strlcpy(t_host, host, sizeof t_host); /* ** Delete any trailing dots from the hostname. diff --git a/contrib/sendmail/src/savemail.c b/contrib/sendmail/src/savemail.c index cf72e8d..8010b31 100644 --- a/contrib/sendmail/src/savemail.c +++ b/contrib/sendmail/src/savemail.c @@ -9,11 +9,13 @@ * forth in the LICENSE file which can be found at the top level of * the sendmail distribution. * + * $FreeBSD$ + * */ #include <sendmail.h> -SM_RCSID("@(#)$Id: savemail.c,v 8.313 2006/11/29 00:20:41 ca Exp $") +SM_RCSID("@(#)$Id: savemail.c,v 8.308 2006/04/18 01:31:33 ca Exp $") static bool errbody __P((MCI *, ENVELOPE *, char *)); static bool pruneroute __P((char *)); @@ -193,7 +195,7 @@ savemail(e, sendbody) break; } - expand("\201n", buf, sizeof(buf), e); + expand("\201n", buf, sizeof buf, e); (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "\r\nMessage from %s...\r\n", buf); (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, @@ -204,7 +206,7 @@ savemail(e, sendbody) (void) sm_io_fprintf(smioout, SM_TIME_DEFAULT, "Transcript follows:\r\n"); while (sm_io_fgets(e->e_xfp, SM_TIME_DEFAULT, - buf, sizeof(buf)) != NULL && + buf, sizeof buf) != NULL && !sm_io_error(smioout)) (void) sm_io_fputs(smioout, SM_TIME_DEFAULT, @@ -251,7 +253,7 @@ savemail(e, sendbody) char from[TOBUFSIZE]; if (sm_strlcpy(from, e->e_from.q_paddr, - sizeof(from)) >= sizeof(from)) + sizeof from) >= sizeof from) { state = ESM_POSTMASTER; break; @@ -305,7 +307,7 @@ savemail(e, sendbody) */ q = NULL; - expand(DoubleBounceAddr, buf, sizeof(buf), e); + expand(DoubleBounceAddr, buf, sizeof buf, e); /* ** Just drop it on the floor if DoubleBounceAddr @@ -371,7 +373,7 @@ savemail(e, sendbody) p = macvalue('g', e); macdefine(&e->e_macro, A_PERM, 'g', e->e_sender); - expand("\201z/dead.letter", dlbuf, sizeof(dlbuf), e); + expand("\201z/dead.letter", dlbuf, sizeof dlbuf, e); sff = SFF_CREAT|SFF_REGONLY|SFF_RUNASREALUID; if (RealUid == 0) sff |= SFF_ROOTOK; @@ -422,7 +424,7 @@ savemail(e, sendbody) break; } - memset(&mcibuf, '\0', sizeof(mcibuf)); + memset(&mcibuf, '\0', sizeof mcibuf); mcibuf.mci_out = fp; mcibuf.mci_mailer = FileMailer; if (bitnset(M_7BITS, FileMailer->m_flags)) @@ -606,7 +608,7 @@ returntosender(msg, returnq, flags, e) ee->e_nrcpts++; if (q->q_alias == NULL) - addheader("To", q->q_paddr, 0, ee, true); + addheader("To", q->q_paddr, 0, ee); } if (LogLevel > 5) @@ -625,18 +627,18 @@ returntosender(msg, returnq, flags, e) if (SendMIMEErrors) { - addheader("MIME-Version", "1.0", 0, ee, true); - (void) sm_snprintf(buf, sizeof(buf), "%s.%ld/%.100s", + addheader("MIME-Version", "1.0", 0, ee); + (void) sm_snprintf(buf, sizeof buf, "%s.%ld/%.100s", ee->e_id, (long)curtime(), MyHostName); ee->e_msgboundary = sm_rpool_strdup_x(ee->e_rpool, buf); - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, #if DSN "multipart/report; report-type=delivery-status;\n\tboundary=\"%s\"", #else /* DSN */ "multipart/mixed; boundary=\"%s\"", #endif /* DSN */ ee->e_msgboundary); - addheader("Content-Type", buf, 0, ee, true); + addheader("Content-Type", buf, 0, ee); p = hvalue("Content-Transfer-Encoding", e->e_header); if (p != NULL && sm_strcasecmp(p, "binary") != 0) @@ -644,42 +646,42 @@ returntosender(msg, returnq, flags, e) if (p == NULL && bitset(EF_HAS8BIT, e->e_flags)) p = "8bit"; if (p != NULL) - addheader("Content-Transfer-Encoding", p, 0, ee, true); + addheader("Content-Transfer-Encoding", p, 0, ee); } if (strncmp(msg, "Warning:", 8) == 0) { - addheader("Subject", msg, 0, ee, true); + addheader("Subject", msg, 0, ee); p = "warning-timeout"; } else if (strncmp(msg, "Postmaster warning:", 19) == 0) { - addheader("Subject", msg, 0, ee, true); + addheader("Subject", msg, 0, ee); p = "postmaster-warning"; } else if (strcmp(msg, "Return receipt") == 0) { - addheader("Subject", msg, 0, ee, true); + addheader("Subject", msg, 0, ee); p = "return-receipt"; } else if (bitset(RTSF_PM_BOUNCE, flags)) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Postmaster notify: see transcript for details"); - addheader("Subject", buf, 0, ee, true); + addheader("Subject", buf, 0, ee); p = "postmaster-notification"; } else { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Returned mail: see transcript for details"); - addheader("Subject", buf, 0, ee, true); + addheader("Subject", buf, 0, ee); p = "failure"; } - (void) sm_snprintf(buf, sizeof(buf), "auto-generated (%s)", p); - addheader("Auto-Submitted", buf, 0, ee, true); + (void) sm_snprintf(buf, sizeof buf, "auto-generated (%s)", p); + addheader("Auto-Submitted", buf, 0, ee); /* fake up an address header for the from person */ - expand("\201n", buf, sizeof(buf), e); + expand("\201n", buf, sizeof buf, e); if (parseaddr(buf, &ee->e_from, RF_COPYALL|RF_SENDERADDR, '\0', NULL, e, false) == NULL) { @@ -776,7 +778,7 @@ errbody(mci, e, separator) if (e->e_msgboundary != NULL) { - (void) sm_strlcpyn(buf, sizeof(buf), 2, "--", e->e_msgboundary); + (void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); if (!putline("This is a MIME-encapsulated message", mci) || !putline("", mci) || !putline(buf, mci) || @@ -814,19 +816,19 @@ errbody(mci, e, separator) !putline("", mci)) goto writeerr; } - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "The original message was received at %s", arpadate(ctime(&e->e_parent->e_ctime))); if (!putline(buf, mci)) goto writeerr; - expand("from \201_", buf, sizeof(buf), e->e_parent); + expand("from \201_", buf, sizeof buf, e->e_parent); if (!putline(buf, mci)) goto writeerr; /* include id in postmaster copies */ if (pm_notify && e->e_parent->e_id != NULL) { - (void) sm_strlcpyn(buf, sizeof(buf), 2, "with id ", + (void) sm_strlcpyn(buf, sizeof buf, 2, "with id ", e->e_parent->e_id); if (!putline(buf, mci)) goto writeerr; @@ -854,19 +856,11 @@ errbody(mci, e, separator) if (xfile != NULL) { while (sm_io_fgets(xfile, SM_TIME_DEFAULT, buf, - sizeof(buf)) != NULL) + sizeof buf) != NULL) { - int lbs; - bool putok; - char *lbp; - - lbs = sizeof(buf); - lbp = translate_dollars(buf, buf, &lbs); - expand(lbp, lbp, lbs, e); - putok = putline(lbp, mci); - if (lbp != buf) - sm_free(lbp); - if (!putok) + translate_dollars(buf); + expand(buf, buf, sizeof buf, e); + if (!putline(buf, mci)) goto writeerr; } (void) sm_io_close(xfile, SM_TIME_DEFAULT); @@ -876,7 +870,7 @@ errbody(mci, e, separator) } else { - expand(ErrMsgFile, buf, sizeof(buf), e); + expand(ErrMsgFile, buf, sizeof buf, e); if (!putline(buf, mci) || !putline("", mci)) goto writeerr; } @@ -903,12 +897,12 @@ errbody(mci, e, separator) } (void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR), - sizeof(buf)); + sizeof buf); if (!putline(buf, mci)) goto writeerr; if (q->q_rstatus != NULL) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, " (reason: %s)", shortenstring(exitstat(q->q_rstatus), MAXSHORTSTR)); @@ -917,7 +911,7 @@ errbody(mci, e, separator) } if (q->q_alias != NULL) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, " (expanded from: %s)", shortenstring(q->q_alias->q_paddr, MAXSHORTSTR)); @@ -947,12 +941,12 @@ errbody(mci, e, separator) } (void) sm_strlcpy(buf, shortenstring(q->q_paddr, MAXSHORTSTR), - sizeof(buf)); + sizeof buf); if (!putline(buf, mci)) goto writeerr; if (q->q_alias != NULL) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, " (expanded from: %s)", shortenstring(q->q_alias->q_paddr, MAXSHORTSTR)); @@ -1000,13 +994,13 @@ errbody(mci, e, separator) printheader = false; } - (void) sm_snprintf(buf, sizeof(buf), "%s (%s)", + (void) sm_snprintf(buf, sizeof buf, "%s (%s)", shortenstring(q->q_paddr, MAXSHORTSTR), p); if (!putline(buf, mci)) goto writeerr; if (q->q_alias != NULL) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, " (expanded from: %s)", shortenstring(q->q_alias->q_paddr, MAXSHORTSTR)); @@ -1035,7 +1029,7 @@ errbody(mci, e, separator) if (e->e_xfp != NULL) (void) sm_io_flush(e->e_xfp, SM_TIME_DEFAULT); while (sm_io_fgets(e->e_parent->e_xfp, SM_TIME_DEFAULT, buf, - sizeof(buf)) != NULL) + sizeof buf) != NULL) { if (printheader && !putline(" ----- Transcript of session follows -----\n", mci)) @@ -1054,7 +1048,7 @@ errbody(mci, e, separator) if (e->e_msgboundary != NULL) { - (void) sm_strlcpyn(buf, sizeof(buf), 2, "--", e->e_msgboundary); + (void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); if (!putline("", mci) || !putline(buf, mci) || !putline("Content-Type: message/delivery-status", mci) || @@ -1068,7 +1062,7 @@ errbody(mci, e, separator) /* original envelope id from MAIL FROM: line */ if (e->e_parent->e_envid != NULL) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Original-Envelope-Id: %.800s", xuntextify(e->e_parent->e_envid)); if (!putline(buf, mci)) @@ -1076,7 +1070,7 @@ errbody(mci, e, separator) } /* Reporting-MTA: is us (required) */ - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Reporting-MTA: dns; %.800s", MyHostName); if (!putline(buf, mci)) goto writeerr; @@ -1090,7 +1084,7 @@ errbody(mci, e, separator) if (e->e_parent->e_from.q_mailer == NULL || (p = e->e_parent->e_from.q_mailer->m_mtatype) == NULL) p = "dns"; - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Received-From-MTA: %s; %.800s", p, RealHostName); if (!putline(buf, mci)) @@ -1098,7 +1092,7 @@ errbody(mci, e, separator) } /* Arrival-Date: -- when it arrived here */ - (void) sm_strlcpyn(buf, sizeof(buf), 2, "Arrival-Date: ", + (void) sm_strlcpyn(buf, sizeof buf, 2, "Arrival-Date: ", arpadate(ctime(&e->e_parent->e_ctime))); if (!putline(buf, mci)) goto writeerr; @@ -1109,7 +1103,7 @@ errbody(mci, e, separator) time_t dbyd; dbyd = e->e_parent->e_ctime + e->e_parent->e_deliver_by; - (void) sm_strlcpyn(buf, sizeof(buf), 2, + (void) sm_strlcpyn(buf, sizeof buf, 2, "Deliver-By-Date: ", arpadate(ctime(&dbyd))); if (!putline(buf, mci)) @@ -1162,7 +1156,7 @@ errbody(mci, e, separator) /* Original-Recipient: -- passed from on high */ if (q->q_orcpt != NULL) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Original-Recipient: %.800s", q->q_orcpt); if (!putline(buf, mci)) @@ -1183,7 +1177,7 @@ errbody(mci, e, separator) strchr(q->q_user, '@') == NULL) { (void) sm_snprintf(actual, - sizeof(actual), + sizeof actual, "%s; %.700s@%.100s", p, q->q_user, MyHostName); @@ -1191,7 +1185,7 @@ errbody(mci, e, separator) else { (void) sm_snprintf(actual, - sizeof(actual), + sizeof actual, "%s; %.800s", p, q->q_user); } @@ -1212,7 +1206,7 @@ errbody(mci, e, separator) if (q->q_finalrcpt != NULL) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Final-Recipient: %s", q->q_finalrcpt); if (!putline(buf, mci)) @@ -1222,10 +1216,12 @@ errbody(mci, e, separator) /* X-Actual-Recipient: -- the real problem address */ if (actual[0] != '\0' && q->q_finalrcpt != NULL && +#if _FFR_PRIV_NOACTUALRECIPIENT !bitset(PRIV_NOACTUALRECIPIENT, PrivacyFlags) && +#endif /* _FFR_PRIV_NOACTUALRECIPIENT */ strcmp(actual, q->q_finalrcpt) != 0) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "X-Actual-Recipient: %s", actual); if (!putline(buf, mci)) @@ -1233,7 +1229,7 @@ errbody(mci, e, separator) } /* Action: -- what happened? */ - (void) sm_strlcpyn(buf, sizeof(buf), 2, "Action: ", + (void) sm_strlcpyn(buf, sizeof buf, 2, "Action: ", action); if (!putline(buf, mci)) goto writeerr; @@ -1247,7 +1243,7 @@ errbody(mci, e, separator) p = "4.0.0"; else p = "2.0.0"; - (void) sm_strlcpyn(buf, sizeof(buf), 2, "Status: ", p); + (void) sm_strlcpyn(buf, sizeof buf, 2, "Status: ", p); if (!putline(buf, mci)) goto writeerr; @@ -1257,7 +1253,7 @@ errbody(mci, e, separator) if (q->q_mailer == NULL || (p = q->q_mailer->m_mtatype) == NULL) p = "dns"; - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Remote-MTA: %s; %.800s", p, q->q_statmta); p = &buf[strlen(buf) - 1]; @@ -1273,7 +1269,7 @@ errbody(mci, e, separator) if (q->q_mailer == NULL || (p = q->q_mailer->m_diagtype) == NULL) p = "smtp"; - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Diagnostic-Code: %s; %.800s", p, q->q_rstatus); if (!putline(buf, mci)) @@ -1283,7 +1279,7 @@ errbody(mci, e, separator) /* Last-Attempt-Date: -- fine granularity */ if (q->q_statdate == (time_t) 0L) q->q_statdate = curtime(); - (void) sm_strlcpyn(buf, sizeof(buf), 2, + (void) sm_strlcpyn(buf, sizeof buf, 2, "Last-Attempt-Date: ", arpadate(ctime(&q->q_statdate))); if (!putline(buf, mci)) @@ -1296,7 +1292,7 @@ errbody(mci, e, separator) xdate = e->e_parent->e_ctime + TimeOuts.to_q_return[e->e_parent->e_timeoutclass]; - (void) sm_strlcpyn(buf, sizeof(buf), 2, + (void) sm_strlcpyn(buf, sizeof buf, 2, "Will-Retry-Until: ", arpadate(ctime(&xdate))); if (!putline(buf, mci)) @@ -1330,12 +1326,12 @@ errbody(mci, e, separator) } else { - (void) sm_strlcpyn(buf, sizeof(buf), 2, "--", + (void) sm_strlcpyn(buf, sizeof buf, 2, "--", e->e_msgboundary); if (!putline(buf, mci)) goto writeerr; - (void) sm_strlcpyn(buf, sizeof(buf), 2, "Content-Type: ", + (void) sm_strlcpyn(buf, sizeof buf, 2, "Content-Type: ", sendbody ? "message/rfc822" : "text/rfc822-headers"); if (!putline(buf, mci)) @@ -1350,7 +1346,7 @@ errbody(mci, e, separator) p = "8bit"; if (p != NULL) { - (void) sm_snprintf(buf, sizeof(buf), + (void) sm_snprintf(buf, sizeof buf, "Content-Transfer-Encoding: %s", p); if (!putline(buf, mci)) @@ -1387,7 +1383,7 @@ errbody(mci, e, separator) if (e->e_msgboundary != NULL) { - (void) sm_strlcpyn(buf, sizeof(buf), 3, "--", e->e_msgboundary, + (void) sm_strlcpyn(buf, sizeof buf, 3, "--", e->e_msgboundary, "--"); if (!putline("", mci) || !putline(buf, mci)) goto writeerr; @@ -1731,9 +1727,9 @@ pruneroute(addr) /* slice off the angle brackets */ i = strlen(at + 1); - if (i >= sizeof(hostbuf)) + if (i >= sizeof hostbuf) return false; - (void) sm_strlcpy(hostbuf, at + 1, sizeof(hostbuf)); + (void) sm_strlcpy(hostbuf, at + 1, sizeof hostbuf); hostbuf[i - 1] = '\0'; while (start != NULL) @@ -1749,8 +1745,8 @@ pruneroute(addr) *start = '\0'; comma = strrchr(addr, ','); if (comma != NULL && comma[1] == '@' && - strlen(comma + 2) < sizeof(hostbuf)) - (void) sm_strlcpy(hostbuf, comma + 2, sizeof(hostbuf)); + strlen(comma + 2) < sizeof hostbuf) + (void) sm_strlcpy(hostbuf, comma + 2, sizeof hostbuf); else comma = NULL; *start = c; diff --git a/contrib/sendmail/src/sendmail.8 b/contrib/sendmail/src/sendmail.8 index 2d0284a..65d37b0 100644 --- a/contrib/sendmail/src/sendmail.8 +++ b/contrib/sendmail/src/sendmail.8 @@ -724,13 +724,13 @@ collected statistics /var/spool/mqueue/* temp files .SH SEE ALSO -binmail(1), mail(1), -rmail(1), syslog(3), aliases(5), mailaddr(7), -rc(8) +mail.local(8), +rc(8), +rmail(8) .PP DARPA Internet Request For Comments @@ -746,3 +746,4 @@ The .B sendmail command appeared in 4.2BSD. +.\" $FreeBSD$ |