gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r7361 - GNUnet/src/applications/fs/ecrs


From: gnunet
Subject: [GNUnet-SVN] r7361 - GNUnet/src/applications/fs/ecrs
Date: Sat, 28 Jun 2008 23:42:34 -0600 (MDT)

Author: grothoff
Date: 2008-06-28 23:42:34 -0600 (Sat, 28 Jun 2008)
New Revision: 7361

Modified:
   GNUnet/src/applications/fs/ecrs/search.c
Log:
fixing namespace discovery

Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c    2008-06-28 23:01:19 UTC (rev 
7360)
+++ GNUnet/src/applications/fs/ecrs/search.c    2008-06-29 05:42:34 UTC (rev 
7361)
@@ -229,7 +229,7 @@
   static GNUNET_HashCode allZeros;
   struct GNUNET_GE_Context *ectx = sqc->ectx;
   GNUNET_ECRS_FileInfo fi;
-  struct GNUNET_ECRS_URI updateURI;
+  URI updateURI;
   int ret;
   const char *id;
   const char *uris;
@@ -253,11 +253,21 @@
     }
   isRoot = 0 == memcmp (&sb->identifier, &allZeros, sizeof (GNUNET_HashCode));
   fi.uri = GNUNET_ECRS_string_to_uri (ectx, uris);
+  if ( (isRoot) &&
+       (fi.uri == NULL) )
+    {
+      fi.uri = GNUNET_malloc(sizeof(URI));
+      fi.uri->type = sks;
+      GNUNET_hash (&sb->subspace,
+                  sizeof(GNUNET_RSA_PublicKey),
+                  &fi.uri->data.sks.namespace);
+      fi.uri->data.sks.identifier = GNUNET_strdup(id);
+    }
   if (fi.uri == NULL)
     {
       GNUNET_GE_BREAK_OP (ectx, 0);     /* sblock malformed */
       GNUNET_meta_data_destroy (fi.meta);
-      return GNUNET_SYSERR;
+      return GNUNET_SYSERR;      
     }
   if (sqc->spcb != NULL)
     {
@@ -267,7 +277,8 @@
     }
   else
     ret = GNUNET_OK;
-  if (strlen (id) > 0)
+  if ( (strlen (id) > 0) &&
+       (strlen (uris) > 0) )
     {
       updateURI.type = sks;
       GNUNET_hash (&sb->subspace,
@@ -278,6 +289,7 @@
       GNUNET_free (updateURI.data.sks.identifier);
     }
   GNUNET_meta_data_destroy (fi.meta);
+  GNUNET_ECRS_uri_destroy (fi.uri);
   return ret;
 }
 





reply via email to

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