From dee30bda7c677a2d7efc98a2fa4443c8080190be Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Thu, 23 Feb 2012 12:30:01 -0500 Subject: [PATCH] pull: Only fetch .archive-content for regular files Otherwise e.g. Apache httpd might try to follow a symbolic link to /bin/tinylogin which clearly won't work. --- src/ostree/ostree-pull.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ostree/ostree-pull.c b/src/ostree/ostree-pull.c index d1553c83..6b954bac 100644 --- a/src/ostree/ostree-pull.c +++ b/src/ostree/ostree-pull.c @@ -256,14 +256,6 @@ store_tree_recurse (OstreeRepo *repo, error)) goto out; - g_clear_object (&content_file); - if (!fetch_object (repo, soup, base_uri, checksum, - OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT, - &did_exist, - &content_file, - error)) - goto out; - if (!ostree_map_metadata_file (meta_file, OSTREE_OBJECT_TYPE_ARCHIVED_FILE_META, &archive_metadata, error)) goto out; @@ -271,8 +263,17 @@ store_tree_recurse (OstreeRepo *repo, if (!ostree_parse_archived_file_meta (archive_metadata, &archive_file_info, &archive_xattrs, error)) goto out; + g_clear_object (&input); + g_clear_object (&content_file); if (g_file_info_get_file_type (archive_file_info) == G_FILE_TYPE_REGULAR) { + if (!fetch_object (repo, soup, base_uri, checksum, + OSTREE_OBJECT_TYPE_ARCHIVED_FILE_CONTENT, + &did_exist, + &content_file, + error)) + goto out; + input = (GInputStream*)g_file_read (content_file, NULL, error); if (!input) goto out;