- htons => htonl
[oweals/gnunet.git] / src / namestore / gnunet-namestore.c
index 31adfabec98e98988be067ee5e83cb0b0954db62..ec6ccbfbedcfab86fad97d599179a0855bb6af4d 100644 (file)
@@ -1,4 +1,3 @@
-
 /*
      This file is part of GNUnet.
      (C) 2012, 2013 Christian Grothoff (and other contributing authors)
@@ -306,6 +305,7 @@ add_continuation (void *cls,
     if (GNUNET_NO != success)
       ret = 1;
   }
+  ret = 0;
   test_finished ();
 }
 
@@ -384,6 +384,10 @@ display_record (void *cls,
           rname);
   for (i=0;i<rd_len;i++)
   {
+    if ( (GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) &&
+         (0 != strcmp (rname,
+                       "+")) )
+      continue;
     typestring = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type);
     s = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
                                          rd[i].data,
@@ -704,12 +708,8 @@ testservice_task (void *cls,
     char sname[64];
     struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
 
-    if ( (2 != (sscanf (uri,
-                        "gnunet://gns/%104s/%63s",
-                        sh,
-                        sname)) ) ||
-         (GNUNET_OK !=
-          GNUNET_CRYPTO_ecdsa_public_key_from_string (sh, strlen (sh), &pkey)) )
+    if ( (2 != (sscanf (uri, "gnunet://gns/%52s/%63s", sh, sname)) ) ||
+         (GNUNET_OK != GNUNET_CRYPTO_ecdsa_public_key_from_string (sh, strlen (sh), &pkey)) )
     {
       fprintf (stderr,
                _("Invalid URI `%s'\n"),
@@ -732,7 +732,7 @@ testservice_task (void *cls,
     else
       rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us;
 
-    if (1 != shadow)
+    if (1 == shadow)
       rd.flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;
     add_qe_uri = GNUNET_NAMESTORE_records_store (ns,
                                                 &zone_pkey,
@@ -791,6 +791,7 @@ identity_cb (void *cls,
                ego_name);
     }
     GNUNET_SCHEDULER_shutdown ();
+    ret = -1;
     return;
   }
   zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego);
@@ -805,9 +806,9 @@ identity_cb (void *cls,
 
 static void
 default_ego_cb (void *cls,
-    struct GNUNET_IDENTITY_Ego *ego,
-    void **ctx,
-    const char *name)
+                struct GNUNET_IDENTITY_Ego *ego,
+                void **ctx,
+                const char *name)
 {
   get_default = NULL;
   if (NULL == ego)
@@ -815,6 +816,7 @@ default_ego_cb (void *cls,
     fprintf (stderr,
              _("No default ego configured in identity service\n"));
     GNUNET_SCHEDULER_shutdown ();
+    ret = -1;
     return;
   }
   else
@@ -823,17 +825,20 @@ default_ego_cb (void *cls,
   }
 }
 
+
 static void
 id_connect_cb (void *cls,
-    struct GNUNET_IDENTITY_Ego *ego,
-    void **ctx,
-    const char *name)
+               struct GNUNET_IDENTITY_Ego *ego,
+               void **ctx,
+               const char *name)
 {
   const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
+
   if (NULL == ego)
   {
-    get_default = GNUNET_IDENTITY_get (idh, "namestore",
-        &default_ego_cb, (void *) cfg);
+    get_default = GNUNET_IDENTITY_get (idh,
+                                       "namestore",
+                                       &default_ego_cb, (void *) cfg);
   }
 }
 
@@ -847,6 +852,7 @@ testservice_id_task (void *cls, int result)
     fprintf (stderr,
              _("Identity service is not running\n"));
     GNUNET_SCHEDULER_shutdown ();
+    ret = -1;
     return;
   }
   GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,
@@ -857,6 +863,7 @@ testservice_id_task (void *cls, int result)
     idh = GNUNET_IDENTITY_connect (cfg, &id_connect_cb, (void *) cfg);
     if (NULL == idh)
       fprintf (stderr, _("Cannot connect to identity service\n"));
+    ret = -1;
     return;
   }
   el = GNUNET_IDENTITY_ego_lookup (cfg,