aboutsummaryrefslogtreecommitdiffstats
path: root/src/database.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2019-12-13 15:22:33 +0200
committerTimo Teräs <timo.teras@iki.fi>2020-04-01 15:58:49 +0300
commite79226010a0641f701b6e12392e176cc2cf58d72 (patch)
treedec5311a1fc0cfb837b4af4038cab7bdedc2bb4c /src/database.c
parentd6c54f932054c58aee8f7a6d2bd49b115d804da1 (diff)
downloadaports-e79226010a0641f701b6e12392e176cc2cf58d72.tar.bz2
aports-e79226010a0641f701b6e12392e176cc2cf58d72.tar.xz
adb: introduce apk-tools database format, and few appletsv3.0-wip
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.
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)