aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/database.c b/src/database.c
index cbc6667523..57347a539c 100644
--- a/src/database.c
+++ b/src/database.c
@@ -1656,6 +1656,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));
@@ -1831,6 +1837,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)