diff options
author | Philipp Tölke <toelke@in.tum.de> | 2010-10-08 07:36:36 +0000 |
---|---|---|
committer | Philipp Tölke <toelke@in.tum.de> | 2010-10-08 07:36:36 +0000 |
commit | bab9c4ab9624c1b2693e2e5820c1820fd32e6fb1 (patch) | |
tree | a78232ccde4186c40ab2a69f9795a7d9343f8875 /src/block | |
parent | 20050c615a8c59eb6fa352fc2b10bd3879c8b75f (diff) | |
download | gnunet-bab9c4ab9624c1b2693e2e5820c1820fd32e6fb1.tar.gz gnunet-bab9c4ab9624c1b2693e2e5820c1820fd32e6fb1.zip |
hash and validate a dns-block
Diffstat (limited to 'src/block')
-rw-r--r-- | src/block/plugin_block_dns.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/block/plugin_block_dns.c b/src/block/plugin_block_dns.c index 743747c85..8435c1be0 100644 --- a/src/block/plugin_block_dns.c +++ b/src/block/plugin_block_dns.c | |||
@@ -26,6 +26,7 @@ | |||
26 | 26 | ||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "plugin_block.h" | 28 | #include "plugin_block.h" |
29 | #include "gnunet_block_dns.h" | ||
29 | 30 | ||
30 | #define DEBUG_DHT GNUNET_NO | 31 | #define DEBUG_DHT GNUNET_NO |
31 | 32 | ||
@@ -60,9 +61,19 @@ block_plugin_dht_evaluate (void *cls, | |||
60 | case GNUNET_BLOCK_TYPE_DNS: | 61 | case GNUNET_BLOCK_TYPE_DNS: |
61 | if (xquery_size != 0) | 62 | if (xquery_size != 0) |
62 | return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; | 63 | return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; |
64 | |||
63 | if (reply_block_size == 0) | 65 | if (reply_block_size == 0) |
64 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; | 66 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; |
65 | return GNUNET_BLOCK_EVALUATION_OK_LAST; | 67 | |
68 | if (reply_block_size < sizeof(struct GNUNET_DNS_Record)) | ||
69 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | ||
70 | |||
71 | const struct GNUNET_DNS_Record* rec = reply_block; | ||
72 | if(reply_block_size != (sizeof(struct GNUNET_DNS_Record) + rec->namelen - 1)) | ||
73 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | ||
74 | |||
75 | /* How to decide whether there are no more? */ | ||
76 | return GNUNET_BLOCK_EVALUATION_OK_MORE; | ||
66 | default: | 77 | default: |
67 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; | 78 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; |
68 | } | 79 | } |
@@ -89,7 +100,8 @@ block_plugin_dht_get_key (void *cls, | |||
89 | { | 100 | { |
90 | if (type != GNUNET_BLOCK_TYPE_DNS) | 101 | if (type != GNUNET_BLOCK_TYPE_DNS) |
91 | return GNUNET_SYSERR; | 102 | return GNUNET_SYSERR; |
92 | return GNUNET_SYSERR; | 103 | GNUNET_CRYPTO_hash(block, block_size, key); |
104 | return GNUNET_OK; | ||
93 | } | 105 | } |
94 | 106 | ||
95 | /** | 107 | /** |