From 1e588a59440aa1bee55c8d6d69003059c1d2af97 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Mon, 26 Mar 2012 23:53:15 +0200 Subject: [PATCH] Remove RPATH code though. Discussions on nmh-workers have convinced me. [2012-01-05] Lyndon Nerenberg: > [2012-01-05] Ken Hornstein: >> RPATHS - Construct Return-Path headers from "From " lines. >> I say keep it, since it's been around forever (a fair >> amount of code, actually). > I'm going to argue for the removal of this code, as well. The > Return-Path header should be inserted by the delivering MTA, and I > can't think of any modern MTA that doesn't. --- h/prototypes.h | 1 - sbr/m_getfld.c | 44 ++++++-------------------------------------- uip/scansbr.c | 13 ------------- uip/slocal.c | 15 --------------- 4 files changed, 6 insertions(+), 67 deletions(-) diff --git a/h/prototypes.h b/h/prototypes.h index bd484e9..0e608d0 100644 --- a/h/prototypes.h +++ b/h/prototypes.h @@ -112,7 +112,6 @@ int unputenv(char *); int uprf(char *, char *); int vfgets(FILE *, char **); char *write_charset_8bit(void); -int get_returnpath(char *, int, char *, int); int mh_strcasecmp(const char *s1, const char *s2); int strncasecmp(const char *s1, const char *s2, size_t n); diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 85a323b..2ebb44a 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -578,7 +578,6 @@ finish: return (state); } -static char fromline[BUFSIZ] = ""; void thisisanmbox(FILE *iob) @@ -610,11 +609,9 @@ thisisanmbox(FILE *iob) } ismbox = TRUE; delimstr = "\nFrom "; - cp = fromline; - while ((c = getc(iob)) != '\n' && cp - fromline < BUFSIZ - 1) - *cp++ = c; - *cp = '\0'; - + while ((c = getc(iob)) != '\n' && c >= 0) { + continue; + } c = strlen(delimstr); fdelim = (unsigned char *) mh_xmalloc((size_t) (c + 3)); *fdelim++ = '\0'; @@ -650,7 +647,6 @@ m_Eom(int c, FILE *iob) register long pos = 0L; register int i; char text[10]; - register char *cp; pos = ftell(iob); if ((i = fread(text, sizeof *text, edelimlen, iob)) != edelimlen || @@ -668,43 +664,15 @@ m_Eom(int c, FILE *iob) } if (ismbox) { - cp = fromline; - while ((c = getc(iob)) != '\n' && c >= 0 && cp - fromline < BUFSIZ - 1) - *cp++ = c; - *cp = '\0'; + while ((c = getc(iob)) != '\n' && c >= 0) { + continue; + } } return 1; } -/* -** Return the Return-Path and Delivery-Date header information. -** -** Currently, I'm assuming that the "From " line takes the following form: -** "From" sender@host date (sendmail delivery) -*/ -int -get_returnpath(char *rp, int rplen, char *dd, int ddlen) -{ - char *cp; - - if (!(cp = strchr(fromline, ' '))) { - return 0; - } - /* Extract the Return-Path. */ - snprintf(rp, rplen, "%.*s\n", (int)(cp - fromline), fromline); - /* Advance over the whitespace. */ - while (*cp == ' ' || *cp == '\t') { - cp++; - } - /* Extract the Delivery-Date. */ - snprintf(dd, ddlen, "%.*s\n", 24, cp); - *fromline = '\0'; - return 1; -} - - static unsigned char * matchc(int patln, char *pat, int strln, char *str) { diff --git a/uip/scansbr.c b/uip/scansbr.c index 56583f1..c566de2 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -74,8 +74,6 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg, char *scnmsg = NULL; FILE *scnout = NULL; char name[NAMESZ]; - char returnpath[BUFSIZ]; - char deliverydate[BUFSIZ]; int incing = (outnum != SCN_MBOX && outnum != SCN_FOLD); int scanfolder = (outnum == SCN_FOLD); long fpos; @@ -150,17 +148,6 @@ scan(FILE *inb, int innum, int outnum, char *fmtstr, int width, int curflg, return SCNNUM; if (!(scnout = fopen(scnmsg, "w"))) adios(scnmsg, "unable to write"); - /* - ** Add the Return-Path and Delivery-Date - ** header fields to message. - */ - if (get_returnpath(returnpath, sizeof(returnpath), - deliverydate, sizeof(deliverydate))) { - FPUTS("Return-Path: "); - FPUTS(returnpath); - FPUTS("Delivery-Date: "); - FPUTS(deliverydate); - } } /* scan - main loop */ diff --git a/uip/slocal.c b/uip/slocal.c index 9865839..c8af725 100644 --- a/uip/slocal.c +++ b/uip/slocal.c @@ -1322,27 +1322,12 @@ you_lose: if (first) { first = 0; if (strncmp(buffer, "From ", i)==0) { - char *fp, *cp; /* ** get copy of envelope information ** ("From " line) */ envelope = getcpy(buffer); - /* - ** Now create a "Return-Path:" line - ** from the "From " line. - */ - cp = strchr(fp = envelope + i, ' '); - snprintf(buffer, sizeof(buffer), - "Return-Path: %.*s\n", - (int)(cp - fp), fp); - - /* Add Return-Path header to message */ - fputs(buffer, ffp); - if (ferror(ffp)) { - goto fputs_error; - } /* Put the delivery date in message */ fputs(ddate, ffp); if (ferror(ffp)) { -- 1.7.10.4