indicate malformed blocks
authorChristian Grothoff <christian@grothoff.org>
Wed, 6 Oct 2010 11:17:16 +0000 (11:17 +0000)
committerChristian Grothoff <christian@grothoff.org>
Wed, 6 Oct 2010 11:17:16 +0000 (11:17 +0000)
src/block/plugin_block_dht.c
src/block/plugin_block_fs.c
src/include/gnunet_block_lib.h

index 56f99a7650128f898454df9761c20f0fce213aac..c636f00c21c9d727ded77945fb4a1857d07e69a7 100644 (file)
@@ -104,7 +104,7 @@ block_plugin_dht_get_key (void *cls,
                       "block-dht",
                       _("Block not of type %u\n"),
                       GNUNET_BLOCK_TYPE_DHT_HELLO);
-      return GNUNET_SYSERR;
+      return GNUNET_NO;
     }
   msg = block;
   if (block_size != ntohs (msg->size))
@@ -113,7 +113,7 @@ block_plugin_dht_get_key (void *cls,
                       "block-dht",
                       _("Size mismatch for block\n"),
                       GNUNET_BLOCK_TYPE_DHT_HELLO);
-      return GNUNET_SYSERR;
+      return GNUNET_NO;
     }
   hello = block;
   pid = (struct GNUNET_PeerIdentity*) key;
@@ -125,7 +125,7 @@ block_plugin_dht_get_key (void *cls,
                       "block-dht",
                       _("Block of type %u is malformed\n"),
                       GNUNET_BLOCK_TYPE_DHT_HELLO);
-      return GNUNET_SYSERR;
+      return GNUNET_NO;
     }
   return GNUNET_OK;
 }
index d4e510abe842db88856b7675367cbc6e16934455..24887876586fdfbc1bb5bd2cc7a2fe77e8147456 100644 (file)
@@ -194,7 +194,7 @@ block_plugin_fs_get_key (void *cls,
       if (block_size < sizeof (struct KBlock))
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       kb = block;
       if (block_size - sizeof (struct KBlock) !=
@@ -203,7 +203,7 @@ block_plugin_fs_get_key (void *cls,
          - sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) ) 
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       if (GNUNET_OK !=
          GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_KBLOCK,
@@ -212,7 +212,7 @@ block_plugin_fs_get_key (void *cls,
                                    &kb->keyspace)) 
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       if (key != NULL)
        GNUNET_CRYPTO_hash (&kb->keyspace,
@@ -223,14 +223,14 @@ block_plugin_fs_get_key (void *cls,
       if (block_size < sizeof (struct SBlock))
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       sb = block;
       if (block_size !=
          ntohl (sb->purpose.size) + sizeof (struct GNUNET_CRYPTO_RsaSignature))
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       if (GNUNET_OK !=
          GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_SBLOCK,
@@ -239,7 +239,7 @@ block_plugin_fs_get_key (void *cls,
                                    &sb->subspace)) 
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       if (key != NULL)
        *key = sb->identifier;
@@ -248,7 +248,7 @@ block_plugin_fs_get_key (void *cls,
       if (block_size < sizeof (struct NBlock))
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       nb = block;
       if (block_size - sizeof (struct NBlock) !=
@@ -257,13 +257,13 @@ block_plugin_fs_get_key (void *cls,
          - sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) ) 
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       if (block_size !=
          ntohl (nb->ksk_purpose.size) + sizeof (struct GNUNET_CRYPTO_RsaSignature))
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       if (GNUNET_OK !=
          GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK_KSIG,
@@ -272,7 +272,7 @@ block_plugin_fs_get_key (void *cls,
                                    &nb->keyspace)) 
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       if (GNUNET_OK !=
          GNUNET_CRYPTO_rsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_NBLOCK,
@@ -281,7 +281,7 @@ block_plugin_fs_get_key (void *cls,
                                    &nb->subspace)) 
        {
          GNUNET_break_op (0);
-         return GNUNET_SYSERR;
+         return GNUNET_NO;
        }
       /* FIXME: we used to xor ID with NSID,
         why not here? */
index 18cb7b7f396429d01efa4a6007f5c5dcc2e1f8f9..15119f4451f027cd15466a819671d5b935988699 100644 (file)
@@ -219,7 +219,7 @@ GNUNET_BLOCK_evaluate (struct GNUNET_BLOCK_Context *ctx,
  * @param block_size number of bytes in block
  * @param key set to the key (query) for the given block
  * @return GNUNET_OK on success, 
- *         GNUNET_NO if the block is malformed, FIXME: cg!
+ *         GNUNET_NO if the block is malformed
  *         GNUNET_SYSERR if type not supported
  *         (or if extracting a key from a block of this type does not work)
  */