-fixes, auto_import_pkey imlpl
authorMartin Schanzenbach <mschanzenbach@posteo.de>
Wed, 21 Mar 2012 13:47:51 +0000 (13:47 +0000)
committerMartin Schanzenbach <mschanzenbach@posteo.de>
Wed, 21 Mar 2012 13:47:51 +0000 (13:47 +0000)
src/gns/gnunet-service-gns.c
src/gns/gnunet-service-gns_resolver.c
src/gns/test_gns_dht_delegated_lookup.c
src/gns/test_gns_simple_lookup.conf

index bc1a713b67fb6c1303059a40ada6dfce20c54d85..736bff4bf69e6578e93827510a259af6981bea98 100644 (file)
@@ -152,6 +152,9 @@ static struct GNUNET_TIME_Relative dht_update_interval;
 /* zone update task */
 GNUNET_SCHEDULER_TaskIdentifier zone_update_taskid = GNUNET_SCHEDULER_NO_TASK;
 
+/* automatic pkey import for name shortening */
+static int auto_import_pkey;
+
 /**
  * Task run during shutdown.
  *
@@ -716,9 +719,18 @@ handle_lookup(void *cls,
   clh->unique_id = sh_msg->id;
   clh->type = ntohl(sh_msg->type);
   
-  gns_resolver_lookup_record(zone_hash, clh->type, name,
-                             zone_key,
-                             &send_lookup_response, clh);
+  if (GNUNET_YES == auto_import_pkey)
+  {
+    gns_resolver_lookup_record(zone_hash, clh->type, name,
+                               zone_key,
+                               &send_lookup_response, clh);
+  }
+  else
+  {
+    gns_resolver_lookup_record(zone_hash, clh->type, name,
+                               NULL,
+                               &send_lookup_response, clh);
+  }
 }
 
 
@@ -790,7 +802,18 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Could not connect to DHT!\n");
   }
 
-  if (gns_resolver_init(namestore_handle, dht_handle) == GNUNET_SYSERR)
+  if (GNUNET_YES ==
+      GNUNET_CONFIGURATION_get_value_yesno (c, "gns",
+                                            "AUTO_IMPORT_PKEY"))
+  {
+    GNUNET_log(GNUNET_ERROR_TYPE_INFO,
+               "Automatic PKEY import is enabled.\n");
+    auto_import_pkey = GNUNET_YES;
+
+  }
+  
+  if (gns_resolver_init(namestore_handle, dht_handle)
+      == GNUNET_SYSERR)
   {
     GNUNET_log(GNUNET_ERROR_TYPE_ERROR,
                "Unable to initialize resolver!\n");
@@ -811,7 +834,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server,
                "Failed to enable the dns interceptor!\n");
     }
   }
-
+  
   //put_some_records(); //FIXME for testing
   
   /**
index ca7a5ea85d861bfa586f1bfe0062aed745b7b680..e95030db670589c81401c16c625be65d96a5cbf0 100644 (file)
@@ -337,9 +337,10 @@ process_zone_to_name_discover(void *cls,
  * @param zone the authority
  * @param the private key of our authority
  */
-static void process_discovered_authority(char* name, struct GNUNET_CRYPTO_ShortHashCode zone,
-                                         struct GNUNET_CRYPTO_ShortHashCode our_zone,
-                                       struct GNUNET_CRYPTO_RsaPrivateKey *key)
+static void process_discovered_authority(char* name,
+                                    struct GNUNET_CRYPTO_ShortHashCode zone,
+                                    struct GNUNET_CRYPTO_ShortHashCode our_zone,
+                                    struct GNUNET_CRYPTO_RsaPrivateKey *key)
 {
   struct GetPseuAuthorityHandle *gph;
   size_t namelen;
@@ -878,7 +879,7 @@ process_delegation_result_dht(void* cls,
                                      rh->authority_chain_tail,
                                      auth);
 
-        /** call process new authority */
+        /** try to import pkey if private key available */
         if (rh->priv_key)
           process_discovered_authority(name, auth->zone,
                                        rh->authority_chain_tail->zone,
index 2a541e4ebe4388bf673495d275b95ed2b198e01a..b15bc3f498bdb7bed74626afad3bdf0be37f0992 100644 (file)
      Boston, MA 02111-1307, USA.
 */
 /**
- * @file gns/test_gns_twopeer.c
- * @brief base testcase for testing DHT service with
- *        two running peers.
+ * @file gns/test_gns_dht_delegated_lookup.c
+ * @brief test for record lookup via DHT
  *
- * This testcase starts peers using the GNUNET_TESTING_daemons_start
- * function call.  On peer start, connects to the peers DHT service
- * by calling GNUNET_DHT_connected.  Once notified about all peers
- * being started (by the peers_started_callback function), calls
- * GNUNET_TESTING_connect_topology, which connects the peers in a
- * "straight line" topology.  On notification that all peers have
- * been properly connected, calls the do_get function which initiates
- * a GNUNET_DHT_get from the *second* peer. Once the GNUNET_DHT_get
- * function starts, runs the do_put function to insert data at the first peer.
- *   If the GET is successful, schedules finish_testing
- * to stop the test and shut down peers.  If GET is unsuccessful
- * after GET_TIMEOUT seconds, prints an error message and shuts down
- * the peers.
  */
 #include "platform.h"
 #include "gnunet_testing_lib.h"
index 0ce47ccec7de97cd0b886f0853385ec6d7e141e0..bdb233b3dc9947997cd3902d47615a1aa90d1a26 100644 (file)
@@ -79,7 +79,7 @@ HIJACK_DNS = NO
 UNIXPATH = /tmp/gnunet-service-gns.sock
 HOME = $SERVICEHOME
 CONFIG = $DEFAULTCONFIG
-
+AUTO_IMPORT_PKEY = YES
 
 
 [nse]