diff options
author | Fernando J. Pereda <ferdy@gentoo.org> | 2006-11-22 08:17:23 +0000 |
---|---|---|
committer | Fernando J. Pereda <ferdy@gentoo.org> | 2006-11-22 08:17:23 +0000 |
commit | 7e23d64b010c0921817b2ed07377fce1b8696a49 (patch) | |
tree | e1c759a04a528657fb1304ac018dde74c2833543 /mail-client/mutt/files | |
parent | added selfparsing option to SITEFILE, so steps that should follow are detecte... (diff) | |
download | gentoo-2-7e23d64b010c0921817b2ed07377fce1b8696a49.tar.gz gentoo-2-7e23d64b010c0921817b2ed07377fce1b8696a49.tar.bz2 gentoo-2-7e23d64b010c0921817b2ed07377fce1b8696a49.zip |
Fix for bug #154310
(Portage version: 2.1.1-r2)
Diffstat (limited to 'mail-client/mutt/files')
-rw-r--r-- | mail-client/mutt/files/digest-mutt-1.5.13-r2 | 6 | ||||
-rw-r--r-- | mail-client/mutt/files/mutt-1.5.13-paranoid-temp-file.patch | 100 |
2 files changed, 106 insertions, 0 deletions
diff --git a/mail-client/mutt/files/digest-mutt-1.5.13-r2 b/mail-client/mutt/files/digest-mutt-1.5.13-r2 new file mode 100644 index 000000000000..d0fb93f3637b --- /dev/null +++ b/mail-client/mutt/files/digest-mutt-1.5.13-r2 @@ -0,0 +1,6 @@ +MD5 b4fccb735c0277bc6c659eb287d65b13 mutt-1.5.13-gentoo-patches.tar.bz2 53418 +RMD160 67274bef651c1c78d1e6878d8bb17316abf9d30e mutt-1.5.13-gentoo-patches.tar.bz2 53418 +SHA256 b0a8737ab8ec42b5f071eb08356a2572c49f98c73c3bf42396fd481c4650ef1d mutt-1.5.13-gentoo-patches.tar.bz2 53418 +MD5 456a138680a6726f14983cb3e9ff4e22 mutt-1.5.13.tar.gz 3442681 +RMD160 9327b7f928aad78a20c2395629113ac2519bb945 mutt-1.5.13.tar.gz 3442681 +SHA256 e0481690c0caf23b5c88359b2dbac70308f8f138663e8fee482b163562fe8da9 mutt-1.5.13.tar.gz 3442681 diff --git a/mail-client/mutt/files/mutt-1.5.13-paranoid-temp-file.patch b/mail-client/mutt/files/mutt-1.5.13-paranoid-temp-file.patch new file mode 100644 index 000000000000..56ed1c23bb77 --- /dev/null +++ b/mail-client/mutt/files/mutt-1.5.13-paranoid-temp-file.patch @@ -0,0 +1,100 @@ +commit f8c42c6286f3077fc8762ba2c8323026b736a3e8 +Author: roessler <roessler> +Date: Mon Oct 9 13:39:38 2006 +0000 + + From: Thomas Roessler <roessler@does-not-exist.org> + + Even more paranoid temporary file creation. + +diff --git a/lib.c b/lib.c +index aac0742..d672a8a 100644 +--- a/lib.c ++++ b/lib.c +@@ -481,14 +481,85 @@ int safe_rename (const char *src, const + return 0; + } + ++/* Create a temporary directory next to a file name */ ++ ++int mutt_mkwrapdir (const char *path, char *newfile, size_t nflen, ++ char *newdir, size_t ndlen) ++{ ++ const char *basename; ++ char parent[_POSIX_PATH_MAX]; ++ char *p; ++ int rv; ++ ++ strfcpy (parent, NONULL (path), sizeof (parent)); ++ ++ if ((p = strrchr (parent, '/'))) ++ { ++ *p = '\0'; ++ basename = p + 1; ++ } ++ else ++ { ++ strfcpy (parent, ".", sizeof (parent)); ++ basename = path; ++ } ++ ++ do ++ { ++ snprintf (newdir, ndlen, "%s/%s", parent, ".muttXXXXXX"); ++ mktemp (newdir); ++ } ++ while ((rv = mkdir (newdir, 0700)) == -1 && errno == EEXIST); ++ ++ if (rv == -1) ++ return -1; ++ ++ snprintf (newfile, nflen, "%s/%s", newdir, NONULL(basename)); ++ return 0; ++} ++ ++int mutt_put_file_in_place (const char *path, const char *safe_file, const char *safe_dir) ++{ ++ int rv; ++ ++ rv = safe_rename (safe_file, path); ++ unlink (safe_file); ++ rmdir (safe_dir); ++ return rv; ++} ++ + int safe_open (const char *path, int flags) + { + struct stat osb, nsb; + int fd; + +- if ((fd = open (path, flags, 0600)) < 0) +- return fd; ++ if (flags & O_EXCL) ++ { ++ char safe_file[_POSIX_PATH_MAX]; ++ char safe_dir[_POSIX_PATH_MAX]; + ++ if (mutt_mkwrapdir (path, safe_file, sizeof (safe_file), ++ safe_dir, sizeof (safe_dir)) == -1) ++ return -1; ++ ++ if ((fd = open (safe_file, flags, 0600)) < 0) ++ { ++ rmdir (safe_dir); ++ return fd; ++ } ++ ++ if (mutt_put_file_in_place (path, safe_file, safe_dir) == -1) ++ { ++ close (fd); ++ return -1; ++ } ++ } ++ else ++ { ++ if ((fd = open (path, flags, 0600)) < 0) ++ return fd; ++ } ++ + /* make sure the file is not symlink */ + if (lstat (path, &osb) < 0 || fstat (fd, &nsb) < 0 || + compare_stat(&osb, &nsb) == -1) |