diff options
author | peter <peter@FreeBSD.org> | 1996-11-18 02:26:51 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1996-11-18 02:26:51 +0000 |
commit | d1f326f919cfeed28aba424b3bdf5d1d7a3bc542 (patch) | |
tree | f35815a60213916a6220b468e15370ffdb6565e6 /usr.sbin/sendmail/src | |
parent | d0b885b70751285b48b2bf2f8c6c4e726bab8abc (diff) | |
parent | 8e0d5faaa77159b266e4ab922edf43a79f52e0c0 (diff) | |
download | FreeBSD-src-d1f326f919cfeed28aba424b3bdf5d1d7a3bc542.zip FreeBSD-src-d1f326f919cfeed28aba424b3bdf5d1d7a3bc542.tar.gz |
This commit was generated by cvs2svn to compensate for changes in r19841,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'usr.sbin/sendmail/src')
-rw-r--r-- | usr.sbin/sendmail/src/READ_ME | 37 | ||||
-rw-r--r-- | usr.sbin/sendmail/src/envelope.c | 24 | ||||
-rw-r--r-- | usr.sbin/sendmail/src/map.c | 36 | ||||
-rw-r--r-- | usr.sbin/sendmail/src/mci.c | 53 | ||||
-rw-r--r-- | usr.sbin/sendmail/src/queue.c | 131 | ||||
-rw-r--r-- | usr.sbin/sendmail/src/version.c | 4 |
6 files changed, 194 insertions, 91 deletions
diff --git a/usr.sbin/sendmail/src/READ_ME b/usr.sbin/sendmail/src/READ_ME index 779f828..afeac1b 100644 --- a/usr.sbin/sendmail/src/READ_ME +++ b/usr.sbin/sendmail/src/READ_ME @@ -30,7 +30,7 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # -# @(#)READ_ME 8.125 (Berkeley) 10/18/96 +# @(#)READ_ME 8.130 (Berkeley) 11/10/96 # This directory contains the source files for sendmail. @@ -168,7 +168,7 @@ LDAPMAP Lightweight Directory Lookup Protocol support. You will this flag. >>> NOTE WELL for NEWDB support: it is CRITICAL that you remove ndbm.o ->>> from libdb.a and ndbm.h from the appropriate include directories if +>>> from libdb.a before you install it and DO NOT install ndbm.h if >>> you want to get ndbm support. If you don't delete these, there is >>> absolutely no point to including -DNDBM, since it will just get you >>> another (inferior) API to the same format database. These files @@ -355,11 +355,20 @@ LA_TYPE The type of load average your kernel supports. These the dg_sys_info system call. LA_HPUX (10) is an HP-UX specific version that uses the pstat_getdynamic system call. + LA_IRIX6 (11) is an IRIX 6.x specific version that adapts + to 32 or 64 bit kernels; it is otherwise very similar + to LA_INT. + LA_KSTAT (12) uses the (Solaris-specific) kstat(3k) + implementation. + LA_DEVSHORT (13) reads a short from a system file (default: + /dev/table/avenrun) and scales it in the same manner + as LA_SHORT. LA_INT, LA_SHORT, LA_FLOAT, and LA_READKSYM have several other parameters that they try to divine: the name of your kernel, the name of the variable in the kernel to examine, the number of bits of precision in a fixed point load average, - and so forth. + and so forth. LA_DEVSHORT uses _PATH_AVENRUN to find the + device to be read to find the load average. In desperation, use LA_ZERO. The actual code is in conf.c -- it can be tweaked if you are brave. FSHIFT For LA_INT, LA_SHORT, and LA_READKSYM, this is the number @@ -809,6 +818,26 @@ IRIX the developers' option in order to get the necessary include files. + If you compile with -lmalloc (the fast memory allocator), you may + get warning messages such as the following: + + ld32: WARNING 85: definition of _calloc in /usr/lib32/libmalloc.so + preempts that definition in /usr/lib32/mips3/libc.so. + ld32: WARNING 85: definition of _malloc in /usr/lib32/libmalloc.so + preempts that definition in /usr/lib32/mips3/libc.so. + ld32: WARNING 85: definition of _realloc in /usr/lib32/libmalloc.so + preempts that definition in /usr/lib32/mips3/libc.so. + ld32: WARNING 85: definition of _free in /usr/lib32/libmalloc.so + preempts that definition in /usr/lib32/mips3/libc.so. + ld32: WARNING 85: definition of _cfree in /usr/lib32/libmalloc.so + preempts that definition in /usr/lib32/mips3/libc.so. + + These are unavoidable and innocuous -- just ignore them. + + According to Dave Sill <de5@ornl.gov>, there is a version of the + Berkeley db library patched to run on Irix 6.2 available from + http://reality.sgi.com/ariel/db-1.85-irix.tar.Z . + NeXT or NEXTSTEP NEXTSTEP 3.3 and earlier ship with the old DBM library. You will need to acquire the new Berkeley DB from ftp.cs.berkeley.edu. @@ -1348,4 +1377,4 @@ version.c The version number and information about this Eric Allman -(Version 8.125, last update 10/18/96 07:32:40) +(Version 8.130, last update 11/10/96 11:15:30) diff --git a/usr.sbin/sendmail/src/envelope.c b/usr.sbin/sendmail/src/envelope.c index 66b9773..80e5ce6 100644 --- a/usr.sbin/sendmail/src/envelope.c +++ b/usr.sbin/sendmail/src/envelope.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)envelope.c 8.93 (Berkeley) 9/26/96"; +static char sccsid[] = "@(#)envelope.c 8.96 (Berkeley) 11/11/96"; #endif /* not lint */ #include "sendmail.h" @@ -153,9 +153,24 @@ dropenvelope(e, fulldrop) e->e_flags &= ~EF_QUEUERUN; for (q = e->e_sendqueue; q != NULL; q = q->q_next) { - if (!bitset(QBADADDR|QDONTSEND|QSENT, q->q_flags) || - bitset(QQUEUEUP, q->q_flags)) + if (bitset(QQUEUEUP, q->q_flags) && + bitset(QDONTSEND, q->q_flags)) + { + /* I'm not sure how this happens..... */ + if (tTd(50, 2)) + { + printf("Bogus flags: "); + printaddr(q, FALSE); + } + q->q_flags &= ~QDONTSEND; + } + if (!bitset(QBADADDR|QDONTSEND|QSENT, q->q_flags)) queueit = TRUE; +#if XDEBUG + else if (bitset(QQUEUEUP, q->q_flags)) + syslog(LOG_DEBUG, "%s: q_flags = %x", + e->e_id, q->q_flags); +#endif /* see if a notification is needed */ if (bitset(QPINGONFAILURE, q->q_flags) && @@ -203,8 +218,7 @@ dropenvelope(e, fulldrop) fprintf(e->e_xfp, "Message will be deleted from queue\n"); for (q = e->e_sendqueue; q != NULL; q = q->q_next) { - if (bitset(QQUEUEUP, q->q_flags) || - !bitset(QBADADDR|QDONTSEND|QSENT, q->q_flags)) + if (!bitset(QBADADDR|QDONTSEND|QSENT, q->q_flags)) { q->q_flags |= QBADADDR; q->q_status = "4.4.7"; diff --git a/usr.sbin/sendmail/src/map.c b/usr.sbin/sendmail/src/map.c index 796e472..34e6fce 100644 --- a/usr.sbin/sendmail/src/map.c +++ b/usr.sbin/sendmail/src/map.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)map.c 8.140 (Berkeley) 10/12/96"; +static char sccsid[] = "@(#)map.c 8.144 (Berkeley) 11/16/96"; #endif /* not lint */ #include "sendmail.h" @@ -107,7 +107,7 @@ static char sccsid[] = "@(#)map.c 8.140 (Berkeley) 10/12/96"; extern bool aliaswait __P((MAP *, char *, int)); extern bool extract_canonname __P((char *, char *, char[], int)); -#if defined(O_EXLOCK) && HASFLOCK +#if O_EXLOCK && HASFLOCK # define LOCK_ON_OPEN 1 /* we can open/create a locked file */ #else # define LOCK_ON_OPEN 0 /* no such luck -- bend over backwards */ @@ -690,6 +690,8 @@ extract_canonname(name, line, cbuf, cbuflen) p = get_column(line, i, '\0', nbuf, sizeof nbuf); if (p == NULL) break; + if (*p == '\0') + continue; if (cbuf[0] == '\0' || (strchr(cbuf, '.') == NULL && strchr(p, '.') != NULL)) { @@ -1034,17 +1036,30 @@ ndbm_map_close(map) ** be pokey about it. That's hard to do. */ -extern bool db_map_open __P((MAP *, int, DBTYPE)); +extern bool db_map_open __P((MAP *, int, DBTYPE, const void *)); + +/* these should be K line arguments */ +#ifndef DB_CACHE_SIZE +# define DB_CACHE_SIZE (1024 * 1024) /* database memory cache size */ +#endif +#ifndef DB_HASH_NELEM +# define DB_HASH_NELEM 4096 /* (starting) size of hash table */ +#endif bool bt_map_open(map, mode) MAP *map; int mode; { + BTREEINFO btinfo; + if (tTd(38, 2)) printf("bt_map_open(%s, %s, %d)\n", map->map_mname, map->map_file, mode); - return db_map_open(map, mode, DB_BTREE); + + bzero(&btinfo, sizeof btinfo); + btinfo.cachesize = DB_CACHE_SIZE; + return db_map_open(map, mode, DB_BTREE, &btinfo); } bool @@ -1052,17 +1067,24 @@ hash_map_open(map, mode) MAP *map; int mode; { + HASHINFO hinfo; + if (tTd(38, 2)) printf("hash_map_open(%s, %s, %d)\n", map->map_mname, map->map_file, mode); - return db_map_open(map, mode, DB_HASH); + + bzero(&hinfo, sizeof hinfo); + hinfo.nelem = DB_HASH_NELEM; + hinfo.cachesize = DB_CACHE_SIZE; + return db_map_open(map, mode, DB_HASH, &hinfo); } bool -db_map_open(map, mode, dbtype) +db_map_open(map, mode, dbtype, openinfo) MAP *map; int mode; DBTYPE dbtype; + const void *openinfo; { DB *db; int i; @@ -1113,7 +1135,7 @@ db_map_open(map, mode, dbtype) omode |= O_TRUNC; #endif - db = dbopen(buf, omode, DBMMODE, dbtype, NULL); + db = dbopen(buf, omode, DBMMODE, dbtype, openinfo); saveerrno = errno; #if !LOCK_ON_OPEN diff --git a/usr.sbin/sendmail/src/mci.c b/usr.sbin/sendmail/src/mci.c index f901ea8..18e951a 100644 --- a/usr.sbin/sendmail/src/mci.c +++ b/usr.sbin/sendmail/src/mci.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)mci.c 8.44 (Berkeley) 10/9/96"; +static char sccsid[] = "@(#)mci.c 8.46 (Berkeley) 11/3/96"; #endif /* not lint */ #include "sendmail.h" @@ -362,6 +362,7 @@ mci_get(host, m) ** ** Parameters: ** mci -- the MCI structure to set. +** xstat -- the exit status code. ** dstat -- the DSN status code. ** rstat -- the SMTP status code. ** @@ -370,18 +371,19 @@ mci_get(host, m) */ void -mci_setstat(mci, dstat, rstat) +mci_setstat(mci, xstat, dstat, rstat) MCI *mci; + int xstat; char *dstat; char *rstat; { + mci->mci_exitstat = xstat; mci->mci_status = dstat; + if (mci->mci_rstatus != NULL) + free(mci->mci_rstatus); if (rstat != NULL) - { - if (mci->mci_rstatus != NULL) - free(mci->mci_rstatus); - mci->mci_rstatus = newstr(rstat); - } + rstat = newstr(rstat); + mci->mci_rstatus = rstat; } /* ** MCI_DUMP -- dump the contents of an MCI structure. @@ -1032,6 +1034,7 @@ mci_print_persistent(pathname, hostname) int status; int width = Verbose ? 78 : 25; bool locked; + char *p; MCI mcib; if (!initflag) @@ -1061,16 +1064,34 @@ mci_print_persistent(pathname, hostname) locked = !lockfile(fileno(fp), pathname, "", LOCK_EX|LOCK_NB); fclose(fp); - if (mcib.mci_rstatus == NULL) - printf("%c%-39s %12s %.*s\n", - locked ? '*' : ' ', hostname, - pintvl(curtime() - mcib.mci_lastuse, TRUE), - width, errstring(mcib.mci_errno)); + printf("%c%-39s %12s ", + locked ? '*' : ' ', hostname, + pintvl(curtime() - mcib.mci_lastuse, TRUE)); + if (mcib.mci_rstatus != NULL) + printf("%.*s\n", width, mcib.mci_rstatus); + else if (mcib.mci_exitstat == EX_TEMPFAIL && mcib.mci_errno != 0) + printf("Deferred: %.*s\n", width - 10, errstring(mcib.mci_errno)); + else if (mcib.mci_exitstat != 0) + { + int i = mcib.mci_exitstat - EX__BASE; + extern int N_SysEx; + extern char *SysExMsg[]; + + if (i < 0 || i > N_SysEx) + { + char buf[80]; + + snprintf(buf, sizeof buf, "Unknown mailer error %d", + mcib.mci_exitstat); + printf("%.*s\n", width, buf); + } + else + printf("%.*s\n", width, &(SysExMsg[i])[5]); + } + else if (mcib.mci_errno == 0) + printf("OK\n"); else - printf("%c%-39s %12s %.*s\n", - locked ? '*' : ' ', hostname, - pintvl(curtime() - mcib.mci_lastuse, TRUE), - width, mcib.mci_rstatus); + printf("OK: %.*s\n", width - 4, errstring(mcib.mci_errno)); return 0; } diff --git a/usr.sbin/sendmail/src/queue.c b/usr.sbin/sendmail/src/queue.c index 75263b7..299a016 100644 --- a/usr.sbin/sendmail/src/queue.c +++ b/usr.sbin/sendmail/src/queue.c @@ -36,9 +36,9 @@ #ifndef lint #ifdef QUEUE -static char sccsid[] = "@(#)queue.c 8.125 (Berkeley) 10/12/96 (with queueing)"; +static char sccsid[] = "@(#)queue.c 8.131 (Berkeley) 11/8/96 (with queueing)"; #else -static char sccsid[] = "@(#)queue.c 8.125 (Berkeley) 10/12/96 (without queueing)"; +static char sccsid[] = "@(#)queue.c 8.131 (Berkeley) 11/8/96 (without queueing)"; #endif #endif /* not lint */ @@ -296,40 +296,45 @@ queueup(e, announce) printctladdr(NULL, NULL); for (q = e->e_sendqueue; q != NULL; q = q->q_next) { - if (bitset(QQUEUEUP, q->q_flags) || - !bitset(QDONTSEND|QBADADDR|QSENT, q->q_flags)) + if (bitset(QDONTSEND|QBADADDR|QSENT, q->q_flags)) { - printctladdr(q, tfp); - if (q->q_orcpt != NULL) - fprintf(tfp, "Q%s\n", - denlstring(q->q_orcpt, TRUE, FALSE)); - putc('R', tfp); - if (bitset(QPRIMARY, q->q_flags)) - putc('P', tfp); - if (bitset(QHASNOTIFY, q->q_flags)) - putc('N', tfp); - if (bitset(QPINGONSUCCESS, q->q_flags)) - putc('S', tfp); - if (bitset(QPINGONFAILURE, q->q_flags)) - putc('F', tfp); - if (bitset(QPINGONDELAY, q->q_flags)) - putc('D', tfp); - putc(':', tfp); - fprintf(tfp, "%s\n", denlstring(q->q_paddr, TRUE, FALSE)); - if (announce) - { - e->e_to = q->q_paddr; - message("queued"); - if (LogLevel > 8) - logdelivery(q->q_mailer, NULL, "queued", - NULL, (time_t) 0, e); - e->e_to = NULL; - } - if (tTd(40, 1)) - { - printf("queueing "); - printaddr(q, FALSE); - } +#if XDEBUG + if (bitset(QQUEUEUP, q->q_flags)) + syslog(LOG_DEBUG, "%s: q_flags = %x", + e->e_id, q->q_flags); +#endif + continue; + } + printctladdr(q, tfp); + if (q->q_orcpt != NULL) + fprintf(tfp, "Q%s\n", + denlstring(q->q_orcpt, TRUE, FALSE)); + putc('R', tfp); + if (bitset(QPRIMARY, q->q_flags)) + putc('P', tfp); + if (bitset(QHASNOTIFY, q->q_flags)) + putc('N', tfp); + if (bitset(QPINGONSUCCESS, q->q_flags)) + putc('S', tfp); + if (bitset(QPINGONFAILURE, q->q_flags)) + putc('F', tfp); + if (bitset(QPINGONDELAY, q->q_flags)) + putc('D', tfp); + putc(':', tfp); + fprintf(tfp, "%s\n", denlstring(q->q_paddr, TRUE, FALSE)); + if (announce) + { + e->e_to = q->q_paddr; + message("queued"); + if (LogLevel > 8) + logdelivery(q->q_mailer, NULL, "queued", + NULL, (time_t) 0, e); + e->e_to = NULL; + } + if (tTd(40, 1)) + { + printf("queueing "); + printaddr(q, FALSE); } } @@ -574,7 +579,7 @@ runqueue(forkflag) if (forkflag) { - int pid; + pid_t pid; extern void intsig(); #ifdef SIGCHLD extern void reapchild(); @@ -625,6 +630,15 @@ runqueue(forkflag) /* force it to run expensive jobs */ NoConnect = FALSE; + /* drop privileges */ + if (geteuid() == (uid_t) 0) + { + if (RunAsGid != (gid_t) 0) + (void) setgid(RunAsGid); + if (RunAsUid != (uid_t) 0) + (void) setuid(RunAsUid); + } + /* ** Create ourselves an envelope */ @@ -1387,6 +1401,7 @@ readqf(e) struct stat st; char *bp; int qfver = 0; + long hdrsize = 0; register char *p; char *orcpt = NULL; bool nomore = FALSE; @@ -1579,6 +1594,7 @@ readqf(e) case 'H': /* header */ (void) chompheader(&bp[1], FALSE, NULL, e); + hdrsize += strlen(&bp[1]); break; case 'M': /* message */ @@ -1611,6 +1627,26 @@ readqf(e) case 'N': /* number of delivery attempts */ e->e_ntries = atoi(&buf[1]); + + /* if this has been tried recently, let it be */ + if (e->e_ntries > 0 && + (curtime() - e->e_dtime) < MinQueueAge) + { + char *howlong = pintvl(curtime() - e->e_dtime, TRUE); + extern void unlockqueue(); + + if (Verbose || tTd(40, 8)) + printf("%s: too young (%s)\n", + e->e_id, howlong); +#ifdef LOG + if (LogLevel > 19) + syslog(LOG_DEBUG, "%s: too young (%s)", + e->e_id, howlong); +#endif + e->e_id = NULL; + unlockqueue(e); + return FALSE; + } break; case 'P': /* message priority */ @@ -1694,25 +1730,6 @@ readqf(e) return TRUE; } - /* if this has been tried recently, let it be */ - if (e->e_ntries > 0 && (curtime() - e->e_dtime) < MinQueueAge) - { - char *howlong = pintvl(curtime() - e->e_dtime, TRUE); - extern void unlockqueue(); - - if (Verbose || tTd(40, 8)) - printf("%s: too young (%s)\n", - e->e_id, howlong); -#ifdef LOG - if (LogLevel > 19) - syslog(LOG_DEBUG, "%s: too young (%s)", - e->e_id, howlong); -#endif - e->e_id = NULL; - unlockqueue(e); - return FALSE; - } - /* ** Arrange to read the data file. */ @@ -1728,7 +1745,7 @@ readqf(e) e->e_flags |= EF_HAS_DF; if (fstat(fileno(e->e_dfp), &st) >= 0) { - e->e_msgsize = st.st_size; + e->e_msgsize = st.st_size + hdrsize; e->e_dfdev = st.st_dev; e->e_dfino = st.st_ino; } @@ -1971,7 +1988,7 @@ queuename(e, type) register ENVELOPE *e; int type; { - static int pid = -1; + static pid_t pid = -1; static char c0; static char c1; static char c2; diff --git a/usr.sbin/sendmail/src/version.c b/usr.sbin/sendmail/src/version.c index 7544a9a..8a53f29 100644 --- a/usr.sbin/sendmail/src/version.c +++ b/usr.sbin/sendmail/src/version.c @@ -33,7 +33,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)version.c 8.8.2.1 (Berkeley) 10/18/96"; +static char sccsid[] = "@(#)version.c 8.8.3.2 (Berkeley) 11/16/96"; #endif /* not lint */ -char Version[] = "8.8.2"; +char Version[] = "8.8.3"; |