From: markus schnalke Date: Sat, 29 Aug 2015 08:47:56 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/master' X-Git-Tag: mmh-0.2-RC1~32 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=a2ca51e05aaad418d652ce36f232a9076b3b2d08;hp=5ba9c2f13fedf1d8d6ed907ef1f505616290efaa Merge remote-tracking branch 'origin/master' --- diff --git a/configure.ac b/configure.ac index b8f41f2..2cda6e0 100644 --- a/configure.ac +++ b/configure.ac @@ -143,10 +143,6 @@ AC_PROG_RANLIB dnl Check for `ranlib' AC_PROG_AWK dnl Check for mawk,gawk,nawk, then awk AC_PROG_LEX dnl Check for lex/flex -dnl Look for `realpath' -pathtmp=/bin:/usr/bin:/usr/local/bin -AC_PATH_PROG(realpathpath, realpath, no, [$pathtmp]) - dnl Look for `cut' pathtmp=/usr/bin:/bin:/usr/local/bin:/usr/xpg4/bin:/usr/ucb AC_PATH_PROG(cutpath, cut, no, [$pathtmp]) @@ -243,7 +239,6 @@ AC_CACHE_CHECK(where mail spool is located, nmh_cv_mailspool, /usr/spool/mail dnl /dev/null; dnl Just in case we fall through do - mailspool = $realpathpath $mailspool; test -d $mailspool && break done nmh_cv_mailspool=$mailspool @@ -255,7 +250,7 @@ dnl See whether the mail spool directory is world-writable. if test "$lspath" != "no" -a "$cutpath" != "no"; then AC_CACHE_CHECK(whether the mail spool is world-writable, nmh_cv_mailspool_world_writable, - [if test "`$lspath -dlL $mailspool | $cutpath -c9`" = "-"; then + [if test "`$lspath -dl $mailspool/ | $cutpath -c9`" = "-"; then nmh_cv_mailspool_world_writable=no else nmh_cv_mailspool_world_writable=yes diff --git a/uip/mhparse.c b/uip/mhparse.c index fad75d7..f520e03 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -766,7 +766,9 @@ bad_quote: } if (!*vp) { advise(NULL, "invalid parameter in message %s's %s: field\n%*.*s(parameter %s)", ct->c_file, TYPE_FIELD, i, i, "", *ap); - return NOTOK; + *ci->ci_values[ap - ci->ci_attrs] = '\0'; + *ci->ci_attrs[ap - ci->ci_attrs] = '\0'; + continue; } ap++; @@ -1035,7 +1037,7 @@ InitMultiPart(CT ct) if (ct->c_encoding != CE_7BIT && ct->c_encoding != CE_8BIT && ct->c_encoding != CE_BINARY) { admonish(NULL, "\"%s/%s\" type in message %s must be encoded in 7bit, 8bit, or binary", ci->ci_type, ci->ci_subtype, ct->c_file); - return NOTOK; + ct->c_encoding = CE_7BIT; } /* match subtype */ diff --git a/uip/spost.c b/uip/spost.c index b5fac12..4d0b48a 100644 --- a/uip/spost.c +++ b/uip/spost.c @@ -115,6 +115,7 @@ static char *tmpfil; static char *subject = NULL; /* the subject field for BCC'ing */ static char fccs[BUFSIZ] = ""; struct mailname *bccs = NULL; /* list of the bcc recipients */ +struct mailname *sender = NULL; static struct headers *hdrtab; /* table for the message we're doing */ static FILE *out; /* output (temp) file */ @@ -225,13 +226,9 @@ main(int argc, char **argv) for (compnum = 1, state = FLD;;) { switch (state = m_getfld(state, name, buf, sizeof(buf), in)) { case FLD: - compnum++; - putfmt(name, buf, out); - continue; - case FLDPLUS: compnum++; - cp = add(buf, cp); + cp = getcpy(buf); while (state == FLDPLUS) { state = m_getfld(state, name, buf, sizeof(buf), in); @@ -422,16 +419,38 @@ putfmt(char *name, char *str, FILE *out) if (hdr->set & MFRM) { struct mailname *mp = NULL; + struct mailname *my = NULL; + unsigned int fromcnt = 0; /* needed because the address parser holds global state */ ismymbox(NULL); while ((cp = getname(str)) != NULL) { + fromcnt++; mp = getm(cp, NULL, 0, AD_NAME, NULL); if (ismymbox(mp)) { msgflags |= MFMM; + if (my == NULL) { + my = mp; + } else { + mnfree(mp); + mp = NULL; + } + } else { + mnfree(mp); + mp = NULL; } } + + if (fromcnt > 1) { + sender = my; + } else { + mnfree(my); + } + + free(cp); + cp = NULL; + } if (hdr->flags & HSUB) { @@ -456,7 +475,9 @@ finish_headers(FILE *out) fprintf(out, "%sDate: %s\n", resentstr, dtimenow()); } - if ((cp = context_find("Default-From")) != NULL) { + if (sender != NULL) { + snprintf(signature, sizeof(signature), "%s", sender->m_text); + } else if ((cp = context_find("Default-From")) != NULL) { snprintf(signature, sizeof(signature), "%s", cp); } else { snprintf(from, sizeof(from), "%s@%s", getusername(), LocalName()); @@ -473,7 +494,7 @@ finish_headers(FILE *out) ** Add a Sender: header because the From: header could ** be fake or contain multiple addresses. */ - if (!(msgflags & MFMM)) { + if (!(msgflags & MFMM) || sender != NULL) { fprintf(out, "%sSender: %s\n", resentstr, signature); } } diff --git a/uip/whom.c b/uip/whom.c index e61dc62..4b15fbd 100644 --- a/uip/whom.c +++ b/uip/whom.c @@ -193,7 +193,7 @@ process(char *file) case FLDPLUS: compnum++; - cp = add(buf, cp); + cp = getcpy(buf); while (state == FLDPLUS) { state = m_getfld(state, name, buf, sizeof(buf), in);