Added support to check the SHA256 hash for any binpkg before installation happens.
--HG-- extra : convert_revision : 4f812eb0cfb614461527e360db1692bd5f9c34aa
This commit is contained in:
@@ -599,6 +599,7 @@ xbps_install_pkg_deps(const char *pkgname, const char *destdir, int flags)
|
||||
prop_array_t required, missing;
|
||||
prop_object_t obj;
|
||||
prop_object_iterator_t iter;
|
||||
const char *repoloc;
|
||||
int rv = 0;
|
||||
|
||||
/*
|
||||
@@ -623,11 +624,22 @@ xbps_install_pkg_deps(const char *pkgname, const char *destdir, int flags)
|
||||
if (required == NULL)
|
||||
return 0;
|
||||
|
||||
|
||||
iter = prop_array_iterator(required);
|
||||
if (iter == NULL)
|
||||
return ENOMEM;
|
||||
|
||||
/*
|
||||
* Check the SHA256 hash for any binary package that's going
|
||||
* to be installed.
|
||||
*/
|
||||
while ((obj = prop_object_iterator_next(iter)) != NULL) {
|
||||
prop_dictionary_get_cstring_nocopy(obj, "repository", &repoloc);
|
||||
rv = xbps_check_pkg_file_hash(obj, repoloc);
|
||||
if (rv != 0)
|
||||
goto out;
|
||||
}
|
||||
prop_object_iterator_reset(iter);
|
||||
|
||||
/*
|
||||
* Install all required dependencies, previously sorted.
|
||||
*/
|
||||
@@ -636,6 +648,8 @@ xbps_install_pkg_deps(const char *pkgname, const char *destdir, int flags)
|
||||
if (rv != 0)
|
||||
break;
|
||||
}
|
||||
|
||||
out:
|
||||
prop_object_iterator_release(iter);
|
||||
|
||||
return rv;
|
||||
|
||||
Reference in New Issue
Block a user