summaryrefslogtreecommitdiffstats
path: root/src/audit.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-08-06 14:25:03 +0300
committerTimo Teras <timo.teras@iki.fi>2009-08-06 14:25:03 +0300
commitecdacd15032578148489f868fd928fb502032c60 (patch)
treee8ad3d487b60017f3f4975d09bbeac4a77b8d0b7 /src/audit.c
parentfac43e2d60b550425481052e521d141730a303de (diff)
downloadapk-tools-ecdacd15032578148489f868fd928fb502032c60.tar.bz2
apk-tools-ecdacd15032578148489f868fd928fb502032c60.tar.xz
all: implement database open options
so user can override trusted keys directory and repositories file.
Diffstat (limited to 'src/audit.c')
-rw-r--r--src/audit.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/src/audit.c b/src/audit.c
index 67cefac..df6dbdc 100644
--- a/src/audit.c
+++ b/src/audit.c
@@ -144,7 +144,8 @@ static int audit_system(struct apk_database *db)
return 0;
}
-static int audit_parse(void *ctx, int optch, int optindex, const char *optarg)
+static int audit_parse(void *ctx, struct apk_db_options *dbopts,
+ int optch, int optindex, const char *optarg)
{
struct audit_ctx *actx = (struct audit_ctx *) ctx;
@@ -161,26 +162,14 @@ static int audit_parse(void *ctx, int optch, int optindex, const char *optarg)
return 0;
}
-static int audit_main(void *ctx, int argc, char **argv)
+static int audit_main(void *ctx, struct apk_database *db, int argc, char **argv)
{
struct audit_ctx *actx = (struct audit_ctx *) ctx;
- struct apk_database db;
- int r;
if (actx->audit == NULL)
return -EINVAL;
- r = apk_db_open(&db, apk_root,
- APK_OPENF_READ | APK_OPENF_NO_SCRIPTS |
- APK_OPENF_NO_REPOS);
- if (r != 0) {
- apk_error("Unable to open db: %s", apk_error_str(r));
- return r;
- }
- r = actx->audit(&db);
- apk_db_close(&db);
-
- return r;
+ return actx->audit(db);
}
static struct apk_option audit_options[] = {
@@ -194,6 +183,7 @@ static struct apk_applet apk_audit = {
.name = "audit",
.help = "Audit the filesystem for changes compared to installed "
"database.",
+ .open_flags = APK_OPENF_READ|APK_OPENF_NO_SCRIPTS|APK_OPENF_NO_REPOS,
.context_size = sizeof(struct audit_ctx),
.num_options = ARRAY_SIZE(audit_options),
.options = audit_options,