diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-14 20:24:17 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-14 20:24:17 +0000 |
commit | 4a7968ce3cbe9d106df47b33cc561b10ed912d62 (patch) | |
tree | 5c2269d19820c60590ce926031bb82251306c129 /src | |
parent | a0a19cebadfd63a7d9e99d09a8f23ec03a32f18a (diff) | |
download | gnunet-4a7968ce3cbe9d106df47b33cc561b10ed912d62.tar.gz gnunet-4a7968ce3cbe9d106df47b33cc561b10ed912d62.zip |
-cleanup
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gns_api.c | 2 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 333 | ||||
-rw-r--r-- | src/gns/plugin_block_gns.c | 4 |
3 files changed, 34 insertions, 305 deletions
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index fe1ba3200..9a4c4cff0 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c | |||
@@ -461,7 +461,6 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg) | |||
461 | const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg; | 461 | const struct GNUNET_GNS_ClientLookupResultMessage *lookup_msg; |
462 | const struct GNUNET_GNS_ClientShortenResultMessage *shorten_msg; | 462 | const struct GNUNET_GNS_ClientShortenResultMessage *shorten_msg; |
463 | const struct GNUNET_GNS_ClientGetAuthResultMessage *get_auth_msg; | 463 | const struct GNUNET_GNS_ClientGetAuthResultMessage *get_auth_msg; |
464 | uint16_t size; | ||
465 | uint16_t type; | 464 | uint16_t type; |
466 | uint32_t r_id; | 465 | uint32_t r_id; |
467 | 466 | ||
@@ -475,7 +474,6 @@ process_message (void *cls, const struct GNUNET_MessageHeader *msg) | |||
475 | return; | 474 | return; |
476 | } | 475 | } |
477 | 476 | ||
478 | size = ntohs (msg->size); | ||
479 | type = ntohs (msg->type); | 477 | type = ntohs (msg->type); |
480 | 478 | ||
481 | if (type == GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT) | 479 | if (type == GNUNET_MESSAGE_TYPE_GNS_LOOKUP_RESULT) |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index d3e9d8da6..92fad20fa 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -21,8 +21,8 @@ | |||
21 | /** | 21 | /** |
22 | * | 22 | * |
23 | * | 23 | * |
24 | * @file gns/gns_resolver.c | 24 | * @file gns/gnunet-service-gns_resolver.c |
25 | * @brief GNUnet GNS service | 25 | * @brief GNUnet GNS resolver logic |
26 | * @author Martin Schanzenbach | 26 | * @author Martin Schanzenbach |
27 | */ | 27 | */ |
28 | #include "platform.h" | 28 | #include "platform.h" |
@@ -46,12 +46,17 @@ | |||
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Our handle to the namestore service | 48 | * Our handle to the namestore service |
49 | * FIXME maybe need a second handle for iteration | ||
50 | */ | 49 | */ |
51 | struct GNUNET_NAMESTORE_Handle *namestore_handle; | 50 | struct GNUNET_NAMESTORE_Handle *namestore_handle; |
52 | 51 | ||
52 | /** | ||
53 | * Resolver handle to the dht | ||
54 | */ | ||
53 | struct GNUNET_DHT_Handle *dht_handle; | 55 | struct GNUNET_DHT_Handle *dht_handle; |
54 | 56 | ||
57 | /** | ||
58 | * Connects resolver to the dht | ||
59 | */ | ||
55 | static void | 60 | static void |
56 | connect_to_dht() | 61 | connect_to_dht() |
57 | { | 62 | { |
@@ -596,7 +601,7 @@ process_delegation_result_dht(void* cls, | |||
596 | * should never get here unless false dht key/put | 601 | * should never get here unless false dht key/put |
597 | * block plugin should handle this | 602 | * block plugin should handle this |
598 | **/ | 603 | **/ |
599 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "DHT authority lookup error!\n"); | 604 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "DHT authority lookup error!\n"); |
600 | GNUNET_break(0); | 605 | GNUNET_break(0); |
601 | } | 606 | } |
602 | 607 | ||
@@ -606,8 +611,8 @@ process_delegation_result_dht(void* cls, | |||
606 | * | 611 | * |
607 | * @param cls the closure | 612 | * @param cls the closure |
608 | * @param rh resolver handle | 613 | * @param rh resolver handle |
609 | * @param rd_count number of results (always 0) | 614 | * @param rd_count number of results |
610 | * @param rd record data (always NULL) | 615 | * @param rd record data |
611 | */ | 616 | */ |
612 | static void | 617 | static void |
613 | handle_record_dht(void* cls, struct ResolverHandle *rh, | 618 | handle_record_dht(void* cls, struct ResolverHandle *rh, |
@@ -628,7 +633,7 @@ handle_record_dht(void* cls, struct ResolverHandle *rh, | |||
628 | 633 | ||
629 | /* results found yay */ | 634 | /* results found yay */ |
630 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 635 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
631 | "Record resolved from namestore!"); | 636 | "Record resolved from DHT!"); |
632 | rlh->proc(rlh->proc_cls, rd_count, rd); | 637 | rlh->proc(rlh->proc_cls, rd_count, rd); |
633 | 638 | ||
634 | } | 639 | } |
@@ -639,8 +644,8 @@ handle_record_dht(void* cls, struct ResolverHandle *rh, | |||
639 | * | 644 | * |
640 | * @param cls the closure | 645 | * @param cls the closure |
641 | * @param rh resolver handle | 646 | * @param rh resolver handle |
642 | * @param rd_count number of results (always 0) | 647 | * @param rd_count number of results |
643 | * @param rd record data (always NULL) | 648 | * @param rd record data |
644 | */ | 649 | */ |
645 | static void | 650 | static void |
646 | handle_record_ns(void* cls, struct ResolverHandle *rh, | 651 | handle_record_ns(void* cls, struct ResolverHandle *rh, |
@@ -780,7 +785,6 @@ handle_delegation_dht(void* cls, struct ResolverHandle *rh, | |||
780 | * rh->authority's zone | 785 | * rh->authority's zone |
781 | * | 786 | * |
782 | * @param rh the pending gns query | 787 | * @param rh the pending gns query |
783 | * @param name the name of the PKEY record | ||
784 | */ | 788 | */ |
785 | static void | 789 | static void |
786 | resolve_delegation_dht(struct ResolverHandle *rh) | 790 | resolve_delegation_dht(struct ResolverHandle *rh) |
@@ -842,9 +846,10 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, | |||
842 | 846 | ||
843 | /** | 847 | /** |
844 | * we still have some left | 848 | * we still have some left |
845 | * check if ns entry is fresh | 849 | * check if authority in ns is fresh |
850 | * and exists | ||
851 | * or we are authority | ||
846 | **/ | 852 | **/ |
847 | |||
848 | if ((rh->status & (EXISTS | !EXPIRED)) || | 853 | if ((rh->status & (EXISTS | !EXPIRED)) || |
849 | !GNUNET_CRYPTO_hash_cmp(&rh->authority_chain_head->zone, | 854 | !GNUNET_CRYPTO_hash_cmp(&rh->authority_chain_head->zone, |
850 | &rh->authority_chain_tail->zone)) | 855 | &rh->authority_chain_tail->zone)) |
@@ -874,7 +879,7 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, | |||
874 | resolve_delegation_dht(rh); | 879 | resolve_delegation_dht(rh); |
875 | } | 880 | } |
876 | 881 | ||
877 | //Prototype | 882 | /* Prototype */ |
878 | static void resolve_delegation_ns(struct ResolverHandle *rh); | 883 | static void resolve_delegation_ns(struct ResolverHandle *rh); |
879 | 884 | ||
880 | 885 | ||
@@ -967,10 +972,10 @@ process_delegation_result_ns(void* cls, | |||
967 | return; | 972 | return; |
968 | } | 973 | } |
969 | 974 | ||
970 | //Note only 1 pkey should have been returned.. anything else would be strange | ||
971 | /** | 975 | /** |
972 | * We found an authority that may be able to help us | 976 | * We found an authority that may be able to help us |
973 | * move on with query | 977 | * move on with query |
978 | * Note only 1 pkey should have been returned.. anything else would be strange | ||
974 | */ | 979 | */ |
975 | int i; | 980 | int i; |
976 | for (i=0; i<rd_count;i++) | 981 | for (i=0; i<rd_count;i++) |
@@ -1056,7 +1061,8 @@ resolve_delegation_ns(struct ResolverHandle *rh) | |||
1056 | * | 1061 | * |
1057 | * @param zone the root zone | 1062 | * @param zone the root zone |
1058 | * @param record_type the record type to look up | 1063 | * @param record_type the record type to look up |
1059 | * @param proc the processor to call | 1064 | * @param name the name to look up |
1065 | * @param proc the processor to call on result | ||
1060 | * @param cls the closure to pass to proc | 1066 | * @param cls the closure to pass to proc |
1061 | */ | 1067 | */ |
1062 | void | 1068 | void |
@@ -1103,199 +1109,19 @@ gns_resolver_lookup_record(GNUNET_HashCode zone, | |||
1103 | /******** END Record Resolver ***********/ | 1109 | /******** END Record Resolver ***********/ |
1104 | 1110 | ||
1105 | 1111 | ||
1106 | static void | ||
1107 | process_pseu_result_ns_shorten(void *cls, | ||
1108 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | ||
1109 | struct GNUNET_TIME_Absolute expire, | ||
1110 | const char *name, | ||
1111 | unsigned int rd_len, | ||
1112 | const struct GNUNET_NAMESTORE_RecordData *rd, | ||
1113 | const struct GNUNET_CRYPTO_RsaSignature *signature) | ||
1114 | { | ||
1115 | struct ResolverHandle *rh = | ||
1116 | (struct ResolverHandle *)cls; | ||
1117 | struct GNUNET_TIME_Relative remaining_time; | ||
1118 | |||
1119 | GNUNET_TIME_absolute_get_remaining (expire); | ||
1120 | rh->status = 0; | ||
1121 | |||
1122 | if (name != NULL) | ||
1123 | { | ||
1124 | rh->status |= EXISTS; | ||
1125 | } | ||
1126 | |||
1127 | if (remaining_time.rel_value == 0) | ||
1128 | { | ||
1129 | rh->status |= EXPIRED; | ||
1130 | } | ||
1131 | |||
1132 | rh->proc(rh->proc_cls, rh, rd_len, rd); | ||
1133 | } | ||
1134 | |||
1135 | |||
1136 | /** | 1112 | /** |
1137 | * Function called when we get a result from the dht | 1113 | * Callback calles by namestore for a zone to name |
1138 | * for our record query | 1114 | * result |
1139 | * | 1115 | * |
1140 | * @param cls the request handle | 1116 | * @param cls the closure |
1141 | * @param exp lifetime | 1117 | * @param zone_key the zone we queried |
1142 | * @param key the key the record was stored under | 1118 | * @param expire the expiration time of the name |
1143 | * @param get_path get path | 1119 | * @param name the name found or NULL |
1144 | * @param get_path_length get path length | 1120 | * @param rd_len number of records for the name |
1145 | * @param put_path put path | 1121 | * @param rd the record data (PKEY) for the name |
1146 | * @param put_path_length put path length | 1122 | * @param signature the signature for the record data |
1147 | * @param type the block type | ||
1148 | * @param size the size of the record | ||
1149 | * @param data the record data | ||
1150 | */ | ||
1151 | static void | ||
1152 | process_pseu_dht_result(void* cls, | ||
1153 | struct GNUNET_TIME_Absolute exp, | ||
1154 | const GNUNET_HashCode * key, | ||
1155 | const struct GNUNET_PeerIdentity *get_path, | ||
1156 | unsigned int get_path_length, | ||
1157 | const struct GNUNET_PeerIdentity *put_path, | ||
1158 | unsigned int put_path_length, | ||
1159 | enum GNUNET_BLOCK_Type type, | ||
1160 | size_t size, const void *data) | ||
1161 | { | ||
1162 | struct ResolverHandle *rh; | ||
1163 | struct RecordLookupHandle *rlh; | ||
1164 | struct GNSNameRecordBlock *nrb; | ||
1165 | uint32_t num_records; | ||
1166 | char* name = NULL; | ||
1167 | char* rd_data = (char*)data; | ||
1168 | int i; | ||
1169 | int rd_size; | ||
1170 | |||
1171 | GNUNET_HashCode zone, name_hash; | ||
1172 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "got PSEU dht result (size=%d)\n", size); | ||
1173 | |||
1174 | if (data == NULL) | ||
1175 | return; | ||
1176 | |||
1177 | //FIXME maybe check expiration here, check block type | ||
1178 | |||
1179 | rh = (struct ResolverHandle *)cls; | ||
1180 | rlh = (struct RecordLookupHandle *) rh->proc_cls; | ||
1181 | nrb = (struct GNSNameRecordBlock*)data; | ||
1182 | |||
1183 | /* stop lookup and timeout task */ | ||
1184 | GNUNET_DHT_get_stop (rh->get_handle); | ||
1185 | GNUNET_SCHEDULER_cancel(rh->dht_timeout_task); | ||
1186 | |||
1187 | rh->get_handle = NULL; | ||
1188 | name = (char*)&nrb[1]; | ||
1189 | num_records = ntohl(nrb->rd_count); | ||
1190 | { | ||
1191 | struct GNUNET_NAMESTORE_RecordData rd[num_records]; | ||
1192 | |||
1193 | rd_data += strlen(name) + 1 + sizeof(struct GNSNameRecordBlock); | ||
1194 | rd_size = size - strlen(name) - 1 - sizeof(struct GNSNameRecordBlock); | ||
1195 | |||
1196 | if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (rd_size, | ||
1197 | rd_data, | ||
1198 | num_records, | ||
1199 | rd)) | ||
1200 | { | ||
1201 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Error deserializing data!\n"); | ||
1202 | return; | ||
1203 | } | ||
1204 | |||
1205 | for (i=0; i<num_records; i++) | ||
1206 | { | ||
1207 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
1208 | "Got name: %s (wanted %s)\n", name, rh->name); | ||
1209 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
1210 | "Got type: %d\n", | ||
1211 | rd[i].record_type); | ||
1212 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
1213 | "Got data length: %d\n", rd[i].data_size); | ||
1214 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
1215 | "Got flag %d\n", rd[i].flags); | ||
1216 | |||
1217 | if ((strcmp(name, "+") == 0) && | ||
1218 | (rd[i].record_type == GNUNET_GNS_RECORD_PSEU)) | ||
1219 | { | ||
1220 | rh->answered++; | ||
1221 | } | ||
1222 | |||
1223 | } | ||
1224 | |||
1225 | GNUNET_CRYPTO_hash(name, strlen(name), &name_hash); | ||
1226 | GNUNET_CRYPTO_hash_xor(key, &name_hash, &zone); | ||
1227 | |||
1228 | /** | ||
1229 | * FIXME check pubkey against existing key in namestore? | ||
1230 | * https://gnunet.org/bugs/view.php?id=2179 | ||
1231 | */ | ||
1232 | |||
1233 | /* Save to namestore */ | ||
1234 | GNUNET_NAMESTORE_record_put (namestore_handle, | ||
1235 | &nrb->public_key, | ||
1236 | name, | ||
1237 | exp, | ||
1238 | num_records, | ||
1239 | rd, | ||
1240 | &nrb->signature, | ||
1241 | &on_namestore_record_put_result, //cont | ||
1242 | NULL); //cls | ||
1243 | |||
1244 | if (rh->answered) | ||
1245 | rh->proc(rh->proc_cls, rh, num_records, rd); | ||
1246 | else | ||
1247 | rh->proc(rh->proc_cls, rh, 0, NULL); | ||
1248 | } | ||
1249 | |||
1250 | } | ||
1251 | |||
1252 | |||
1253 | /** | ||
1254 | * Start DHT lookup for a PSEUdonym record in | ||
1255 | * rh->authority's zone | ||
1256 | * | ||
1257 | * @param rh the pending gns query | ||
1258 | */ | 1123 | */ |
1259 | static void | 1124 | static void |
1260 | resolve_pseu_dht(struct ResolverHandle *rh) | ||
1261 | { | ||
1262 | uint32_t xquery; | ||
1263 | GNUNET_HashCode name_hash; | ||
1264 | GNUNET_HashCode lookup_key; | ||
1265 | |||
1266 | GNUNET_CRYPTO_hash("+", | ||
1267 | strlen("+"), | ||
1268 | &name_hash); | ||
1269 | |||
1270 | GNUNET_CRYPTO_hash_xor(&name_hash, &rh->authority, &lookup_key); | ||
1271 | |||
1272 | rh->dht_timeout_task = GNUNET_SCHEDULER_add_delayed (DHT_LOOKUP_TIMEOUT, | ||
1273 | &dht_lookup_timeout, | ||
1274 | rh); | ||
1275 | |||
1276 | xquery = htonl(GNUNET_GNS_RECORD_PSEU); | ||
1277 | |||
1278 | rh->get_handle = GNUNET_DHT_get_start(dht_handle, | ||
1279 | DHT_OPERATION_TIMEOUT, | ||
1280 | GNUNET_BLOCK_TYPE_GNS_NAMERECORD, | ||
1281 | &lookup_key, | ||
1282 | DHT_GNS_REPLICATION_LEVEL, | ||
1283 | GNUNET_DHT_RO_NONE, | ||
1284 | &xquery, | ||
1285 | sizeof(xquery), | ||
1286 | &process_pseu_dht_result, | ||
1287 | rh); | ||
1288 | |||
1289 | } | ||
1290 | |||
1291 | //Prototype | ||
1292 | static void | ||
1293 | handle_shorten_pseu_ns_result(void* cls, | ||
1294 | struct ResolverHandle *rh, | ||
1295 | uint32_t rd_count, | ||
1296 | const struct GNUNET_NAMESTORE_RecordData *rd); | ||
1297 | |||
1298 | static void | ||
1299 | process_zone_to_name_shorten(void *cls, | 1125 | process_zone_to_name_shorten(void *cls, |
1300 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, | 1126 | const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, |
1301 | struct GNUNET_TIME_Absolute expire, | 1127 | struct GNUNET_TIME_Absolute expire, |
@@ -1304,8 +1130,7 @@ process_zone_to_name_shorten(void *cls, | |||
1304 | const struct GNUNET_NAMESTORE_RecordData *rd, | 1130 | const struct GNUNET_NAMESTORE_RecordData *rd, |
1305 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 1131 | const struct GNUNET_CRYPTO_RsaSignature *signature) |
1306 | { | 1132 | { |
1307 | struct ResolverHandle *rh = | 1133 | struct ResolverHandle *rh = (struct ResolverHandle *)cls; |
1308 | (struct ResolverHandle *)cls; | ||
1309 | struct NameShortenHandle* nsh = (struct NameShortenHandle*)rh->proc_cls; | 1134 | struct NameShortenHandle* nsh = (struct NameShortenHandle*)rh->proc_cls; |
1310 | struct AuthorityChain *next_authority; | 1135 | struct AuthorityChain *next_authority; |
1311 | 1136 | ||
@@ -1348,7 +1173,7 @@ process_zone_to_name_shorten(void *cls, | |||
1348 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1173 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1349 | "Our zone: Sending name as shorten result %s\n", rh->name); | 1174 | "Our zone: Sending name as shorten result %s\n", rh->name); |
1350 | 1175 | ||
1351 | nsh->proc(nsh->proc_cls, result); //FIXME +.gnunet! | 1176 | nsh->proc(nsh->proc_cls, result); |
1352 | free_resolver_handle(rh); | 1177 | free_resolver_handle(rh); |
1353 | GNUNET_free(result); | 1178 | GNUNET_free(result); |
1354 | } | 1179 | } |
@@ -1383,96 +1208,6 @@ process_zone_to_name_shorten(void *cls, | |||
1383 | 1208 | ||
1384 | 1209 | ||
1385 | /** | 1210 | /** |
1386 | * Process result from namestore PSEU lookup | ||
1387 | * for shorten operation | ||
1388 | * | ||
1389 | * @param cls the client shorten handle | ||
1390 | * @param rh the resolver handle | ||
1391 | * @param rd_count number of results (0 if none found) | ||
1392 | * @param rd data (NULL if none found) | ||
1393 | */ | ||
1394 | static void | ||
1395 | handle_pseu_ns_result_shorten(void* cls, | ||
1396 | struct ResolverHandle *rh, | ||
1397 | uint32_t rd_len, | ||
1398 | const struct GNUNET_NAMESTORE_RecordData *rd) | ||
1399 | { | ||
1400 | struct NameShortenHandle* nsh = (struct NameShortenHandle*) cls; | ||
1401 | struct AuthorityChain *next_authority; | ||
1402 | char* pseu; | ||
1403 | char* result; | ||
1404 | char* new_name; | ||
1405 | size_t answer_len; | ||
1406 | int i; | ||
1407 | |||
1408 | /** | ||
1409 | * PSEU found | ||
1410 | */ | ||
1411 | if (rd_len != 0) | ||
1412 | { | ||
1413 | for (i=0; i < rd_len; i++) | ||
1414 | { | ||
1415 | if (rd[i].record_type == GNUNET_GNS_RECORD_PSEU) | ||
1416 | { | ||
1417 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
1418 | "Found PSEU %s len %d\n", (char*) rd[i].data, | ||
1419 | strlen((char*) rd[i].data)); | ||
1420 | break; | ||
1421 | } | ||
1422 | } | ||
1423 | |||
1424 | pseu = (char*) rd[i].data; | ||
1425 | answer_len = strlen(rh->name) + strlen(pseu) + strlen(GNUNET_GNS_TLD) + 3; | ||
1426 | result = GNUNET_malloc(answer_len); | ||
1427 | memset(result, 0, answer_len); | ||
1428 | strcpy(result, rh->name); | ||
1429 | strcpy(result+strlen(rh->name), "."); | ||
1430 | strcpy(result+strlen(rh->name)+1, pseu); | ||
1431 | strcpy(result+strlen(rh->name)+strlen(pseu)+1, "."); | ||
1432 | strcpy(result+strlen(rh->name)+strlen(pseu)+2, GNUNET_GNS_TLD); | ||
1433 | |||
1434 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
1435 | "Sending shorten result %s\n", result); | ||
1436 | |||
1437 | nsh->proc(nsh->proc_cls, result); | ||
1438 | free_resolver_handle(rh); | ||
1439 | GNUNET_free(result); | ||
1440 | return; | ||
1441 | } | ||
1442 | |||
1443 | /** | ||
1444 | * No PSEU found. | ||
1445 | * continue with next authority | ||
1446 | * Note that we never have <2 authorities | ||
1447 | * in our list at this point since tail is always our root | ||
1448 | * And we filter fot this in handle_delegation_ns_shorten | ||
1449 | */ | ||
1450 | next_authority = rh->authority_chain_head; | ||
1451 | new_name = GNUNET_malloc(strlen(rh->name)+ | ||
1452 | strlen(next_authority->name) + 2); | ||
1453 | memset(new_name, 0, strlen(rh->name)+ | ||
1454 | strlen(next_authority->name) + 2); | ||
1455 | strcpy(new_name, rh->name); | ||
1456 | strcpy(new_name+strlen(rh->name)+1, "."); | ||
1457 | strcpy(new_name+strlen(rh->name)+2, next_authority->name); | ||
1458 | |||
1459 | GNUNET_free(rh->name); | ||
1460 | rh->name = new_name; | ||
1461 | GNUNET_CONTAINER_DLL_remove(rh->authority_chain_head, | ||
1462 | rh->authority_chain_tail, | ||
1463 | next_authority); | ||
1464 | |||
1465 | GNUNET_NAMESTORE_zone_to_name (namestore_handle, | ||
1466 | &rh->authority_chain_tail->zone, | ||
1467 | &rh->authority_chain_head->zone, | ||
1468 | &process_zone_to_name_shorten, | ||
1469 | rh); | ||
1470 | |||
1471 | } | ||
1472 | |||
1473 | |||
1474 | |||
1475 | /** | ||
1476 | * Process result from namestore delegation lookup | 1211 | * Process result from namestore delegation lookup |
1477 | * for shorten operation | 1212 | * for shorten operation |
1478 | * | 1213 | * |
@@ -1522,7 +1257,7 @@ handle_delegation_ns_shorten(void* cls, | |||
1522 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 1257 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
1523 | "Our zone: Sending name as shorten result %s\n", rh->name); | 1258 | "Our zone: Sending name as shorten result %s\n", rh->name); |
1524 | 1259 | ||
1525 | nsh->proc(nsh->proc_cls, result); //FIXME +.gnunet! | 1260 | nsh->proc(nsh->proc_cls, result); |
1526 | free_resolver_handle(rh); | 1261 | free_resolver_handle(rh); |
1527 | GNUNET_free(result); | 1262 | GNUNET_free(result); |
1528 | return; | 1263 | return; |
@@ -1714,4 +1449,4 @@ gns_resolver_get_authority(GNUNET_HashCode zone, | |||
1714 | 1449 | ||
1715 | /******** END GET AUTHORITY *************/ | 1450 | /******** END GET AUTHORITY *************/ |
1716 | 1451 | ||
1717 | /* end of gns_resolver.c */ | 1452 | /* end of gnunet-service-gns_resolver.c */ |
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index 329088280..3071ef64e 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c | |||
@@ -75,9 +75,6 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, | |||
75 | uint32_t record_xquery; | 75 | uint32_t record_xquery; |
76 | unsigned int record_match; | 76 | unsigned int record_match; |
77 | 77 | ||
78 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | ||
79 | "BLOCK_TEST\n"); | ||
80 | |||
81 | if (type != GNUNET_BLOCK_TYPE_GNS_NAMERECORD) | 78 | if (type != GNUNET_BLOCK_TYPE_GNS_NAMERECORD) |
82 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; | 79 | return GNUNET_BLOCK_EVALUATION_TYPE_NOT_SUPPORTED; |
83 | if (reply_block_size == 0) | 80 | if (reply_block_size == 0) |
@@ -221,7 +218,6 @@ block_plugin_gns_get_key (void *cls, enum GNUNET_BLOCK_Type type, | |||
221 | 218 | ||
222 | GNUNET_CRYPTO_hash_xor(&name_hash, &pkey_hash, key); | 219 | GNUNET_CRYPTO_hash_xor(&name_hash, &pkey_hash, key); |
223 | 220 | ||
224 | //FIXME calculate key from name and hash(pkey) here | ||
225 | return GNUNET_OK; | 221 | return GNUNET_OK; |
226 | } | 222 | } |
227 | 223 | ||