extract: fix extracting untrusted package
parent
a0e59e0897
commit
aa44cfac05
|
@ -141,8 +141,11 @@ static int extract_v3_meta(struct apk_extract_ctx *ectx, struct adb *db)
|
||||||
static int extract_file(struct apk_extract_ctx *ectx, const struct apk_file_info *fi, struct apk_istream *is)
|
static int extract_file(struct apk_extract_ctx *ectx, const struct apk_file_info *fi, struct apk_istream *is)
|
||||||
{
|
{
|
||||||
struct extract_ctx *ctx = container_of(ectx, struct extract_ctx, ectx);
|
struct extract_ctx *ctx = container_of(ectx, struct extract_ctx, ectx);
|
||||||
|
struct apk_out *out = &ctx->ac->out;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
|
apk_dbg2(out, "%s", fi->name);
|
||||||
|
|
||||||
if (fi->uvol_name) return apk_extract_volume(ectx->ac, fi, is);
|
if (fi->uvol_name) return apk_extract_volume(ectx->ac, fi, is);
|
||||||
|
|
||||||
r = apk_extract_file(ctx->root_fd, fi, 0, 0, is, 0, 0, 0,
|
r = apk_extract_file(ctx->root_fd, fi, 0, 0, is, 0, 0, 0,
|
||||||
|
|
|
@ -330,7 +330,7 @@ static int apk_extract_v2_entry(void *pctx, const struct apk_file_info *fi, stru
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sctx->control_verified) return 0;
|
if (!sctx->data_started) return 0;
|
||||||
if (!ectx->ops->file) return -ECANCELED;
|
if (!ectx->ops->file) return -ECANCELED;
|
||||||
return ectx->ops->file(ectx, fi, is);
|
return ectx->ops->file(ectx, fi, is);
|
||||||
}
|
}
|
||||||
|
@ -345,9 +345,9 @@ int apk_extract_v2(struct apk_extract_ctx *ectx, struct apk_istream *is)
|
||||||
if (ectx->generate_identity)
|
if (ectx->generate_identity)
|
||||||
action = trust->allow_untrusted ? APK_SIGN_GENERATE : APK_SIGN_VERIFY_AND_GENERATE;
|
action = trust->allow_untrusted ? APK_SIGN_GENERATE : APK_SIGN_VERIFY_AND_GENERATE;
|
||||||
else if (ectx->identity)
|
else if (ectx->identity)
|
||||||
action = trust->allow_untrusted ? APK_SIGN_NONE : APK_SIGN_VERIFY_IDENTITY;
|
action = APK_SIGN_VERIFY_IDENTITY;
|
||||||
else
|
else
|
||||||
action = trust->allow_untrusted ? APK_SIGN_NONE : APK_SIGN_VERIFY;
|
action = APK_SIGN_VERIFY;
|
||||||
|
|
||||||
if (!ectx->ops) ectx->ops = &extract_v2verify_ops;
|
if (!ectx->ops) ectx->ops = &extract_v2verify_ops;
|
||||||
ectx->pctx = &sctx;
|
ectx->pctx = &sctx;
|
||||||
|
|
Loading…
Reference in New Issue