diff options
author | Timo Teräs <timo.teras@iki.fi> | 2023-04-17 14:18:42 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2023-04-17 14:21:43 +0300 |
commit | 97e2a10884f2887724ec6d27a15043dea38998a9 (patch) | |
tree | 4ebd058690bf7cec4861e5d4653425337fbab7d3 | |
parent | 539c8fabb2ebed9f5965b6d0e76b49ffc66147b9 (diff) | |
download | apk-tools-97e2a10884f2887724ec6d27a15043dea38998a9.tar.gz apk-tools-97e2a10884f2887724ec6d27a15043dea38998a9.tar.bz2 apk-tools-97e2a10884f2887724ec6d27a15043dea38998a9.tar.xz apk-tools-97e2a10884f2887724ec6d27a15043dea38998a9.zip |
audit: report new file checksum always in details
-rw-r--r-- | src/app_audit.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/app_audit.c b/src/app_audit.c index a4e81d9..2ef0bb2 100644 --- a/src/app_audit.c +++ b/src/app_audit.c @@ -130,17 +130,26 @@ static int audit_file(struct audit_ctx *actx, int dirfd, const char *name, struct apk_file_info *fi) { + int digest_type = APK_DIGEST_SHA256; + int xattr_csum_type = APK_CHECKSUM_DEFAULT; int rv = 0; - if (!dbf) return 'A'; + if (dbf) { + digest_type = apk_dbf_digest(dbf); + xattr_csum_type = dbf->acl->xattr_csum.type ?: APK_CHECKSUM_DEFAULT; + } else { + if (!actx->details) return 'A'; + } if (apk_fileinfo_get(dirfd, name, APK_FI_NOFOLLOW | - APK_FI_XATTR_CSUM(dbf->acl->xattr_csum.type ?: APK_CHECKSUM_DEFAULT) | - APK_FI_DIGEST(apk_dbf_digest(dbf)), + APK_FI_XATTR_CSUM(xattr_csum_type) | + APK_FI_DIGEST(digest_type), fi, &db->atoms) != 0) return 'e'; + if (!dbf) return 'A'; + if (dbf->csum.type != APK_CHECKSUM_NONE && apk_digest_cmp_csum(&fi->digest, &dbf->csum) != 0) rv = 'U'; |