From aae44c933a5b035e0b23abf4dd4247cd37e4d041 Mon Sep 17 00:00:00 2001 From: Ruud de Rooij Date: Sun, 28 May 2000 14:42:01 +0000 Subject: [PATCH] * Applied patch from Peter Maydell to uip/scansbr.c for more checks for write failures. * Unlink temporary file properly in uip/rcvtty.c. * Moved viamail from bindir to libdir. * Changed sendfiles into sendfiles.in, so that path to viamail is patched in. * Added gzip support to sendfiles. * Added References header to replcomps and replgroupcomps. --- ChangeLog | 11 +++++++ etc/Makefile.in | 6 +++- etc/replcomps | 1 + etc/replgroupcomps | 1 + etc/sendfiles | 42 -------------------------- etc/sendfiles.in | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++ uip/Makefile.in | 4 +-- uip/rcvtty.c | 2 +- uip/scansbr.c | 17 +++++++---- 9 files changed, 116 insertions(+), 52 deletions(-) delete mode 100755 etc/sendfiles create mode 100755 etc/sendfiles.in diff --git a/ChangeLog b/ChangeLog index be7e10f..53201cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +Sun May 28 14:58:49 CEST 2000 Ruud de Rooij + + * Applied patch from Peter Maydell to uip/scansbr.c for more + checks for write failures. + * Unlink temporary file properly in uip/rcvtty.c. + * Moved viamail from bindir to libdir. + * Changed sendfiles into sendfiles.in, so that path to viamail + is patched in. + * Added gzip support to sendfiles. + * Added References header to replcomps and replgroupcomps. + Sun May 28 14:39:31 CEST 2000 Ruud de Rooij * Fixed m_getfld bug which caused segmentation faults when diff --git a/etc/Makefile.in b/etc/Makefile.in index 2f78e34..0eee119 100644 --- a/etc/Makefile.in +++ b/etc/Makefile.in @@ -44,7 +44,7 @@ DIST_FILES = mhl.body mhl.digest mhl.format mhl.forward mhl.headers \ replcomps replgroupcomps MailAliases # format and configuration files to generate -GEN_FILES = mhn.defaults mts.conf +GEN_FILES = mhn.defaults mts.conf sendfiles # data files we need to install FILES = $(DIST_FILES) $(GEN_FILES) @@ -73,6 +73,10 @@ mts.conf: $(srcdir)/mts.conf.in Makefile -e 's,%masquerade%,$(masquerade),' \ -e 's,%smtpservers%,$(smtpservers),' < $(srcdir)/mts.conf.in > $@ +sendfiles: $(srcdir)/sendfiles.in Makefile + rm -f $@ + $(SED) -e 's,%libdir%,$(libdir),' < $(srcdir)/sendfiles.in > $@ + install: install-files install-scripts install-files: diff --git a/etc/replcomps b/etc/replcomps index 0445181..5b6f4bf 100644 --- a/etc/replcomps +++ b/etc/replcomps @@ -26,4 +26,5 @@ %<{date}In-Reply-To: Your message of "\ %<(nodate{date})%{date}%|%(pretty{date})%>."%<{message-id} %{message-id}%>\n%>\ +%<{message-id}References: %<{references} %{references}%> %{message-id}\n%>\ -------- diff --git a/etc/replgroupcomps b/etc/replgroupcomps index 9295fd0..3226af7 100644 --- a/etc/replgroupcomps +++ b/etc/replgroupcomps @@ -33,4 +33,5 @@ In-Reply-To: Message from %<{from}%{from}%?{sender}%{sender}%|%{return-path}%>\n\ of "%<(nodate{date})%{date}%|%(pretty{date})%>."\ %<{message-id} %{message-id}%>\n\ +%<{message-id}References: %<{references} %{references}%> %{message-id}\n%>\ -------- diff --git a/etc/sendfiles b/etc/sendfiles deleted file mode 100755 index d53ed82..0000000 --- a/etc/sendfiles +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh -# -# $Id$ -# -# Send multiples files and/or directories as a tar/compressed -# image, in a MIME message. -# - -DELAY=0 -FROM= - -case "$1" in - -*) DELAY="`echo $1 | sed -e 's%-%%'`" - shift - ;; -esac - -if [ ! -z "$PERSON" ]; then - FROM="-from $PERSON" -fi - -if [ $# -lt 3 ]; then - echo 'usage: sendfiles: "mailpath" "subject-string" directory-or-file ...' 1>&2 - exit 1; -fi - -mailpath="$1" -echo "mailpath = $mailpath" 1>&2 -shift - -subject="$1" -echo "subject-string = $subject" 1>&2 -shift - -echo "files = $*" 1>&2 - -tar cvf - "$@" | compress | \ - viamail -to "$mailpath" -subject "$subject" \ - -parameters "type=tar; x-conversions=compress" \ - -comment "extract with uncompress | tar xvpf -" \ - -delay "$DELAY" \ - -verbose $FROM diff --git a/etc/sendfiles.in b/etc/sendfiles.in new file mode 100755 index 0000000..b443067 --- /dev/null +++ b/etc/sendfiles.in @@ -0,0 +1,84 @@ +#!/bin/sh +# +# $Id$ +# +# Send multiples files and/or directories as a tar/compressed +# image, in a MIME message. +# + +DELAY=0 +FROM= + +# compression method (none, gzip or compress) +METHOD=none +# compression filter +COMPRESS=cat +# uncompression filter +UNCOMPRESS=cat +# compression description to append to content-type +CONVERSION= + +# default compression method based on installed software +# prefer compress over gzip for backward compatibility +if command -v compress >/dev/null 2>&1 ; then + METHOD=compress +elif command -v gzip >/dev/null 2>&1 ; then + METHOD=gzip +fi + +# handle command-line options to override compression method and delay +while [ $# -gt 3 ]; do + case "$1" in + -gzip) METHOD=gzip + shift + ;; + -compress) METHOD=compress + shift + ;; + -none) METHOD=none + shift + ;; + -*) DELAY="`echo $1 | sed -e 's%-%%'`" + shift + ;; + *) break + ;; + esac +done + +# set variables based on chosen compression method +if [ $METHOD = compress ]; then + COMPRESS=compress + UNCOMPRESS=uncompress + CONVERSION="; x-conversions=compress" +elif [ $METHOD = gzip ]; then + COMPRESS="gzip -c" + UNCOMPRESS="gzip -dc" + CONVERSION="; x-conversions=gzip" +fi + +if [ ! -z "$PERSON" ]; then + FROM="-from $PERSON" +fi + +if [ $# -lt 3 ]; then + echo 'usage: sendfiles: "mailpath" "subject-string" directory-or-file ...' 1>&2 + exit 1; +fi + +mailpath="$1" +echo "mailpath = $mailpath" 1>&2 +shift + +subject="$1" +echo "subject-string = $subject" 1>&2 +shift + +echo "files = $*" 1>&2 + +tar cvf - "$@" | $COMPRESS | \ + %libdir%/viamail -to "$mailpath" -subject "$subject" \ + -parameters "type=tar$CONVERSION" \ + -comment "extract with $UNCOMPRESS | tar xvpf -" \ + -delay "$DELAY" \ + -verbose $FROM diff --git a/uip/Makefile.in b/uip/Makefile.in index 90b551c..0b50f29 100644 --- a/uip/Makefile.in +++ b/uip/Makefile.in @@ -55,7 +55,7 @@ SETGID_MAIL = @SETGID_MAIL@ CMDS = ali anno burst comp dist flist folder forw mark mhbuild \ mhlist mhmail mhn mhparam mhpath mhshow mhstore msgchk \ msh packf pick prompter refile repl rmf rmm scan send show \ - sortm viamail whatnow whom + sortm whatnow whom ## removed this from CMDS until I can fix it ## OTHERCMDS = vmh @@ -65,7 +65,7 @@ LCMDS = flists folders next prev # misc support binaries MISC = ap conflict dp fmtdump install-mh mhl post rcvdist rcvpack \ - rcvstore rcvtty slocal spost mhtest + rcvstore rcvtty slocal spost viamail mhtest # commands with 'S'pecial installation needs SCMDS = inc diff --git a/uip/rcvtty.c b/uip/rcvtty.c index 69a9031..5bdddb2 100644 --- a/uip/rcvtty.c +++ b/uip/rcvtty.c @@ -197,8 +197,8 @@ message_fd (char **vec) unlink (mktemp (strncpy (tmpfil, "/tmp/rcvttyXXXXX", sizeof(tmpfil)))); if ((fd = open (tmpfil, O_RDWR | O_CREAT | O_TRUNC, 0600)) == NOTOK) return header_fd (); - unlink (tmpfil); #endif + unlink (tmpfil); if ((child_id = vfork()) == NOTOK) { /* fork error */ diff --git a/uip/scansbr.c b/uip/scansbr.c index 143a059..76e87dc 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -50,9 +50,11 @@ static int dat[5]; /* aux. data for format routine */ char *scanl = 0; /* text of most recent scanline */ +#define DIEWRERR() adios (scnmsg, "write error on") + #define FPUTS(buf) {\ if (mh_fputs(buf,scnout) == EOF)\ - adios (scnmsg, "write error on");\ + DIEWRERR();\ } /* @@ -187,7 +189,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, compnum++; if (outnum) { FPUTS (name); - putc (':', scnout); + if ( putc (':', scnout) == EOF) DIEWRERR(); FPUTS (tmpbuf); } /* @@ -228,7 +230,7 @@ scan (FILE *inb, int innum, int outnum, char *nfs, int width, int curflg, state = FILEEOF; /* stop now if scan cmd */ goto finished; } - putc ('\n', scnout); + if (putc ('\n', scnout) == EOF) DIEWRERR(); FPUTS (tmpbuf); /* * performance hack: some people like to run "inc" on @@ -249,7 +251,7 @@ body:; if (scnout->_cnt <= 0) { #endif if (fflush(scnout) == EOF) - adios (scnmsg, "write error on"); + DIEWRERR (); } #ifdef LINUX_STDIO state = m_getfld(state, name, scnout->_IO_write_ptr, @@ -274,7 +276,7 @@ body:; if (outnum) { FPUTS ("\n\nBAD MSG:\n"); FPUTS (name); - putc ('\n', scnout); + if (putc ('\n', scnout) == EOF) DIEWRERR(); state = BODY; goto body; } @@ -306,7 +308,10 @@ finished: if (size) dat[2] = size; else if (outnum > 0) + { dat[2] = ftell(scnout); + if (dat[2] == EOF) DIEWRERR(); + } if ((datecomp && !datecomp->c_text) || (!size && !outnum)) { struct stat st; @@ -354,7 +359,7 @@ finished: *--nxtbuf = tmpbuf; if (outnum && (ferror(scnout) || fclose (scnout) == EOF)) - adios (scnmsg, "write error on"); + DIEWRERR(); return (state != FILEEOF ? SCNERR : encrypted ? SCNENC : SCNMSG); } -- 1.7.10.4