gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnunet] 108/164: Added some more sec checks


From: gnunet
Subject: [gnunet] 108/164: Added some more sec checks
Date: Fri, 30 Jul 2021 15:32:54 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository gnunet.

commit cee65f84cdbfee202e7bb301ac0ed14506e40f45
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Mon May 24 14:13:48 2021 +0200

    Added some more sec checks
---
 src/setu/gnunet-service-setu.c | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index b72ac662b..284beee46 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -2927,8 +2927,6 @@ handle_union_p2p_full_element (void *cls,
                        &ee->element_hash);
   if (NULL != ke)
   {
-    /* Got repeated element.  Should not happen since
-     * we track demands. */
     GNUNET_STATISTICS_update (_GSS_statistics,
                               "# repeated elements",
                               1,
@@ -2948,15 +2946,16 @@ handle_union_p2p_full_element (void *cls,
                          GNUNET_SETU_STATUS_ADD_LOCAL);
   }
 
+  uint64_t received_repeated = op->received_total - op->received_fresh;
+
   if ((GNUNET_YES == op->byzantine) &&
-      (op->received_total > 384 + op->received_fresh * 4) &&
-      (op->received_fresh < op->received_total / 6))
+      op->received_total > op->remote_element_count)
   {
     /* The other peer gave us lots of old elements, there's something wrong. */
     LOG (GNUNET_ERROR_TYPE_ERROR,
-         "Other peer sent only %llu/%llu fresh elements, failing operation\n",
-         (unsigned long long) op->received_fresh,
-         (unsigned long long) op->received_total);
+         "Other peer sent %llu elements while pretending to have %llu 
elements, failing operation\n",
+         (unsigned long long) op->received_total,
+         (unsigned long long) op->remote_element_count);
     GNUNET_break_op (0);
     fail_union_operation (op);
     return;
@@ -3178,6 +3177,19 @@ handle_union_p2p_full_done (void *cls,
     {
       struct GNUNET_MQ_Envelope *ev;
 
+        if ((GNUNET_YES == op->byzantine) &&
+            op->received_total != op->remote_element_count)
+        {
+            /* The other peer gave not enough elements before sending full 
done, there's something wrong. */
+            LOG (GNUNET_ERROR_TYPE_ERROR,
+                 "Other peer sent only %llu/%llu fresh elements, failing 
operation\n",
+                 (unsigned long long) op->received_total,
+                 (unsigned long long) op->remote_element_count);
+            GNUNET_break_op (0);
+            fail_union_operation (op);
+            return;
+        }
+
       LOG (GNUNET_ERROR_TYPE_DEBUG,
            "got FULL DONE, sending elements that other peer is missing\n");
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]