gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r22548 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r22548 - gnunet/src/gns
Date: Sun, 8 Jul 2012 23:38:00 +0200

Author: grothoff
Date: 2012-07-08 23:38:00 +0200 (Sun, 08 Jul 2012)
New Revision: 22548

Modified:
   gnunet/src/gns/gnunet-gns.c
Log:
-fix crash if private zone key did not exist

Modified: gnunet/src/gns/gnunet-gns.c
===================================================================
--- gnunet/src/gns/gnunet-gns.c 2012-07-08 21:11:06 UTC (rev 22547)
+++ gnunet/src/gns/gnunet-gns.c 2012-07-08 21:38:00 UTC (rev 22548)
@@ -211,11 +211,11 @@
   
   
   if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns",
-                                                   "PRIVATE_ZONEKEY", 
&keyfile))
+                                                           "PRIVATE_ZONEKEY", 
&keyfile))
   {
     if (!raw)
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-                  "No private zone key found!\n");
+                  "No private zone key file name specified in 
configuration!\n");
     shorten_key = NULL;
   }
   else
@@ -231,16 +231,28 @@
       if (!raw)
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                     "Using private zone: %s!\n", &zonename);
+    }
+    else
+    {
+      /* FIXME: shouldn't we just create the private key in this case? */
+      if (!raw)
+        fprintf (stderr,
+                _("Key file `%s' for private zone does not exist!\n"),
+                keyfile);
 
     }
     GNUNET_free(keyfile);
-    GNUNET_CRYPTO_rsa_key_free (private_key);
+    if (NULL != private_key)
+    {
+      GNUNET_CRYPTO_rsa_key_free (private_key);
+      private_key = NULL;
+    }
   }
   
   
   gns = GNUNET_GNS_connect (cfg);
-  if (lookup_type != NULL)
-    rtype = GNUNET_NAMESTORE_typename_to_number(lookup_type);
+  if (NULL != lookup_type)
+    rtype = GNUNET_NAMESTORE_typename_to_number (lookup_type);
   else
     rtype = GNUNET_GNS_RECORD_A;
 
@@ -251,9 +263,8 @@
     return;
   }
   
-  if (shorten_name != NULL)
+  if (NULL != shorten_name)
   {
-    /** shorten name */
     GNUNET_GNS_shorten_zone (gns, shorten_name,
                              &private_zone,
                              &shorten_zone,
@@ -262,7 +273,7 @@
                              shorten_name);
   }
 
-  if (lookup_name != NULL)
+  if (NULL != lookup_name)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Lookup\n");
@@ -274,7 +285,7 @@
                             &process_lookup_result, lookup_name);
   }
 
-  if (auth_name != NULL)
+  if (NULL != auth_name)
   {
     GNUNET_GNS_get_authority(gns, auth_name, &process_auth_result, auth_name);
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]