From 8e23a2ba4eb7f6192c6bce8a6da81004803eca3f Mon Sep 17 00:00:00 2001 From: Timo Teras Date: Fri, 14 Nov 2008 14:26:59 +0200 Subject: db: checksum installed files, protect config files Checksum of installed is computed on the fly when extracting them and it'll be saved to fdb. When installing config files those are diverted with suffix .apk-new if earlier version of same file with local changes exist. --- src/apk_defines.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/apk_defines.h') diff --git a/src/apk_defines.h b/src/apk_defines.h index d6557a2..64abe72 100644 --- a/src/apk_defines.h +++ b/src/apk_defines.h @@ -12,6 +12,8 @@ #ifndef APK_DEFINES_H #define APK_DEFINES_H +#include + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) #define BIT(x) (1 << (x)) @@ -36,12 +38,15 @@ #if 1 #include "md5.h" +typedef unsigned char *csum_p; typedef md5sum_t csum_t; typedef struct md5_ctx csum_ctx_t; +extern csum_t bad_checksum; #define csum_init(ctx) md5_init(ctx) #define csum_process(ctx, buf, len) md5_process(ctx, buf, len) #define csum_finish(ctx, buf) md5_finish(ctx, buf) +#define csum_valid(buf) memcmp(buf, bad_checksum, sizeof(csum_t)) #endif extern int apk_cwd_fd, apk_quiet; @@ -76,6 +81,8 @@ void apk_log(const char *prefix, const char *format, ...); return &(*a)->item[size-1]; \ } +APK_ARRAY(apk_string_array, char *); + #define LIST_END (void *) 0xe01 #define LIST_POISON1 (void *) 0xdeadbeef #define LIST_POISON2 (void *) 0xabbaabba -- cgit v1.2.3