-fix
[oweals/gnunet.git] / src / namestore / gnunet-namestore.c
index c58d58fd1f50e685fcf702d33231e5b9b25f8e95..eb77913cc50a1f4c953427b4282f88ace6bad637 100644 (file)
@@ -41,7 +41,7 @@ static struct GNUNET_NAMESTORE_Handle *ns;
 /**
  * Hash of the public key of our zone.
  */
-static GNUNET_HashCode zone;
+static struct GNUNET_CRYPTO_ShortHashCode zone;
 
 /**
  * Private key for the our zone.
@@ -260,10 +260,17 @@ run (void *cls, char *const *args, const char *cfgfile,
 
   if (NULL == keyfile)
   {
-    fprintf (stderr,
-            _("Option `%s' not given, but I need a zone key file!\n"),
-            "z");
-    return;
+      if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
+                                                 "ZONEKEY", &keyfile))
+      {
+        fprintf (stderr,
+                 _("Option `%s' not given, but I need a zone key file!\n"),
+                 "z");
+        return;
+      }
+      fprintf (stderr,
+               _("Using default zone file `%s'\n"),
+               keyfile);
   }
   zone_pkey = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
   GNUNET_free (keyfile);
@@ -271,6 +278,8 @@ run (void *cls, char *const *args, const char *cfgfile,
   if (! (add|del|list))
   {
     /* nothing more to be done */  
+    fprintf (stderr,
+             _("No options given\n"));
     GNUNET_CRYPTO_rsa_key_free (zone_pkey);
     zone_pkey = NULL;
     return; 
@@ -283,7 +292,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   }
   GNUNET_CRYPTO_rsa_key_get_public (zone_pkey,
                                    &pub);
-  GNUNET_CRYPTO_hash (&pub, sizeof (pub), &zone);
+  GNUNET_CRYPTO_short_hash (&pub, sizeof (pub), &zone);
 
   ns = GNUNET_NAMESTORE_connect (cfg);
   if (NULL == ns)