From 042879f417fa1d0a0ab174b4c8f3847ee1f148b5 Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Thu, 23 Jul 2009 11:41:10 +0300 Subject: index: fully process archive when reading index for signature check can't cancel an index reading or we lose signature checking. --- src/database.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/database.c b/src/database.c index 076f72f..bf0a0a6 100644 --- a/src/database.c +++ b/src/database.c @@ -1146,7 +1146,7 @@ int apk_repository_update(struct apk_database *db, struct apk_repository *repo) struct apkindex_ctx { struct apk_database *db; struct apk_sign_ctx sctx; - int repo; + int repo, found; }; static int load_apkindex(void *sctx, const struct apk_file_info *fi, @@ -1161,11 +1161,12 @@ static int load_apkindex(void *sctx, const struct apk_file_info *fi, if (strcmp(fi->name, "APKINDEX") != 0) return 0; + ctx->found = 1; bs = apk_bstream_from_istream(is); apk_db_index_read(ctx->db, bs, ctx->repo); bs->close(bs, NULL); - return -ECANCELED; + return 0; } static int load_index(struct apk_database *db, struct apk_bstream *bs, @@ -1179,15 +1180,14 @@ static int load_index(struct apk_database *db, struct apk_bstream *bs, ctx.db = db; ctx.repo = repo; + ctx.found = 0; apk_sign_ctx_init(&ctx.sctx, APK_SIGN_VERIFY, NULL); is = apk_bstream_gunzip_mpart(bs, apk_sign_ctx_mpart_cb, &ctx.sctx); r = apk_tar_parse(is, load_apkindex, &ctx); is->close(is); apk_sign_ctx_free(&ctx.sctx); - if (r == 0) + if (ctx.found == 0) r = -ENOMSG; - else if (r == -ECANCELED) - r = 0; } else { bs = apk_bstream_from_istream(apk_bstream_gunzip(bs)); apk_db_index_read(db, bs, repo); -- cgit v1.2.3-70-g09d2