From efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Wed, 30 Sep 2020 14:11:37 +0300 Subject: adb: introduce apk-tools database format, and few applets This is a flat buffers inspired format that allows fast mmaped access to the data with low overhead, signature support and relatively good forward support. --- src/database.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/database.c') diff --git a/src/database.c b/src/database.c index bbf072e..8298f72 100644 --- a/src/database.c +++ b/src/database.c @@ -1676,6 +1676,12 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts) dbopts->keys_dir ?: "etc/apk/keys", O_RDONLY | O_CLOEXEC); + r = adb_trust_init(&db->trust, dup(db->keys_fd), dbopts->private_keys); + if (r) { + msg = "Unable to read trusted keys"; + goto ret_r; + } + if (apk_flags & APK_OVERLAY_FROM_STDIN) { apk_flags &= ~APK_OVERLAY_FROM_STDIN; apk_db_read_overlay(db, apk_istream_from_fd(STDIN_FILENO)); @@ -1852,6 +1858,8 @@ void apk_db_close(struct apk_database *db) db->cache_remount_dir = NULL; } + adb_trust_free(&db->trust); + if (db->keys_fd) close(db->keys_fd); if (db->cache_fd) -- cgit v1.2.3-70-g09d2