Check cleanup retries, request ownership and stream rollback
This commit is contained in:
1 parent
87b22966b7
commit
fe182e4acc
3 files changed
+78
-6
No files matched your search
+14
-5
@@ -559,13 +559,18 @@ static int member_apply_record(struct UTUN_INSTANCE* inst, const char* ch_id,
|
||||
int has_signature = m->signature && !_sig_is_zero64(m->signature);
|
||||
if (!is_local) {
|
||||
/* жёсткая привязка идентичности: node_id = derive(x25519), ed25519 — доверенный из nodes */
|
||||
if (sc_derive_node_id_from_pubkey(m->x25519) != m->node_id) {
|
||||
uint64_t derived = sc_derive_node_id_from_pubkey(m->x25519);
|
||||
if (!derived) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_MEMBER_SYNC, "%s: identity verification unavailable ns=%s", MS_ID, ch_id); return MT_ERR_IO;
|
||||
}
|
||||
if (derived != m->node_id) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_MEMBER_SYNC, "%s: apply_record node_id/x25519 mismatch (forgery) nid=0x%016llx ns=%s", MS_ID, (unsigned long long)m->node_id, ch_id);
|
||||
identity_ok = 0;
|
||||
} else {
|
||||
uint8_t trusted_ed[32];
|
||||
if (topo_node_sqlite_get_ed25519_pubkey(db, m->node_id, trusted_ed) == 0
|
||||
&& memcmp(m->ed25519, trusted_ed, 32) != 0) {
|
||||
int lookup = topo_node_sqlite_get_ed25519_pubkey(db, m->node_id, trusted_ed);
|
||||
if (lookup == TOPO_SQLITE_LOOKUP_ERROR) return MT_ERR_IO;
|
||||
if (lookup == 0 && memcmp(m->ed25519, trusted_ed, 32) != 0) {
|
||||
DEBUG_ERROR(DEBUG_CATEGORY_MEMBER_SYNC, "%s: apply_record ed25519 mismatch trusted (forgery) nid=0x%016llx ns=%s", MS_ID, (unsigned long long)m->node_id, ch_id);
|
||||
identity_ok = 0;
|
||||
}
|
||||
@@ -670,8 +675,12 @@ static int member_apply_record(struct UTUN_INSTANCE* inst, const char* ch_id,
|
||||
}
|
||||
|
||||
/* Подпись приглашения не зависит от версии профиля: подтверждаем уже сохранённого мембера. */
|
||||
int signature_changed = has_local && has_signature && _sig_is_zero64(local_signature)
|
||||
&& member_sync_verify_signature(db, ch_id, m) == 1;
|
||||
int signature_changed = has_local && has_signature && _sig_is_zero64(local_signature);
|
||||
if (signature_changed) {
|
||||
int verified = member_sync_verify_signature(db, ch_id, m);
|
||||
if (verified == MS_VERIFY_ERROR) return MT_ERR_IO;
|
||||
signature_changed = verified == 1;
|
||||
}
|
||||
|
||||
/* ── запись изменённых блоков ── */
|
||||
if (block_a_changed) {
|
||||
|
||||
Reference in new issue
Block a user