From: Martin Schanzenbach Date: Thu, 15 Mar 2012 14:05:23 +0000 (+0000) Subject: -fixes, block plugin change X-Git-Tag: initial-import-from-subversion-38251~14235 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d6e09d02cc47caa5189af6da003e4bcb037193a0;p=oweals%2Fgnunet.git -fixes, block plugin change --- diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 3a94556b7..dee082e99 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -602,8 +602,8 @@ process_delegation_result_dht(void* cls, * should never get here unless false dht key/put * block plugin should handle this **/ - GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "DHT authority lookup error!\n"); - GNUNET_break(0); + GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "DHT authority lookup found no match!\n"); + rh->proc(rh->proc_cls, rh, 0, NULL); } diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index 3071ef64e..46db6a22a 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c @@ -77,9 +77,20 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, if (type != GNUNET_BLOCK_TYPE_GNS_NAMERECORD) return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; - if (reply_block_size == 0) - return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; - + if (reply_block == NULL) + { + /** + * check if request is valid + * FIXME we could check for the record types here + **/ + if (xquery_size < sizeof(uint32_t)) + return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; + else + return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; + } + + /* this is a reply */ + nrb = (struct GNSNameRecordBlock *)reply_block; name = (char*)&nrb[1]; GNUNET_CRYPTO_hash(&nrb->public_key, @@ -101,7 +112,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, /* Check query key against public key */ if (0 != GNUNET_CRYPTO_hash_cmp(query, &query_key)) - return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; + return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; record_match = 0; rd_count = ntohl(nrb->rd_count); @@ -121,7 +132,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Data invalid (%d bytes, %d records)\n", rd_len, rd_count); - return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; + return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } if (xquery_size < sizeof(uint32_t)) @@ -156,19 +167,10 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, &nrb->signature)) { GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Signature invalid\n"); - return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; + return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } } - if ((record_xquery != 0) && (record_match == 0)) - { - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, - "No record matches query!\n"); - return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; - } - - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Records match\n"); - if (NULL != bf) { GNUNET_CRYPTO_hash(reply_block, reply_block_size, &chash);