aboutsummaryrefslogtreecommitdiff
path: root/src/proone-htbthost.c
diff options
context:
space:
mode:
authorDavid Timber <mieabby@gmail.com>2021-08-06 15:59:38 +1000
committerDavid Timber <mieabby@gmail.com>2021-08-06 15:59:38 +1000
commitf6e94a01fd84b693c5a74b8f40edb4dc89836bdf (patch)
tree9c46a7adb7c19b31f45a30de8286045cce120f58 /src/proone-htbthost.c
parenta72b876cf8f7c01ab2d3808a168ef16620498298 (diff)
htbt and protocol overhaul ...
* htbt overhaul * Abandon async slv io. slv io is now synchronous * htbt_do_cmd() * w/ detach flag: set up closed pipes for stdio * Create new pg for child and kill the pg on error * Do waitpid() w/ timeout * Wait for child spawn w/ timeout * Always reap child * Add fork cb for clean up code(to unmask signals, deinit libs) * Protocol overhaul * Use stdio frames to transfer binary data for PRNE_HTBT_OP_UP_BIN and PRNE_HTBT_OP_RUN_BIN op * bin_meta bin_size -> alloc_len. This is an optional field now * Fix protocol * detach flag of cmd_head not being (de)serialised * cmd_head (d)ser funcs not setting actual correctly * Proone: call setsid() on daemonisation * Fix compilation error caused by missing <errno.h>
Diffstat (limited to 'src/proone-htbthost.c')
-rw-r--r--src/proone-htbthost.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/proone-htbthost.c b/src/proone-htbthost.c
index 4aee540..86aadd7 100644
--- a/src/proone-htbthost.c
+++ b/src/proone-htbthost.c
@@ -136,6 +136,15 @@ static bool cb_upbin (
return pth_raise(main_pth, SIGTERM) != 0;
}
+static bool cb_fork (void *ctx) {
+ sigset_t ss;
+
+ sigfillset(&ss);
+ pth_sigmask(SIG_UNBLOCK, &ss, NULL);
+
+ return true;
+}
+
static void load_ssl_conf (
mbedtls_x509_crt *ca,
mbedtls_ssl_config *s_conf,
@@ -509,6 +518,7 @@ int main (const int argc, const char **args) {
param.cb_f.hostinfo = cb_hostinfo;
param.cb_f.tmpfile = mktmpfile;
param.cb_f.upbin = cb_upbin;
+ param.cb_f.fork = cb_fork;
param.blackhole = open("/dev/null", O_WRONLY);
w = wkr_arr + 1;