From 8b2c62adfcd9a0566e5fcdc9a69c6678817018af Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 6 Jan 2020 14:48:39 +0100 Subject: [PATCH] Revert "Verify index-meta" This reverts commit 09125769bd76819b91416e39cd94c424f42b6a59. --- lib/repo.c | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/lib/repo.c b/lib/repo.c index fd28da81..c855b07c 100644 --- a/lib/repo.c +++ b/lib/repo.c @@ -77,36 +77,15 @@ repo_get_dict(struct xbps_repo *repo) archive_error_string(repo->ar)); return NULL; } - return xbps_archive_get_dictionary(repo->ar, entry); -} - - -xbps_dictionary_t HIDDEN -get_safe_idxmeta(xbps_dictionary_t full) { - static const char *keys[] = { - "public-key", - "public-key-size", - "signature-by", - "signature-type", - }; - static const unsigned fields_count = (sizeof keys)/(sizeof *keys); - xbps_dictionary_t safe = NULL; - - if (full == NULL) { - return NULL; - } - - safe = xbps_dictionary_create(); - - for (unsigned i = 0; i < fields_count; ++i) { - const char *key = keys[i]; - xbps_object_t value = xbps_dictionary_get(full, key); - if (value != NULL) { - xbps_dictionary_set(safe, key, value); - } - } - - return safe; + dict = xbps_archive_get_dictionary(repo->ar, entry, &bytes); + if (verified != NULL && + bytes != NULL && + (digest = xbps_buffer_hash_raw(bytes, strlen(bytes))) != NULL && + repo_verify_index(repo, digest)) + *verified = true; + free(digest); + free(bytes); + return dict; } bool