From a13488312502b3f12c549040b529091be78e8f82 Mon Sep 17 00:00:00 2001 From: moon Date: Mon, 15 Sep 2025 03:15:42 +0330 Subject: remove auth for querying by author --- src/common.c | 7 +------ src/server.c | 11 ++--------- 2 files changed, 3 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/common.c b/src/common.c index 0cc0240..c85d166 100644 --- a/src/common.c +++ b/src/common.c @@ -50,12 +50,7 @@ enum client_input { register_neighbor = 0x15, // query packets for a specific author - // note: to prevent DoS, you must provide a signature by the requested author to be approved. - // the signature needs to be from a struct shaped `public_key + pub_sign_key + u16 count + u64 - // offset`. - // server must verify the signing key is of the author's pubkey and signing key by looking at - // the packet's metadata. - // (input public_key, input pub_sign_key, signature, u16 count, u64 offset) + // (input public_key, pub_sign_key, u16 count, u64 offset) // (responds with queried_author_packets) query_packets = 0x16, diff --git a/src/server.c b/src/server.c index a228dd7..52437ea 100644 --- a/src/server.c +++ b/src/server.c @@ -565,20 +565,17 @@ void paste_server( } break; case query_packets: { - if (in_len != 1 + 32 + 32 + 64 + 2 + 8) { + if (in_len != 1 + 32 + 32 + 2 + 8) { *out = NULL; *out_len = 0; return; } public_key author_enc, author_sign; - signature sig; size_t off = 1; memcpy(author_enc, in + off, 32); off += 32; memcpy(author_sign, in + off, 32); off += 32; - memcpy(sig, in + off, 64); - off += 64; uint16_t req_count = read_u16_le(in + off); off += 2; uint64_t req_offset = read_u64_le(in + off); @@ -588,11 +585,7 @@ void paste_server( memcpy(msg + 32, author_sign, 32); write_u16_le(msg + 64, req_count); write_u64_le(msg + 66, req_offset); - if (!verify_raw_signature(msg, sizeof(msg), sig, author_sign)) { - *out = NULL; - *out_len = 0; - return; - } + if (req_count > 128) req_count = 128; struct data_packet* packets = malloc((size_t) req_count * sizeof(struct data_packet)); if (!packets) { -- cgit v1.2.3