File 0029-appliance-Don-t-set-utime-on-cachedir-until-we-know-.patch of Package libguestfs
From 8bb4f8cc2af624e2a581a30dda280a790d3eb46b Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones@redhat.com>
Date: Sat, 11 Dec 2010 23:35:18 +0000
Subject: [PATCH 29/72] appliance: Don't set utime on cachedir until we know it is safe.
This could be used to touch an arbitrary file (albeit one which
must already exist), and this could have been a security problem.
(cherry picked from commit a6bfc9f3c44c6b4421d5a7b1d872411583a5cffa)
---
src/appliance.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/src/appliance.c b/src/appliance.c
index d7e7058..facef02 100644
--- a/src/appliance.c
+++ b/src/appliance.c
@@ -324,7 +324,6 @@ check_for_cached_appliance (guestfs_h *g,
snprintf (filename, len, "%s/checksum", cachedir);
(void) mkdir (cachedir, 0755);
- (void) utime (cachedir, NULL);
/* See if the cache directory exists and passes some simple checks
* to make sure it has not been tampered with.
@@ -348,6 +347,8 @@ check_for_cached_appliance (guestfs_h *g,
return -1;
}
+ (void) utime (cachedir, NULL);
+
garbage_collect_appliances (cachedir);
/* Try to open and acquire a lock on the checksum file. */
--
1.7.1