X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..9ae284163f491c64de122fcd555019040e0d4da7:/recvcmd.c diff --git a/recvcmd.c b/recvcmd.c index 7890cfb..4ae7d68 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1999-2000 Thomas Roessler + * Copyright (C) 1999-2004 Thomas Roessler * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public @@ -26,12 +26,8 @@ #include "mutt.h" #include "mutt_curses.h" #include "mutt_menu.h" -#include "rfc1524.h" -#include "mime.h" -#include "mailbox.h" #include "attach.h" #include "mapping.h" -#include "mx.h" #include "copy.h" #include "mutt_idna.h" @@ -143,6 +139,34 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, /* one or more messages? */ p = (cur || count_tagged (idx, idxlen) == 1); + /* RfC 5322 mandates a From: header, so warn before bouncing + * messages without one */ + if (cur) + { + if (!cur->hdr->env->from) + { + mutt_error _("Warning: message contains no From: header"); + mutt_sleep (2); + mutt_clear_error (); + } + } + else + { + for (i = 0; i < idxlen; i++) + { + if (idx[i]->content->tagged) + { + if (!idx[i]->content->hdr->env->from) + { + mutt_error _("Warning: message contains no From: header"); + mutt_sleep (2); + mutt_clear_error (); + break; + } + } + } + } + if (p) strfcpy (prompt, _("Bounce message to: "), sizeof (prompt)); else @@ -411,7 +435,7 @@ static void attach_forward_bodies (FILE * fp, HEADER * hdr, tmphdr->env = mutt_new_envelope (); mutt_make_forward_subject (tmphdr->env, Context, parent); - mutt_mktemp (tmpbody); + mutt_mktemp (tmpbody, sizeof (tmpbody)); if ((tmpfp = safe_fopen (tmpbody, "w")) == NULL) { mutt_error (_("Can't open temporary file %s."), tmpbody); @@ -513,13 +537,13 @@ _("Can't decode all tagged attachments. MIME-forward the others?"))) == -1) } if (mime_fwd_any && - (last = copy_problematic_attachments (fp, last, idx, idxlen, mime_fwd_all)) == NULL) + copy_problematic_attachments (fp, last, idx, idxlen, mime_fwd_all) == NULL) goto bail; } mutt_forward_trailer (tmpfp); - fclose (tmpfp); + safe_fclose (&tmpfp); tmpfp = NULL; /* now that we have the template, send it. */ @@ -530,7 +554,7 @@ _("Can't decode all tagged attachments. MIME-forward the others?"))) == -1) if (tmpfp) { - fclose (tmpfp); + safe_fclose (&tmpfp); mutt_unlink (tmpbody); } @@ -589,7 +613,7 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, /* no MIME encapsulation */ - mutt_mktemp (tmpbody); + mutt_mktemp (tmpbody, sizeof (tmpbody)); if (!(tmpfp = safe_fopen (tmpbody, "w"))) { mutt_error (_("Can't create %s."), tmpbody); @@ -635,7 +659,7 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, } } } - fclose (tmpfp); + safe_fclose (&tmpfp); } else if (rc == M_YES) /* do MIME encapsulation - we don't need to do much here */ { @@ -839,7 +863,7 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, return; } - mutt_mktemp (tmpbody); + mutt_mktemp (tmpbody, sizeof (tmpbody)); if ((tmpfp = safe_fopen (tmpbody, "w")) == NULL) { mutt_error (_("Can't create %s."), tmpbody); @@ -911,14 +935,15 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, copy_problematic_attachments (fp, &tmphdr->content, idx, idxlen, 0) == NULL) { mutt_free_header (&tmphdr); - fclose (tmpfp); + safe_fclose (&tmpfp); return; } } - fclose (tmpfp); + safe_fclose (&tmpfp); - if (ci_send_message (flags, tmphdr, tmpbody, NULL, parent) == 0) + if (ci_send_message (flags, tmphdr, tmpbody, NULL, + parent ? parent : (cur ? cur->hdr : NULL)) == 0) mutt_set_flag (Context, hdr, M_REPLIED, 1); }