Commit 23d0a224 authored by Timo Teräs's avatar Timo Teräs

ignore .apk-new files for overlays

parent 941fc1b1
...@@ -95,6 +95,7 @@ apk_blob_t apk_blob_pushed(apk_blob_t buffer, apk_blob_t left); ...@@ -95,6 +95,7 @@ apk_blob_t apk_blob_pushed(apk_blob_t buffer, apk_blob_t left);
unsigned long apk_blob_hash_seed(apk_blob_t, unsigned long seed); unsigned long apk_blob_hash_seed(apk_blob_t, unsigned long seed);
unsigned long apk_blob_hash(apk_blob_t str); unsigned long apk_blob_hash(apk_blob_t str);
int apk_blob_compare(apk_blob_t a, apk_blob_t b); int apk_blob_compare(apk_blob_t a, apk_blob_t b);
int apk_blob_ends_with(apk_blob_t str, apk_blob_t suffix);
int apk_blob_for_each_segment(apk_blob_t blob, const char *split, int apk_blob_for_each_segment(apk_blob_t blob, const char *split,
apk_blob_cb cb, void *ctx); apk_blob_cb cb, void *ctx);
......
...@@ -111,7 +111,7 @@ static int audit_file(struct audit_ctx *actx, ...@@ -111,7 +111,7 @@ static int audit_file(struct audit_ctx *actx,
apk_checksum_compare(&fi.csum, &dbf->csum) != 0) apk_checksum_compare(&fi.csum, &dbf->csum) != 0)
rv = 'U'; rv = 'U';
else if (apk_checksum_compare(&fi.xattr_csum, &dbf->acl->xattr_csum) != 0) else if (apk_checksum_compare(&fi.xattr_csum, &dbf->acl->xattr_csum) != 0)
rv = 'X'; rv = 'x';
else if (S_ISLNK(fi.mode) && dbf->csum.type == APK_CHECKSUM_NONE) else if (S_ISLNK(fi.mode) && dbf->csum.type == APK_CHECKSUM_NONE)
rv = 'U'; rv = 'U';
else if (actx->check_permissions) { else if (actx->check_permissions) {
...@@ -260,6 +260,10 @@ recurse_check: ...@@ -260,6 +260,10 @@ recurse_check:
if (actx->mode == MODE_SYSTEM && if (actx->mode == MODE_SYSTEM &&
(reason == 'A' || protect_mode != APK_PROTECT_NONE)) (reason == 'A' || protect_mode != APK_PROTECT_NONE))
goto done; goto done;
if (actx->mode == MODE_BACKUP &&
reason == 'A' &&
apk_blob_ends_with(bent, APK_BLOB_STR(".apk-new")))
goto done;
report_audit(actx, reason, bfull, dbf ? dbf->diri->pkg : NULL); report_audit(actx, reason, bfull, dbf ? dbf->diri->pkg : NULL);
} }
......
...@@ -225,6 +225,12 @@ int apk_blob_compare(apk_blob_t a, apk_blob_t b) ...@@ -225,6 +225,12 @@ int apk_blob_compare(apk_blob_t a, apk_blob_t b)
return 1; return 1;
} }
int apk_blob_ends_with(apk_blob_t a, apk_blob_t b)
{
if (a.len < b.len) return 0;
return memcmp(a.ptr+a.len-b.len, b.ptr, b.len) == 0;
}
int apk_blob_for_each_segment(apk_blob_t blob, const char *split, int apk_blob_for_each_segment(apk_blob_t blob, const char *split,
int (*cb)(void *ctx, apk_blob_t blob), void *ctx) int (*cb)(void *ctx, apk_blob_t blob), void *ctx)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment