X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/14c29200cb58d3c4a0830265f2433849781858d0..57dfa08c90608b82597b77862a69f6ed083c772c:/recvcmd.c diff --git a/recvcmd.c b/recvcmd.c index 7890cfb..5f4511f 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 @@ -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); } @@ -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 */ { @@ -911,12 +935,12 @@ 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) mutt_set_flag (Context, hdr, M_REPLIED, 1);