From e9945dc345b11c29e9dad77bc1da16b3ab1560c1 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 4 Jun 2012 14:14:46 +0200 Subject: [PATCH] Before unpacking pkg files always remove INSTALL/REMOVE scripts (if they exist). --- lib/package_unpack.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/lib/package_unpack.c b/lib/package_unpack.c index 088ea06f..872284b5 100644 --- a/lib/package_unpack.c +++ b/lib/package_unpack.c @@ -211,21 +211,17 @@ unpack_archive(prop_dictionary_t pkg_repod, struct archive *ar) rv = errno; goto out; } - if (strcmp(transact, "update") == 0) update = true; - /* - * While updating, always remove current INSTALL/REMOVE - * scripts, because a package upgrade might not have those - * anymore. + * Always remove current INSTALL/REMOVE scripts in pkg's metadir, + * as security measures. */ - if (update) { - if ((rv = remove_metafile("INSTALL", pkgver)) != 0) - goto out; - if ((rv = remove_metafile("REMOVE", pkgver)) != 0) - goto out; - } + if ((rv = remove_metafile("INSTALL", pkgver)) != 0) + goto out; + if ((rv = remove_metafile("REMOVE", pkgver)) != 0) + goto out; + /* * Process the archive files. */