diff options
author | Philipp Tölke <toelke@in.tum.de> | 2010-10-26 13:55:55 +0000 |
---|---|---|
committer | Philipp Tölke <toelke@in.tum.de> | 2010-10-26 13:55:55 +0000 |
commit | 3900beb1ed0370041bccbe84643d84a6f5204475 (patch) | |
tree | 18c28432dfeaac345892b4f435d3674c3aadc829 /src/block | |
parent | 8d058446a4a288d87f58a021622ecad6371519cb (diff) | |
download | gnunet-3900beb1ed0370041bccbe84643d84a6f5204475.tar.gz gnunet-3900beb1ed0370041bccbe84643d84a6f5204475.zip |
modified the DNS_Record-block
Diffstat (limited to 'src/block')
-rw-r--r-- | src/block/plugin_block_dns.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/block/plugin_block_dns.c b/src/block/plugin_block_dns.c index 1e1a577fc..205cff4b8 100644 --- a/src/block/plugin_block_dns.c +++ b/src/block/plugin_block_dns.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "plugin_block.h" | 28 | #include "plugin_block.h" |
29 | #include "block_dns.h" | 29 | #include "block_dns.h" |
30 | #include "gnunet_signatures.h" | ||
30 | 31 | ||
31 | #define DEBUG_DHT GNUNET_NO | 32 | #define DEBUG_DHT GNUNET_NO |
32 | 33 | ||
@@ -65,11 +66,21 @@ block_plugin_dns_evaluate (void *cls, | |||
65 | if (reply_block_size == 0) | 66 | if (reply_block_size == 0) |
66 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; | 67 | return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; |
67 | 68 | ||
68 | if (reply_block_size < sizeof(struct GNUNET_DNS_Record)) | 69 | if (reply_block_size != sizeof(struct GNUNET_DNS_Record)) |
69 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 70 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
70 | 71 | ||
71 | const struct GNUNET_DNS_Record* rec = reply_block; | 72 | const struct GNUNET_DNS_Record* rec = reply_block; |
72 | if(reply_block_size != (sizeof(struct GNUNET_DNS_Record) + rec->namelen - 1)) | 73 | |
74 | if (ntohl(rec->purpose.size) != sizeof(struct GNUNET_DNS_Record) - sizeof(struct GNUNET_CRYPTO_RsaSignature)) | ||
75 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | ||
76 | |||
77 | if (GNUNET_TIME_relative_get_zero().value == GNUNET_TIME_absolute_get_remaining(rec->expiration_time).value) | ||
78 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | ||
79 | |||
80 | if (GNUNET_OK != GNUNET_CRYPTO_rsa_verify (htonl(GNUNET_SIGNATURE_PURPOSE_DNS_RECORD), | ||
81 | &rec->purpose, | ||
82 | &rec->signature, | ||
83 | &rec->peer)) | ||
73 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 84 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
74 | 85 | ||
75 | /* How to decide whether there are no more? */ | 86 | /* How to decide whether there are no more? */ |
@@ -101,7 +112,7 @@ block_plugin_dns_get_key (void *cls, | |||
101 | if (type != GNUNET_BLOCK_TYPE_DNS) | 112 | if (type != GNUNET_BLOCK_TYPE_DNS) |
102 | return GNUNET_SYSERR; | 113 | return GNUNET_SYSERR; |
103 | const struct GNUNET_DNS_Record* rec = block; | 114 | const struct GNUNET_DNS_Record* rec = block; |
104 | GNUNET_CRYPTO_hash(rec->name, rec->namelen, key); | 115 | memcpy(key, &rec->service_descriptor, sizeof(GNUNET_HashCode)); |
105 | return GNUNET_OK; | 116 | return GNUNET_OK; |
106 | } | 117 | } |
107 | 118 | ||