aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-07-08 21:38:00 +0000
committergrothoff <grothoff@140774ce-b5e7-0310-ab8b-a85725594a96>2012-07-08 21:38:00 +0000
commit7f4acf09d7dc991cca5de36a69fbf606a6c76587 (patch)
tree842f654a37163d9c3b5faa4c76b5e6bcfc778c87 /src
parentfd999c5cb1fa98e466c9eb070a7793d3aa7a3dd3 (diff)
-fix crash if private zone key did not exist
git-svn-id: https://gnunet.org/svn/gnunet@22548 140774ce-b5e7-0310-ab8b-a85725594a96
Diffstat (limited to 'src')
-rw-r--r--src/gns/gnunet-gns.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index 6643317daf..aad8cc8331 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -211,11 +211,11 @@ run (void *cls, char *const *args, const char *cfgfile,
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 @@ run (void *cls, char *const *args, const char *cfgfile,
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 @@ run (void *cls, char *const *args, const char *cfgfile,
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 @@ run (void *cls, char *const *args, const char *cfgfile,
shorten_name);
}
- if (lookup_name != NULL)
+ if (NULL != lookup_name)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Lookup\n");
@@ -274,7 +285,7 @@ run (void *cls, char *const *args, const char *cfgfile,
&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);
}