Preserve PIN retry receipts and initialize full stream test lifecycle
This commit is contained in:
1 parent
8b5f8ae944
commit
9d12bbad39
2 files changed
+4
-5
No files matched your search
@@ -41,9 +41,6 @@ static struct chat_devgroup* dg_ctx(struct UTUN_INSTANCE* inst) { return inst &&
|
||||
static int dg_pending(unsigned state) { return state == DG_WAIT_PIN || state == DG_PIN_SENT || state == DG_KEYS_SENT || state >= DG_WAIT_RETURN; }
|
||||
static void dg_clear_pins(struct dg_invite* p) {
|
||||
OPENSSL_cleanse(p->pin, sizeof(p->pin)); OPENSSL_cleanse(p->entered_pin, sizeof(p->entered_pin));
|
||||
if (!dg_pending(p->state)) {
|
||||
OPENSSL_cleanse(p->last_pin, sizeof(p->last_pin)); OPENSSL_cleanse(p->last_return_pin, sizeof(p->last_return_pin));
|
||||
}
|
||||
}
|
||||
static int dg_random_pin(char pin[5], const char* different) {
|
||||
uint32_t random;
|
||||
@@ -114,6 +111,7 @@ void chat_devgroup_revalidate_members(struct UTUN_INSTANCE* inst, uint64_t group
|
||||
if (!dg_peer(inst, group, p->peer, x, ed) && !memcmp(x, p->x, 32) && !memcmp(ed, p->ed, 32)) continue;
|
||||
p->state = p->state == DG_KEYS_SENT ? DG_UNKNOWN : DG_REJECTED;
|
||||
dg_clear_pins(p); changed = 1;
|
||||
OPENSSL_cleanse(p->last_pin, sizeof(p->last_pin)); OPENSSL_cleanse(p->last_return_pin, sizeof(p->last_return_pin));
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CHAT, "devgroup: invitation revoked group=%llu peer=%016llx state=%u",
|
||||
(unsigned long long)group, (unsigned long long)p->peer, p->state);
|
||||
}
|
||||
@@ -283,6 +281,7 @@ void chat_devgroup_cancel_pending(struct UTUN_INSTANCE* inst) {
|
||||
struct dg_invite* p = &ctx->slots[i]; if (!dg_pending(p->state)) continue;
|
||||
p->state = p->state == 3 ? 7 : 5;
|
||||
dg_clear_pins(p);
|
||||
OPENSSL_cleanse(p->last_pin, sizeof(p->last_pin)); OPENSSL_cleanse(p->last_return_pin, sizeof(p->last_return_pin));
|
||||
DEBUG_INFO(DEBUG_CATEGORY_CHAT, "devgroup: invitation cancelled peer=%016llx state=%u", (unsigned long long)p->peer, p->state);
|
||||
}
|
||||
dg_changed(ctx);
|
||||
|
||||
@@ -236,7 +236,8 @@ static int api_stream_packet(const struct stream_message* m, const void* payload
|
||||
|
||||
static int api_streams(void) {
|
||||
struct UTUN_INSTANCE* server = fixture.nodes[0]; struct UTUN_INSTANCE* client = fixture.nodes[1];
|
||||
for (unsigned i = 0; i < 2; i++) REQUIRE(!chat_service_start(fixture.nodes[i]));
|
||||
/* Предыдущие сценарии запускали модули вручную; перейти к штатному полному lifecycle чата. */
|
||||
for (unsigned i = 0; i < 2; i++) { chat_core_destroy(fixture.nodes[i]); REQUIRE(!chat_service_start(fixture.nodes[i])); }
|
||||
fixture.receivers[ETCP_ID_STREAM] = server->api_bindings.callbacks[ETCP_ID_STREAM];
|
||||
server->api_bindings.callbacks[ETCP_ID_STREAM] = observe;
|
||||
api_stream_client = client->api_bindings.callbacks[ETCP_ID_STREAM]; client->api_bindings.callbacks[ETCP_ID_STREAM] = api_stream_observe;
|
||||
@@ -277,7 +278,6 @@ static int api_streams(void) {
|
||||
REQUIRE(!send_routed(&saved, relay_wire, sizeof(relay_wire), 0));
|
||||
REQUIRE(!send_routed(&saved, relay_wire, sizeof(relay_wire), ROUTE_CRYPTO_SIGN));
|
||||
check("STREAM relay requires both signature and encryption", net->relay_request_count == 1);
|
||||
struct SVC_ROUTE_HDR wrong_group = saved; wrong_group.group_id = 111;
|
||||
REQUIRE(!api_send(111, ETCP_RT_ID_STREAM, relay_wire, sizeof(relay_wire)));
|
||||
check("STREAM routed group must match payload group", net->relay_request_count == 1);
|
||||
REQUIRE(!api_admit(112, client->node_id, 0)); lease = f->deadline;
|
||||
|
||||
Reference in new issue
Block a user