Set injected control packet lengths so replay and quota checks execute

This commit is contained in:
evgeny committed 2026-10-01 16:40:53 +03:00
1 parent 7bd3e0d4de
commit ef5cd63d9f
1 file changed
+3 -1
+3 -1
View File
@@ -158,6 +158,7 @@ static void control(struct media_test* t, int dst, uint64_t source, uint8_t cmd,
struct ETCP_CONN* conn = instance_find_conn(inst, t->ids[dst == S ? M : S]);
struct ll_entry* e = ll_alloc_lldgram((uint16_t)(ROUTER_SVC_PAYLOAD_OFF + 1 + len));
if (!conn || !e) { if (e) { queue_dgram_free(e); queue_entry_free(e); } failure(t, "control fixture unavailable"); return; }
e->len = (uint16_t)(ROUTER_SVC_PAYLOAD_OFF + 1 + len);
memset(e->dgram, 0, e->len);
e->dgram[0] = ETCP_RT_ID_DM_MEDIA;
memcpy(e->dgram + ROUTER_SVC_SRC_OFF, &source, 8); memcpy(e->dgram + ROUTER_SVC_DST_OFF, &inst->node_id, 8);
@@ -195,7 +196,8 @@ static int protocol_checks(struct media_test* t) {
uint64_t size = 2 * 1024 * 1024;
memcpy(metadata + 16, &size, 8);
if (sc_ed25519_sign(a->my_ed25519_privkey, request + 8, t->body_len - DM_MSG_SIG_SIZE,
request + 8 + t->body_len - DM_MSG_SIG_SIZE) || chat_setting_set(m, "dm_media_storage_mb", "1")) return -1;
request + 8 + t->body_len - DM_MSG_SIG_SIZE) ||
dm_verify_message(m, t->ids[B], request + 8, t->body_len) || chat_setting_set(m, "dm_media_storage_mb", "1")) return -1;
control(t, M, t->ids[S], DM_MEDIA_STORE, request, 8 + t->body_len);
if (value(m, "SELECT count(*) FROM dm_custody") != 0 || chat_setting_set(m, "dm_media_storage_mb", "1024")) return -1;
char path[768]; snprintf(path, sizeof(path), "%s/cancelled.download", t->dir);