From f6e94a01fd84b693c5a74b8f40edb4dc89836bdf Mon Sep 17 00:00:00 2001 From: David Timber Date: Fri, 6 Aug 2021 15:59:38 +1000 Subject: 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 --- src/proone-test_proto.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/proone-test_proto.c') diff --git a/src/proone-test_proto.c b/src/proone-test_proto.c index 4c7caaa..6fad90f 100644 --- a/src/proone-test_proto.c +++ b/src/proone-test_proto.c @@ -487,7 +487,7 @@ static void test_ser (void) { prne_htbt_init_bin_meta(&bm_a); prne_htbt_init_bin_meta(&bm_b); assert(prne_htbt_set_cmd(&bm_a.cmd, test_args)); - bm_a.bin_size = 0xBBAAEE; + bm_a.alloc_len = 0xBBAAEE; assert(prne_htbt_ser_bin_meta( proto_buf, PRNE_HTBT_PROTO_MIN_BUF, @@ -503,6 +503,14 @@ static void test_ser (void) { &actual, &bm_b) == PRNE_HTBT_SER_RC_OK); assert(prne_htbt_eq_bin_meta(&bm_a, &bm_b)); + + bm_a.alloc_len = PRNE_HTBT_BIN_ALLOC_LEN_MAX + 1; + assert(prne_htbt_ser_bin_meta( + proto_buf, + PRNE_HTBT_PROTO_MIN_BUF, + &proto_buf_cnt_len, + &bm_a) == PRNE_HTBT_SER_RC_FMT_ERR); + prne_htbt_free_bin_meta(&bm_a); prne_htbt_free_bin_meta(&bm_b); -- cgit