summarylogtreecommitdiffstats
path: root/528233-readonly-open.patch
diff options
context:
space:
mode:
Diffstat (limited to '528233-readonly-open.patch')
-rw-r--r--528233-readonly-open.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/528233-readonly-open.patch b/528233-readonly-open.patch
new file mode 100644
index 000000000000..55ea401306ce
--- /dev/null
+++ b/528233-readonly-open.patch
@@ -0,0 +1,39 @@
+From: Antonio Radici <antonio@debian.org>
+Date: Thu, 27 Feb 2014 17:07:35 +0100
+Subject: 528233-readonly-open
+
+Open attachments as read-only so the editor won't be able to modify it;
+otherwise the user can believe that he/she can edit it and risk to lose
+his/her work (see upstream bug http://bugs.mutt.org/3261)
+
+Debian bugs: #528233, updated in #572203
+
+Gbp-Pq: Topic upstream
+---
+ attach.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/attach.c b/attach.c
+index 0efeb79..c5f47d9 100644
+--- a/attach.c
++++ b/attach.c
+@@ -415,6 +415,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
+ FREE (&fname);
+ if (mutt_save_attachment (fp, a, tempfile, 0, NULL) == -1)
+ goto return_error;
++ chmod (tempfile, 0400);
+ }
+
+ use_pipe = rfc1524_expand_command (a, tempfile, type,
+@@ -587,7 +588,11 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr,
+ if (entry)
+ rfc1524_free_entry (&entry);
+ if (fp && tempfile[0])
++ {
++ /* Restore write permission so mutt_unlink can open the file for writing */
++ chmod(tempfile, 0600);
+ mutt_unlink (tempfile);
++ }
+ else if (unlink_tempfile)
+ unlink(tempfile);
+