0
0
mirror of https://github.com/cjdelisle/cjdns synced 2025-10-06 00:32:50 +02:00

Do not reply to 'sq' messages because they must be replied only by the snode

This commit is contained in:
Caleb James DeLisle
2025-03-17 18:22:36 +00:00
parent a86a188181
commit 2e7bca4ae8

View File

@@ -13,6 +13,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "benc/String.h"
#include "dht/CJDHTConstants.h"
#include "dht/DHTMessage.h"
#include "dht/DHTModule.h"
@@ -58,7 +59,8 @@ void ReplyModule_register(struct DHTModuleRegistry* registry, struct Allocator*
static int handleIncoming(struct DHTMessage* message, void* vcontext)
{
String* q = Dict_getString(message->asDict, CJDHTConstants_QUERY);
if (Dict_getString(message->asDict, CJDHTConstants_QUERY) == NULL) {
// Do not reply to sq queries, otherwise we end up speaking on behalf of the snode
if (q == NULL || String_equals(q, String_CONST("sq"))) {
return 0;
}