You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

528233-readonly-open.patch 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. From: Antonio Radici <antonio@debian.org>
  2. Date: Thu, 27 Feb 2014 17:07:35 +0100
  3. Subject: 528233-readonly-open
  4. Open attachments as read-only so the editor won't be able to modify it;
  5. otherwise the user can believe that he/she can edit it and risk to lose
  6. his/her work (see upstream bug http://bugs.mutt.org/3261)
  7. Debian bugs: #528233, updated in #572203
  8. Gbp-Pq: Topic upstream
  9. ---
  10. attach.c | 5 +++++
  11. 1 file changed, 5 insertions(+)
  12. diff --git a/attach.c b/attach.c
  13. index 0efeb79..c5f47d9 100644
  14. --- a/attach.c
  15. +++ b/attach.c
  16. @@ -415,6 +415,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
  17. FREE (&fname);
  18. if (mutt_save_attachment (fp, a, tempfile, 0, NULL) == -1)
  19. goto return_error;
  20. + chmod (tempfile, 0400);
  21. }
  22. use_pipe = rfc1524_expand_command (a, tempfile, type,
  23. @@ -587,7 +588,11 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
  24. if (entry)
  25. rfc1524_free_entry (&entry);
  26. if (fp && tempfile[0])
  27. + {
  28. + /* Restore write permission so mutt_unlink can open the file for writing */
  29. + chmod(tempfile, 0600);
  30. mutt_unlink (tempfile);
  31. + }
  32. else if (unlink_tempfile)
  33. unlink(tempfile);