summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2023-04-17 14:18:42 +0300
committerTimo Teräs <timo.teras@iki.fi>2023-04-17 14:18:42 +0300
commiteffc3f45b4a9ed2614af624bbc0135e1d0fafb15 (patch)
tree7af0c78cb6b1f73f86f776554170363b3c51a10a
parentf8ad60ed2a22f6783a3b82baeaefcd122930ccd9 (diff)
downloadapk-tools-effc3f45b4a9ed2614af624bbc0135e1d0fafb15.tar.gz
apk-tools-effc3f45b4a9ed2614af624bbc0135e1d0fafb15.tar.bz2
apk-tools-effc3f45b4a9ed2614af624bbc0135e1d0fafb15.tar.xz
apk-tools-effc3f45b4a9ed2614af624bbc0135e1d0fafb15.zip
audit: report new file checksum always in details
-rw-r--r--src/app_audit.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/app_audit.c b/src/app_audit.c
index 694d8b5..a8be79f 100644
--- a/src/app_audit.c
+++ b/src/app_audit.c
@@ -128,17 +128,26 @@ static int audit_file(struct audit_ctx *actx,
int dirfd, const char *name,
struct apk_file_info *fi)
{
+ int csum_type = APK_CHECKSUM_DEFAULT;
+ int xattr_csum_type = APK_CHECKSUM_DEFAULT;
int rv = 0;
- if (!dbf) return 'A';
+ if (dbf) {
+ csum_type = dbf->csum.type;
+ 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_CSUM(dbf->csum.type),
+ APK_FI_XATTR_CSUM(xattr_csum_type) |
+ APK_FI_CSUM(csum_type),
fi, &db->atoms) != 0)
return 'e';
+ if (!dbf) return 'A';
+
if (dbf->csum.type != APK_CHECKSUM_NONE &&
apk_checksum_compare(&fi->csum, &dbf->csum) != 0)
rv = 'U';