diff -u -r zmailer-2.99.41/BUGS zmailer-2.99.42/BUGS --- zmailer-2.99.41/BUGS Mon Nov 11 19:45:22 1996 +++ zmailer-2.99.42/BUGS Tue Nov 12 20:46:15 1996 @@ -41,14 +41,14 @@ (sendmail-8.8.x has/will get LDAP) - 'channel error' detection is partial at places; - transporters: sm, hold, errormail + transporters: hold, errormail - multi-level subdirectories for the transport, and possibly for the queue -- and of course /var/mail/x/x/x/username -mailboxes. Now having thousands of mailboxes in same directory does mean helluva slow access speeds.. (and same with transports directory) (scheduler uses one to three level hashes, however MAILBOX - does not do it yet -- 11-Nov-96) + does not do it yet in any generic way -- 11-Nov-96) - router/rfc822.c: sequencer() Consider providing some data/function/whatever telling to @@ -81,28 +81,6 @@ Fixed on SMTP, must fix on MAILBOX, and SM! (4-Jan-95) (Prepared to do it, however only on SMTP it is fatal -- I think..) -- "error" -channel uses MIMEoid message wrapping, and should consider - seriously (let user to configure) what to "Cc:" to postmaster. - Some say the Postmaster should not get error message's body.. - (Error channel appears partly inside(!) the codes of 'router' - (in the rfc822.c), and 'scheduler' (in the msgerror.c), and partly - as an external program transports/errormail/errormail.c) - - IETF has a NOTARY-wg whose charter is to standardize Delivery Status - Notification reporting. For a copy of specs drafts, see: - doc/draft-ietf-notary-* - On 940829 the system has IETF-NOTARY support on SMTP, MAILBOX, and - ERRORMAIL channels. Others (SM, HOLD?) will follow someday... - - Finetunings are needed on returned codes. ALPHA quality ? - (router/rfc822.c DOES NOT (yet) follow IETF-NOTARY format!) - - NOTARY demands, that "Rcpt:" entry on the returned message MUST - contain FQDN address. Plain userid is not enough.. (BUG!) - - *** 9412: ERROR HANDLING NEEDS TO BE UPGRADED INTO THE NEW IETF DRAFTS *** - - - Configuration files, esp. cf/aliases.cf has controversy in it. Many people think it is broken (I tend to agree) - 940614/mea @@ -127,8 +105,10 @@ Also: What to do when there are more incoming SMTP sessions than the process can have open file descriptors ? Two for each way of SMTP (for stdio library!) channel, one for each spool file in active use at the - input phase, and one for log. (Ok, stdio must do with one fd, but - it may want to have separate buffers for output, and input..) + input phase, and one for log. (The stdio is used only for SMTP responses, + and for spooling out the accumulated message. Thus there SHOULD be enough + resources for all uses -- except when the system runs out of FDs per any + individual process..) - Alias processing by "newaliases" (printaliases: run_praliases) is "interesting" -- if sysadm wants to add an alias like: diff -u -r zmailer-2.99.41/ChangeLog zmailer-2.99.42/ChangeLog --- zmailer-2.99.41/ChangeLog Mon Nov 11 21:52:37 1996 +++ zmailer-2.99.42/ChangeLog Wed Nov 13 16:56:46 1996 @@ -1,3 +1,34 @@ +Wed Nov 13 16:48:00 1996 Matti Aarnio + + * proto/cf/aliases.cf: + Aargh... quotation-rules on ZMSH are "a bit" different + from SH, and I keep forgetting it. Everything broke + when I added some newlines here & there... Now added + '\' (back-slashes) to cover them. + + * utils/makendbm/makendbm.c, utils/makendbm/ndbmlook.c: + Got rid of the need for some referred things, uses + strerror() instead. + + * transports/mailbox/mailbox.c, libc/mail.c, scheduler/msgerror.c: + Use fsync() when finishing off the write to the mailbox/file. + + * transports/libta/ctlopen.c: + Initialize notifyflgs properly for the case that no + NOTIFY parameter is present (assume: FAILURE) + + * transports/errormail/errormail.c: + If no reports sent, generate still OKs for each non- + generated report.. + + * transports/sm/sm.c: + Handle "channel error" at the sender.. + +Tue Nov 12 17:47:34 1996 Matti Aarnio + + * config.h.in, configure.in: + Test for fsync() at the system. + Mon Nov 11 18:56:21 1996 Matti Aarnio * Makefile.in: @@ -16,6 +47,8 @@ * include/ta.h, transports/libta/skip821address.c, scheduler/scheduler.c, transports/libta/ctlopen.c: Declare and use skip821address() -routine. + Enables to have embedded spaces in 'host', and in 'user' + parts of the parameter line. * lib/loginit.c, router/router.c, scheduler/scheduler.c: "Name-space pollution" -- "log" is reserved name, diff -u -r zmailer-2.99.41/Makefile.in zmailer-2.99.42/Makefile.in diff -u -r zmailer-2.99.41/Overview zmailer-2.99.42/Overview --- zmailer-2.99.41/Overview Thu Jul 25 13:54:34 1996 +++ zmailer-2.99.42/Overview Tue Nov 12 20:28:33 1996 @@ -84,6 +84,25 @@ The speed is actually dominated by the speed the scheduler can assimilate information from new entries. + Newer versions tested for burst performance on my workstation + with Linux-2.1.7 kernel, AHA2940 controller, PPro-200, 64 M RAM, + and multiple partitions on Seagate ST15230N disk (suboptimal for + performance) gives following numbers: + - Submitting 1000 messages into router without anything + else running in the system: 70 seconds (SH script forking + off for each submission) + - Routeing those messages from cold-started router: 42 secs + (with ONE router) + - Getting them scanned into the scheduler: 8 seconds + - Running deliveries with fsync() at every possible occasion + into my own mailbox: 30 seconds ( ==> 2-3 M deliveries + per 24h ) + Running it with all subsystems active goes in about 90 seconds + thru submitting, routeing and delivering with system load-average + raising only to 1.1 ... The speed was (acoustically) dominated + by disk-IO along with IPC thru a socketpair(). + + The ZMailer is used on various multi-domain machines, including ones running Internet, ( and BITNET, and/or UUCP ). diff -u -r zmailer-2.99.41/config.h.in zmailer-2.99.42/config.h.in --- zmailer-2.99.41/config.h.in Mon Nov 11 19:14:40 1996 +++ zmailer-2.99.42/config.h.in Tue Nov 12 17:46:52 1996 @@ -372,6 +372,7 @@ #undef HAVE_TCPD_H /* Mailbox things */ +#undef HAVE_FSYNC #undef HAVE_MAILLOCK_H #undef HAVE_DOTLOCK #undef HAVE_FLOCK diff -u -r zmailer-2.99.41/configure zmailer-2.99.42/configure --- zmailer-2.99.41/configure Mon Nov 11 22:35:05 1996 +++ zmailer-2.99.42/configure Tue Nov 12 18:56:24 1996 @@ -3803,7 +3803,7 @@ fi done -for ac_func in flock lockf lstat +for ac_func in flock lockf lstat fsync do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then diff -u -r zmailer-2.99.41/configure.in zmailer-2.99.42/configure.in --- zmailer-2.99.41/configure.in Mon Nov 11 22:32:49 1996 +++ zmailer-2.99.42/configure.in Tue Nov 12 17:47:16 1996 @@ -547,7 +547,7 @@ sys/statvfs.h sys/vfs.h sys/mount.h sys/filsys.h sys/fs_types.h) AC_CHECK_HEADERS(netinet/in.h sys/utsname.h maillock.h) AC_CHECK_HEADERS(varargs.h stdarg.h) -AC_CHECK_FUNCS(flock lockf lstat) +AC_CHECK_FUNCS(flock lockf lstat fsync) AC_SUBST(LIBMAIL) if test "x$ac_cv_func_maillock_lmail" = "x"; then if test "$ac_cv_header_maillock_h" = "yes" ; then diff -u -r zmailer-2.99.41/libc/mail.c zmailer-2.99.42/libc/mail.c --- zmailer-2.99.41/libc/mail.c Mon Nov 4 14:46:14 1996 +++ zmailer-2.99.42/libc/mail.c Tue Nov 12 17:51:52 1996 @@ -344,11 +344,11 @@ * on NFS mounted postoffices if you want to guarantee not losing * data without being told about it. */ - if (fflush(fp) == EOF -/* #ifdef NFSFSYNC */ /* This is propably ALWAYS a good idea */ + if (fflush(fp) != 0 +#ifdef HAVE_FSYNC || fsync(FILENO(fp)) < 0 -/* #endif */ /* NFSFSYNC */ - || fclose(fp) == EOF) { +#endif + || fclose(fp) != 0) { mail_free(message); errno = EIO; return -1; @@ -421,7 +421,7 @@ * it the hard way. */ - if (link(message, nmessage) < 0) { + if (link(message, nmessage) != 0) { eno = errno; fprintf(stderr, "link(\"%s\", \"%s\"): errno %d\n", message, nmessage, errno); @@ -477,9 +477,9 @@ * data without being told about it. */ if (fflush(fp) == EOF -/* #ifdef NFSFSYNC */ /* This is propably ALWAYS a good idea */ +#ifdef HAVE_FSYNC || fsync(FILENO(fp)) < 0 -/* #endif */ /* NFSFSYNC */ +#endif || fclose(fp) == EOF) { mail_free(message); errno = EIO; @@ -505,7 +505,7 @@ * it the hard way. */ - if (link(message, nmessage) < 0) { + if (link(message, nmessage) != 0) { eno = errno; fprintf(stderr, "link(\"%s\", \"%s\"): errno %d\n", message, nmessage, errno); diff -u -r zmailer-2.99.41/proto/cf/aliases.cf zmailer-2.99.42/proto/cf/aliases.cf --- zmailer-2.99.41/proto/cf/aliases.cf Thu Nov 7 22:21:30 1996 +++ zmailer-2.99.42/proto/cf/aliases.cf Wed Nov 13 16:38:08 1996 @@ -135,9 +135,9 @@ a="$(aliases "$user")" && db add expansions "$key" alias && priv=$(filepriv -M 644 $MAILVAR/db/aliases $(db owner aliases)) && - return $(echo "$a" | listaddresses -e root + return $(echo "$a" | listaddresses -e root \ -c 'alias expansion' | - maprrouter $(newattribute $attr privilege $priv) + maprrouter $(newattribute $attr privilege $priv) \ "$user" "$user") [ $didexpand ] || [ $PUNTHOST ] || @@ -168,10 +168,10 @@ # [ $didexpand ] || [ -f "$a" ] && # db add expansions "$key" list && # priv=$(getpriv "644" $priv "$a" maillist) && -# return $(listaddresses -E "$user"-owner@"$myhost" -# -e "$lcuser"-owner@"$myhost" +# return $(listaddresses -E "$user"-owner@"$myhost" \ +# -e "$lcuser"-owner@"$myhost" \ # -c "$a file expansion" < "$a" | -# maprrouter $(newattribute $attr privilege $priv +# maprrouter $(newattribute $attr privilege $priv \ # sender "$lcuser"-owner@"$myhost") "$a" "$user") a="$MAILVAR/lists/$lcuser" @@ -179,11 +179,11 @@ [ $didexpand ] || [ -f "$a" ] && db add expansions "$key" list && priv=$(getpriv "664" $priv "$a" maillist) && - nattr=($(newattribute $attr privilege $priv sender + nattr=($(newattribute $attr privilege $priv sender \ "$lcuser-owner")) && - return $(listexpand -E "$user-owner@$mydomain" -p $priv - -e "$lcuser-owner@$mydomain" - -c "$a file expansion" + return $(listexpand -E "$user-owner@$mydomain" -p $priv \ + -e "$lcuser-owner@$mydomain" \ + -c "$a file expansion" \ $nattr "$a" "$user" < "$a") a="$MAILVAR/modlists/$lcuser" @@ -196,10 +196,10 @@ *-mod) l="$(basename "$lcuser" -mod)" # echo "$l exists!" >> /dev/tty - return $(listaddresses -E "$l-owner@$mydomain" - -e "$l-owner@$mydomain" + return $(listaddresses -E "$l-owner@$mydomain" \ + -e "$l-owner@$mydomain" \ -c "$a file expansion" < "$a" | - maprrouter $(newattribute $attr privilege $priv + maprrouter $(newattribute $attr privilege $priv \ sender "$l-owner") "$a" "$user") ;; esac @@ -211,13 +211,13 @@ *-owner) a="$MAILVAR/lists/$(basename "$lcuser" -owner)" && [ -f "$a" ] && - return $(rrouter "$(uid2login $(filepriv -M 664 "$a"))" + return $(rrouter "$(uid2login $(filepriv -M 664 "$a"))"\ "$user" $attr) ;; *-request) a="$MAILVAR/lists/$(basename "$lcuser" -request)" && [ -f "$a" ] && - return $(rrouter "$(uid2login $(filepriv -M 664 "$a"))" + return $(rrouter "$(uid2login $(filepriv -M 664 "$a"))"\ "$user" $attr) ;; *-group) @@ -226,7 +226,7 @@ db add expansions "$key" list && return $(echo $a | listaddresses -e postmaster -c "$lcuser expansion" | - maprrouter $(newattribute $attr sender postmaster) + maprrouter $(newattribute $attr sender postmaster) \ "$lcuser" "$user") ;; esac @@ -234,7 +234,7 @@ # only allow .forward file reading if privs allow it case "$(get $attr type)" in - expandsender) a=$(homedirectory "$user")/.forward && [ -f $a ] && + expandsender) a=$(homedirectory "$user")/.forward && [ -f $a ] && \ return (($quad)) ;; esac @@ -244,8 +244,8 @@ a="$(homedirectory "$user")/.forward" && [ -f "$a" ] && db add expansions "$key" user && priv=$(getpriv "644" $priv "$a" .forward) && - return $(listaddresses -e "\$user" -c "$a .forward expansion" < "$a" | - maprrouter $(newattribute $attr privilege $priv) + return $(listaddresses -e "\$user" -c "$a .forward expansion" < "$a" | \ + maprrouter $(newattribute $attr privilege $priv) \ "$a" "$user") # local user with no alias and no .forward file diff -u -r zmailer-2.99.41/proto/cf/process.cf zmailer-2.99.42/proto/cf/process.cf --- zmailer-2.99.41/proto/cf/process.cf Mon Jan 22 12:10:54 1996 +++ zmailer-2.99.42/proto/cf/process.cf Tue Nov 12 17:59:04 1996 @@ -40,6 +40,8 @@ ;; esac + [ $? ] && return 0 # Leave when they returned failure.. + #| The file names in the $POSTOFFICE/router directory are determined by #| the parameter to the mail_open() C library routine. This case #| statement knows about the various message file types needed on your diff -u -r zmailer-2.99.41/router/rfc822.c zmailer-2.99.42/router/rfc822.c --- zmailer-2.99.41/router/rfc822.c Mon Nov 11 16:15:57 1996 +++ zmailer-2.99.42/router/rfc822.c Tue Nov 12 18:00:12 1996 @@ -2007,6 +2007,10 @@ if (vfp != NULL) { fprintf(vfp, "router done processing %s\n", file); + fflush(vfp); +#ifdef HAVE_FSYNC + fsync(FILENO(vfp)); +#endif fclose(vfp); } @@ -2022,7 +2026,11 @@ qpath = emalloc(5+strlen(QUEUEDIR)+strlen(file)); #endif sprintf(qpath, "../%s/%s", QUEUEDIR, file); - if ((fclose(ofp) == EOF) || (erename(file, qpath) < 0)) { + fflush(ofp); +#ifdef HAVE_FSYNC + fsync(FILENO(ofp)); +#endif + if ((fclose(ofp) != 0) || (erename(file, qpath) != 0)) { unlink(qpath); unlink(ofpname); #ifndef USE_ALLOCA diff -u -r zmailer-2.99.41/scheduler/msgerror.c zmailer-2.99.42/scheduler/msgerror.c --- zmailer-2.99.41/scheduler/msgerror.c Thu Nov 7 23:26:33 1996 +++ zmailer-2.99.42/scheduler/msgerror.c Tue Nov 12 18:43:54 1996 @@ -186,6 +186,10 @@ vp->headeroffset, vp->drptoffset, vp->dnsrecipient ? (vp->dnsrecipient - vp->cfp->contents) : -1, notary, message); + fflush(fp); +#ifdef HAVE_FSYNC + fsync(FILENO(fp)); +#endif fclose(fp); } diff -u -r zmailer-2.99.41/scheduler/threads.c zmailer-2.99.42/scheduler/threads.c --- zmailer-2.99.41/scheduler/threads.c Thu Oct 31 16:54:05 1996 +++ zmailer-2.99.42/scheduler/threads.c Tue Nov 12 22:43:02 1996 @@ -1446,7 +1446,7 @@ fprintf(fp,"\tThreads: %4d",thg->threads); if (thg->threads != cnt) fprintf(fp,"/%d",cnt); - fprintf(fp," Rcpts: %5d",jobsum); + fprintf(fp," Msgs: %5d",jobsum); fprintf(fp," Procs: %3d",thg->transporters); /* if (thg->transporters != procs) fprintf(fp,"/%d",procs); */ diff -u -r zmailer-2.99.41/support/vacation/Makefile.in zmailer-2.99.42/support/vacation/Makefile.in --- zmailer-2.99.41/support/vacation/Makefile.in Fri Aug 9 21:46:14 1996 +++ zmailer-2.99.42/support/vacation/Makefile.in Tue Nov 12 20:54:55 1996 @@ -57,10 +57,10 @@ $(INSTALL) -o root -m 755 vacation $(MAILBIN) $(INSTALL) -o root -m 644 vacation.msg $(VMSGDEF) -$(INSTALL) -o root -m 644 vacation.1 \ - $(MANDIR)$(MANEXT)/vacation.$(MANEXT) + $(MANDIR)/man$(MANEXT)/vacation.$(MANEXT) @echo "** Add a symlink from somewhere in user paths to $(MAILBIN)/vacation.sh" @echo "** to finish off the installation; Also the location of the man-page" - @echo "** might need reconsideration (now at $(MANDIR))" + @echo "** might need reconsideration (now at $(MANDIR)/man$(MANEXT))" depend: CPPDEP="${CPPDEP}" $(TOPDIR)/bin/mkdep $(CFLAGS) $(SOURCE) diff -u -r zmailer-2.99.41/transports/errormail/errormail.c zmailer-2.99.42/transports/errormail/errormail.c --- zmailer-2.99.41/transports/errormail/errormail.c Fri Nov 8 16:49:47 1996 +++ zmailer-2.99.42/transports/errormail/errormail.c Tue Nov 12 21:37:52 1996 @@ -330,7 +330,9 @@ if (reportcnt == 0){ /* No, throw it away and ack success. */ mail_abort(mfp); - diagnostic(rp, EX_OK, 0, NULL); + for (rp = dp->recipients; rp != NULL; rp = rp->next) + if (!(rp->notifyflgs & _DSN_NOTIFY_FAILURE)) + diagnostic(rp, EX_OK, 0, NULL); return; } diff -u -r zmailer-2.99.41/transports/libta/ctlopen.c zmailer-2.99.42/transports/libta/ctlopen.c --- zmailer-2.99.41/transports/libta/ctlopen.c Mon Nov 11 18:12:57 1996 +++ zmailer-2.99.42/transports/libta/ctlopen.c Tue Nov 12 21:31:32 1996 @@ -408,7 +408,7 @@ rp->desc = &d; rp->orcpt = NULL; rp->notify = NULL; - rp->notifyflgs = 0; + rp->notifyflgs = _DSN_NOTIFY_FAILURE; /* Default behaviour */ d.recipients = rp; rp->status = EX_OK; rp->newmsgheader = NULL; diff -u -r zmailer-2.99.41/transports/mailbox/mailbox.c zmailer-2.99.42/transports/mailbox/mailbox.c --- zmailer-2.99.41/transports/mailbox/mailbox.c Mon Nov 11 20:39:17 1996 +++ zmailer-2.99.42/transports/mailbox/mailbox.c Tue Nov 12 18:26:02 1996 @@ -882,6 +882,9 @@ setrootuid(rp); return; } +#ifdef HAVE_FSYNC + fsync(fdmail); +#endif close(fdmail); } setrootuid(rp); @@ -1199,12 +1202,16 @@ #endif /* BIFF || RBIFF */ fp = putmail(dp, rp, fdmail, "a+", timestring, file); - if (!fp) - close(fdmail); /* Close now, as putmail() didn't - do it at error return */ if (S_ISREG(st.st_mode)) { + if (fp) { + fflush(fp); +#ifdef HAVE_FSYNC + fsync(fdmail); +#endif + } + /* Previously acquired locks need to be released, preferrably in reverse order */ @@ -1262,11 +1269,13 @@ "2.2.0 (Delivered successfully)", "x-local; 250 (Delivered successfully)"); DIAGNOSTIC(rp, EX_OK, "Ok", 0); - } + } else + close(fdmail); #if defined(HAVE_SOCKET) - else + if (fp) { if (nbp != NULL) /* putmail() has produced a DIAGNOSTIC */ nbp->offset = -1; + } #endif /* BIFF || RBIFF */ /* [Thomas Knott] "Return-Receipt-To:" */ @@ -1365,6 +1374,9 @@ if (eofindex >= 0) ftruncate(FILENO(fp), (u_long)eofindex); #endif +#ifdef HAVE_FSYNC + fsync(FILENO(fp)); +#endif fclose(fp); fp = NULL; goto time_reset; @@ -1385,6 +1397,9 @@ if (eofindex >= 0) ftruncate(FILENO(fp), (off_t)eofindex); #endif +#ifdef HAVE_FSYNC + fsync(FILENO(fp)); +#endif fclose(fp); eofindex = -1; fp = NULL; @@ -1421,6 +1436,9 @@ if (eofindex >= 0) ftruncate(FILENO(fp), (off_t)eofindex); #endif /* HAVE_FTRUNCATE */ +#ifdef HAVE_FSYNC + fsync(FILENO(fp)); +#endif fclose(fp); fp = NULL; goto time_reset; diff -u -r zmailer-2.99.41/transports/sm/sm.c zmailer-2.99.42/transports/sm/sm.c --- zmailer-2.99.41/transports/sm/sm.c Mon Nov 11 20:02:03 1996 +++ zmailer-2.99.42/transports/sm/sm.c Tue Nov 12 20:38:23 1996 @@ -333,10 +333,16 @@ av[i++] = mp->argv[0]; if (mp->flags & MO_FFROMFLAG) { av[i++] = "-f"; - av[i++] = startrp->addr->link->user; + if (strcmp(startrp->addr->link->channel,"error")==0) + av[i++] = "<>"; + else + av[i++] = startrp->addr->link->user; } else if (mp->flags & MO_RFROMFLAG) { av[i++] = "-r"; - av[i++] = startrp->addr->link->user; + if (strcmp(startrp->addr->link->channel,"error")==0) + av[i++] = "<>"; + else + av[i++] = startrp->addr->link->user; } for (j = 1; mp->argv[j] != NULL; ++j) { while (i+2 >= avsize) { @@ -488,7 +494,10 @@ if (mp->flags & MO_CRLF) putc('\r',tafp); putc('\n',tafp); - fprintf(tafp,"MAIL FROM:<%s>", startrp->addr->link->user); + if (strcmp(startrp->addr->link->channel,"error")==0) + fprintf(tafp,"MAIL From:<>"); + else + fprintf(tafp,"MAIL From:<%s>", startrp->addr->link->user); if (mp->flags & MO_BESMTP) { fprintf(tafp," SIZE=%ld",startrp->desc->msgsizeestimate); if (can_8bit) @@ -525,17 +534,18 @@ if (mp->flags & (MO_UNIXFROM|MO_REMOTEFROM)) { char *timestring; time_t now; + char *uu = startrp->addr->link->user; now = time((time_t *)0); timestring = ctime(&now); *(timestring+strlen(timestring)-1) = '\0'; - fprintf(tafp, "%s%s %s", FROM_, - startrp->addr->link->user, timestring); + if (strcmp(startrp->addr->link->channel,"error")==0) + uu = "<>"; + fprintf(tafp, "%s%s %s", FROM_, uu, timestring); if (mp->flags & MO_REMOTEFROM) fprintf(tafp, " remote from %s", uucpname); if (verboselog) { - fprintf(verboselog, "%s%s %s", FROM_, - startrp->addr->link->user, timestring); + fprintf(verboselog, "%s%s %s", FROM_, uu, timestring); if (mp->flags & MO_REMOTEFROM) fprintf(verboselog, " remote from %s", uucpname); putc('\n',verboselog); @@ -599,9 +609,11 @@ exist.. */ if (mp->flags & MO_RETURNPATH) { char **hdrs = has_header(startrp,"Return-Path:"); + char *uu = startrp->addr->link->user; if (hdrs) delete_header(startrp, hdrs); - append_header(startrp,"Return-Path: <%s>\n", - startrp->addr->link->user); + if (strcmp(startrp->addr->link->channel,"error")==0) + uu = ""; + append_header(startrp,"Return-Path: <%s>\n", uu); } if (mp->flags & MO_CRLF) writeheaders(startrp, tafp, "\r\n", convertmode, maxwidth); diff -u -r zmailer-2.99.41/utils/makendbm/makendbm.c zmailer-2.99.42/utils/makendbm/makendbm.c --- zmailer-2.99.41/utils/makendbm/makendbm.c Mon Nov 11 14:19:47 1996 +++ zmailer-2.99.42/utils/makendbm/makendbm.c Tue Nov 12 18:02:09 1996 @@ -27,10 +27,8 @@ #define PROG "makendbm" -#include /* This (usually) defines the following 3.. */ - /* extern int errno; - extern char *sys_errlist[]; - extern int sys_nerr; */ +#include +extern int errno; /* Not all systems declare it in ... */ extern char *strchr(); @@ -64,8 +62,7 @@ fprintf(stderr," (BTREE appends .db, to the actual db file name..)\n"); #endif fprintf(stderr," Error now: %s",err); - if (errno > 0 && errno < sys_nerr) - fprintf(stderr,", errno=%d (%s)",errno,sys_errlist[errno]); + fprintf(stderr,", errno=%d (%s)",errno,strerror(errno)); fprintf(stderr,"\n"); exit (1); } @@ -244,8 +241,10 @@ gdbm_close(gdbmfile); #endif #ifdef HAVE_DB_H - if (typ == 3) + if (typ == 3) { + (dbfile->sync)(dbfile,0); (dbfile->close)(dbfile); + } #endif return 0; diff -u -r zmailer-2.99.41/utils/makendbm/ndbmlook.c zmailer-2.99.42/utils/makendbm/ndbmlook.c --- zmailer-2.99.41/utils/makendbm/ndbmlook.c Thu Sep 12 20:38:44 1996 +++ zmailer-2.99.42/utils/makendbm/ndbmlook.c Wed Nov 13 17:14:47 1996 @@ -12,36 +12,50 @@ #include #include #ifdef HAVE_NDBM_H +#define datum Ndatum #include -#else +#undef datum +#endif #ifdef HAVE_GDBM_H +#define datum Gdatum #include -#else - error:error:Only NDBM and GDBM supported! (NDBM primarily) +#undef datum #endif +#ifdef HAVE_DB_H +#include #endif #include /* This usually defines the following three.. */ - /* extern int errno; - extern char *sys_errlist[]; - extern int sys_nerr */; - -extern void create_dbase(); +extern int errno; void usage(prog,err,errno) char *prog, *err; int errno; { - fprintf(stderr,"Usage: %s database.name key\n",prog); + fprintf(stderr,"Usage: %s dbtype database.name key\n",prog); + fprintf(stderr," Dbtypes are:"); +#ifdef HAVE_NDBM_H + fprintf(stderr," ndbm"); +#endif +#ifdef HAVE_GDBM_H + fprintf(stderr," gdbm"); +#endif +#ifdef HAVE_DB_H + fprintf(stderr," btree"); +#endif + fprintf(stderr,"\n"); #ifdef HAVE_NDBM_H fprintf(stderr," (NDBM appends .pag, and .dir into actual db file names..)\n"); -#else /* GDBM.. */ +#endif +#ifdef HAVE_GDBM_H fprintf(stderr," (GDBM DOES NOT append .pag, nor .dir into actual db file names..)\n"); #endif +#ifdef HAVE_DB_H + fprintf(stderr," (DB appends .db into the actial db file names..)\n"); +#endif fprintf(stderr," Error now: %s",err); - if (errno > 0 && errno < sys_nerr) - fprintf(stderr,", errno=%d (%s)",errno,sys_errlist[errno]); + fprintf(stderr,", errno=%d (%s)",errno,strerror(errno)); fprintf(stderr,"\n"); exit (1); } @@ -52,44 +66,100 @@ char *argv[]; { char *dbasename = NULL; - FILE *infile = NULL; - datum key; - datum result; -#ifdef HAVE_NDBM_H - DBM *dbmfile; -#else - GDBM_FILE dbmfile; + +#ifdef HAVE_GDBM_H + GDBM_FILE Gdbmfile; +#endif +#ifdef HAVE_DB_H + DB *dbfile; #endif - if (argc != 3) usage(argv[0],"wrong number of arguments",0); - dbasename = argv[1]; + if (argc != 4) usage(argv[0],"wrong number of arguments",0); + dbasename = argv[2]; #ifdef HAVE_NDBM_H - dbmfile = dbm_open(dbasename, O_RDONLY, 0644); -#else - dbmfile = gdbm_open(dbasename, 0, GDBM_READER, 0); -#endif - if (dbmfile == NULL) - usage(argv[0],"Can't open dbase file",errno); + if (strcmp(argv[1],"ndbm")==0) { + DBM *Ndbmfile; + Ndatum key; + Ndatum result; + Ndbmfile = dbm_open(dbasename, O_RDONLY, 0644); + + if (!Ndbmfile) { + fprintf(stderr,"Failed to open '%s' NDBM-dbase\n",dbasename); + return 1; + } + + key.dptr = argv[3]; + key.dsize = strlen(argv[3]) +1; + + result = dbm_fetch(Ndbmfile,key); + + if (result.dptr == NULL) { + fprintf(stderr,"Key %s not found\n",argv[3]); + return 2; + } + printf("siz:%d, dat: %s\n",result.dsize,result.dptr); - key.dptr = argv[2]; - key.dsize = strlen(argv[2]) +1; + dbm_close(Ndbmfile); -#ifdef HAVE_NDBM_H - result = dbm_fetch(dbmfile,key); -#else - result = gdbm_fetch(dbmfile,key); -#endif - if (result.dptr == NULL) { - fprintf(stderr,"Key %s not found\n",argv[2]); - return 2; + return 0; } - printf("siz:%d, dat: %s\n",result.dsize,result.dptr); +#endif /* NDBM */ +#ifdef HAVE_GDBM_H + if (strcmp(argv[1],"gdbm")==0) { + GDBM_FILE gdbmfile; + Gdatum key; + Gdatum result; + gdbmfile = gdbm_open(dbasename, O_RDONLY, 0644, 0, NULL); + + if (!gdbmfile) { + fprintf(stderr,"Failed to open '%s' GDBM-dbase\n",dbasename); + return 1; + } + + key.dptr = argv[3]; + key.dsize = strlen(argv[3]) +1; + + result = gdbm_fetch(gdbmfile,key); + + if (result.dptr == NULL) { + fprintf(stderr,"Key %s not found\n",argv[3]); + return 2; + } + printf("siz:%d, dat: %s\n",result.dsize,result.dptr); -#ifdef HAVE_NDBM_H - dbm_close(dbmfile); -#else - gdbm_close(dbmfile); -#endif + gdbm_close(gdbmfile); + + return 0; + } +#endif /* GDBM */ +#ifdef HAVE_DB_H + if (strcmp(argv[1],"btree")==0) { + DB *dbfile; + DBT key; + DBT result; + int rc; + + dbfile = dbopen(dbasename, O_RDONLY, 0644, DB_BTREE, NULL); + + if (!dbfile) { + fprintf(stderr,"Failed to open '%s' BTREE-dbase\n",dbasename); + return 1; + } + + key.data = argv[3]; + key.size = strlen(argv[3]) +1; + + rc = (dbfile->get)(dbfile,&key,&result,0); + + if (rc != 0) { + fprintf(stderr,"Key %s not found\n",argv[3]); + return 2; + } + printf("siz:%d, dat: %s\n",result.size,result.data); - return 0; + (dbfile->close)(dbfile); + + return 0; + } +#endif }