mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-05-11 09:48:24 +02:00
git-svn-id: http://svn.ipfire.org/svn/ipfire/IPFire/source@16 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
63
src/patches/gzip-1.3.5-perm.patch
Normal file
63
src/patches/gzip-1.3.5-perm.patch
Normal file
@@ -0,0 +1,63 @@
|
||||
fix CAN-2005-0988 race condition when setting file permissions
|
||||
borrowed from fedora
|
||||
|
||||
--- gzip-1.3.5/gzip.c.perm 2005-04-26 14:22:58.211395152 +0200
|
||||
+++ gzip-1.3.5/gzip.c 2005-04-26 14:24:10.414418624 +0200
|
||||
@@ -881,6 +881,20 @@
|
||||
}
|
||||
|
||||
close(ifd);
|
||||
+ /* ofd ownership and permissions have to be set before close(ofd)*/
|
||||
+ if (!to_stdout) {
|
||||
+ if (fchmod(ofd, istat.st_mode & 07777)) {
|
||||
+ int e = errno;
|
||||
+ WARN((stderr, "%s: ", progname));
|
||||
+ if (!quiet) {
|
||||
+ errno = e;
|
||||
+ perror(ofname);
|
||||
+ }
|
||||
+ }
|
||||
+#ifndef NO_CHOWN
|
||||
+ fchown(ofd, istat.st_uid, istat.st_gid); /* Copy ownership */
|
||||
+#endif
|
||||
+ }
|
||||
if (!to_stdout && close(ofd)) {
|
||||
write_error();
|
||||
}
|
||||
@@ -902,7 +916,7 @@
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
}
|
||||
- /* Copy modes, times, ownership, and remove the input file */
|
||||
+ /* Copy times and remove the input file */
|
||||
if (!to_stdout) {
|
||||
copy_stat(&istat);
|
||||
}
|
||||
@@ -1715,7 +1729,7 @@
|
||||
|
||||
|
||||
/* ========================================================================
|
||||
- * Copy modes, times, ownership from input file to output file.
|
||||
+ * Copy times from input file to output file.
|
||||
* IN assertion: to_stdout is false.
|
||||
*/
|
||||
local void copy_stat(ifstat)
|
||||
@@ -1730,18 +1744,6 @@
|
||||
}
|
||||
reset_times(ofname, ifstat);
|
||||
#endif
|
||||
- /* Copy the protection modes */
|
||||
- if (chmod(ofname, ifstat->st_mode & 07777)) {
|
||||
- int e = errno;
|
||||
- WARN((stderr, "%s: ", progname));
|
||||
- if (!quiet) {
|
||||
- errno = e;
|
||||
- perror(ofname);
|
||||
- }
|
||||
- }
|
||||
-#ifndef NO_CHOWN
|
||||
- chown(ofname, ifstat->st_uid, ifstat->st_gid); /* Copy ownership */
|
||||
-#endif
|
||||
remove_ofname = 0;
|
||||
/* It's now safe to remove the input file: */
|
||||
if (xunlink (ifname)) {
|
||||
Reference in New Issue
Block a user