diff options
author | Timo Teräs <timo.teras@iki.fi> | 2020-09-30 14:11:37 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2020-10-09 16:09:19 +0300 |
commit | efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08 (patch) | |
tree | b04a9d2533148a1fcb4a28560ffd76c4bbc5e5ad /src/database.c | |
parent | 81782bfc150225df75b11efa4fa0ade428ae3676 (diff) | |
download | apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.tar.gz apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.tar.bz2 apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.tar.xz apk-tools-efe0c4afecb9fd3da2ab4849d2b8edd5bea14d08.zip |
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.
Diffstat (limited to 'src/database.c')
-rw-r--r-- | src/database.c | 8 |
1 files changed, 8 insertions, 0 deletions
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) |