diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-21 13:47:51 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-21 13:47:51 +0000 |
commit | c164ecb84e1b98ebcdade7b9250bb3e051156842 (patch) | |
tree | c6757129c505cce82694e039864d9c48908bf015 /src | |
parent | af8a130c49b2b6f00929ab161e7c160e3b0259b1 (diff) | |
download | gnunet-c164ecb84e1b98ebcdade7b9250bb3e051156842.tar.gz gnunet-c164ecb84e1b98ebcdade7b9250bb3e051156842.zip |
-fixes, auto_import_pkey imlpl
Diffstat (limited to 'src')
-rw-r--r-- | src/gns/gnunet-service-gns.c | 33 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 9 | ||||
-rw-r--r-- | src/gns/test_gns_dht_delegated_lookup.c | 18 | ||||
-rw-r--r-- | src/gns/test_gns_simple_lookup.conf | 2 |
4 files changed, 36 insertions, 26 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index bc1a713b6..736bff4bf 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -152,6 +152,9 @@ static struct GNUNET_TIME_Relative dht_update_interval; | |||
152 | /* zone update task */ | 152 | /* zone update task */ |
153 | GNUNET_SCHEDULER_TaskIdentifier zone_update_taskid = GNUNET_SCHEDULER_NO_TASK; | 153 | GNUNET_SCHEDULER_TaskIdentifier zone_update_taskid = GNUNET_SCHEDULER_NO_TASK; |
154 | 154 | ||
155 | /* automatic pkey import for name shortening */ | ||
156 | static int auto_import_pkey; | ||
157 | |||
155 | /** | 158 | /** |
156 | * Task run during shutdown. | 159 | * Task run during shutdown. |
157 | * | 160 | * |
@@ -716,9 +719,18 @@ handle_lookup(void *cls, | |||
716 | clh->unique_id = sh_msg->id; | 719 | clh->unique_id = sh_msg->id; |
717 | clh->type = ntohl(sh_msg->type); | 720 | clh->type = ntohl(sh_msg->type); |
718 | 721 | ||
719 | gns_resolver_lookup_record(zone_hash, clh->type, name, | 722 | if (GNUNET_YES == auto_import_pkey) |
720 | zone_key, | 723 | { |
721 | &send_lookup_response, clh); | 724 | gns_resolver_lookup_record(zone_hash, clh->type, name, |
725 | zone_key, | ||
726 | &send_lookup_response, clh); | ||
727 | } | ||
728 | else | ||
729 | { | ||
730 | gns_resolver_lookup_record(zone_hash, clh->type, name, | ||
731 | NULL, | ||
732 | &send_lookup_response, clh); | ||
733 | } | ||
722 | } | 734 | } |
723 | 735 | ||
724 | 736 | ||
@@ -790,7 +802,18 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
790 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n"); | 802 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n"); |
791 | } | 803 | } |
792 | 804 | ||
793 | if (gns_resolver_init(namestore_handle, dht_handle) == GNUNET_SYSERR) | 805 | if (GNUNET_YES == |
806 | GNUNET_CONFIGURATION_get_value_yesno (c, "gns", | ||
807 | "AUTO_IMPORT_PKEY")) | ||
808 | { | ||
809 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, | ||
810 | "Automatic PKEY import is enabled.\n"); | ||
811 | auto_import_pkey = GNUNET_YES; | ||
812 | |||
813 | } | ||
814 | |||
815 | if (gns_resolver_init(namestore_handle, dht_handle) | ||
816 | == GNUNET_SYSERR) | ||
794 | { | 817 | { |
795 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, | 818 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, |
796 | "Unable to initialize resolver!\n"); | 819 | "Unable to initialize resolver!\n"); |
@@ -811,7 +834,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, | |||
811 | "Failed to enable the dns interceptor!\n"); | 834 | "Failed to enable the dns interceptor!\n"); |
812 | } | 835 | } |
813 | } | 836 | } |
814 | 837 | ||
815 | //put_some_records(); //FIXME for testing | 838 | //put_some_records(); //FIXME for testing |
816 | 839 | ||
817 | /** | 840 | /** |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index ca7a5ea85..e95030db6 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -337,9 +337,10 @@ process_zone_to_name_discover(void *cls, | |||
337 | * @param zone the authority | 337 | * @param zone the authority |
338 | * @param the private key of our authority | 338 | * @param the private key of our authority |
339 | */ | 339 | */ |
340 | static void process_discovered_authority(char* name, struct GNUNET_CRYPTO_ShortHashCode zone, | 340 | static void process_discovered_authority(char* name, |
341 | struct GNUNET_CRYPTO_ShortHashCode our_zone, | 341 | struct GNUNET_CRYPTO_ShortHashCode zone, |
342 | struct GNUNET_CRYPTO_RsaPrivateKey *key) | 342 | struct GNUNET_CRYPTO_ShortHashCode our_zone, |
343 | struct GNUNET_CRYPTO_RsaPrivateKey *key) | ||
343 | { | 344 | { |
344 | struct GetPseuAuthorityHandle *gph; | 345 | struct GetPseuAuthorityHandle *gph; |
345 | size_t namelen; | 346 | size_t namelen; |
@@ -878,7 +879,7 @@ process_delegation_result_dht(void* cls, | |||
878 | rh->authority_chain_tail, | 879 | rh->authority_chain_tail, |
879 | auth); | 880 | auth); |
880 | 881 | ||
881 | /** call process new authority */ | 882 | /** try to import pkey if private key available */ |
882 | if (rh->priv_key) | 883 | if (rh->priv_key) |
883 | process_discovered_authority(name, auth->zone, | 884 | process_discovered_authority(name, auth->zone, |
884 | rh->authority_chain_tail->zone, | 885 | rh->authority_chain_tail->zone, |
diff --git a/src/gns/test_gns_dht_delegated_lookup.c b/src/gns/test_gns_dht_delegated_lookup.c index 2a541e4eb..b15bc3f49 100644 --- a/src/gns/test_gns_dht_delegated_lookup.c +++ b/src/gns/test_gns_dht_delegated_lookup.c | |||
@@ -18,23 +18,9 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @file gns/test_gns_twopeer.c | 21 | * @file gns/test_gns_dht_delegated_lookup.c |
22 | * @brief base testcase for testing DHT service with | 22 | * @brief test for record lookup via DHT |
23 | * two running peers. | ||
24 | * | 23 | * |
25 | * This testcase starts peers using the GNUNET_TESTING_daemons_start | ||
26 | * function call. On peer start, connects to the peers DHT service | ||
27 | * by calling GNUNET_DHT_connected. Once notified about all peers | ||
28 | * being started (by the peers_started_callback function), calls | ||
29 | * GNUNET_TESTING_connect_topology, which connects the peers in a | ||
30 | * "straight line" topology. On notification that all peers have | ||
31 | * been properly connected, calls the do_get function which initiates | ||
32 | * a GNUNET_DHT_get from the *second* peer. Once the GNUNET_DHT_get | ||
33 | * function starts, runs the do_put function to insert data at the first peer. | ||
34 | * If the GET is successful, schedules finish_testing | ||
35 | * to stop the test and shut down peers. If GET is unsuccessful | ||
36 | * after GET_TIMEOUT seconds, prints an error message and shuts down | ||
37 | * the peers. | ||
38 | */ | 24 | */ |
39 | #include "platform.h" | 25 | #include "platform.h" |
40 | #include "gnunet_testing_lib.h" | 26 | #include "gnunet_testing_lib.h" |
diff --git a/src/gns/test_gns_simple_lookup.conf b/src/gns/test_gns_simple_lookup.conf index 0ce47ccec..bdb233b3d 100644 --- a/src/gns/test_gns_simple_lookup.conf +++ b/src/gns/test_gns_simple_lookup.conf | |||
@@ -79,7 +79,7 @@ HIJACK_DNS = NO | |||
79 | UNIXPATH = /tmp/gnunet-service-gns.sock | 79 | UNIXPATH = /tmp/gnunet-service-gns.sock |
80 | HOME = $SERVICEHOME | 80 | HOME = $SERVICEHOME |
81 | CONFIG = $DEFAULTCONFIG | 81 | CONFIG = $DEFAULTCONFIG |
82 | 82 | AUTO_IMPORT_PKEY = YES | |
83 | 83 | ||
84 | 84 | ||
85 | [nse] | 85 | [nse] |