gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r501 - in GNUnet: . src/applications/fs src/applications/fs


From: grothoff
Subject: [GNUnet-SVN] r501 - in GNUnet: . src/applications/fs src/applications/fs/ecrs
Date: Sat, 26 Mar 2005 21:20:09 -0800 (PST)

Author: grothoff
Date: 2005-03-26 21:20:08 -0800 (Sat, 26 Mar 2005)
New Revision: 501

Modified:
   GNUnet/src/applications/fs/ecrs/namespace.c
   GNUnet/src/applications/fs/ecrs/namespacetest.c
   GNUnet/src/applications/fs/ecrs/uri.c
   GNUnet/src/applications/fs/ecrs_core.c
   GNUnet/todo
Log:
upd

Modified: GNUnet/src/applications/fs/ecrs/namespace.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespace.c 2005-03-27 04:21:46 UTC (rev 
500)
+++ GNUnet/src/applications/fs/ecrs/namespace.c 2005-03-27 05:20:08 UTC (rev 
501)
@@ -120,8 +120,8 @@
   char ** keywords;
   unsigned int keywordCount;
   int i;
+  char * cpy;
 
-
   if ( (advertisementURI != NULL) &&
        (! ECRS_isKeywordURI(advertisementURI)) ) {
     BREAK();
@@ -218,11 +218,15 @@
   knb = (KNBlock*) &knvalue[1];
   knb->type = htonl(KN_BLOCK);
   memcpy(&knb->nblock,
-        &nb,
+        nb,
         sizeof(NBlock) + mdsize);
 
   keywords = advertisementURI->data.ksk.keywords;
   keywordCount = advertisementURI->data.ksk.keywordCount;
+  cpy = MALLOC(size - sizeof(KBlock) - sizeof(unsigned int));
+  memcpy(cpy, 
+        &knb->nblock,
+        size - sizeof(KBlock) - sizeof(unsigned int));
   for (i=0;i<keywordCount;i++) {
     hash(keywords[i],
         strlen(keywords[i]),
@@ -230,11 +234,14 @@
     pk = makeKblockKey(&hc);
     getPublicKey(pk,
                 &knb->kblock.keyspace);
-    GNUNET_ASSERT(size - sizeof(KBlock)
+    GNUNET_ASSERT(size - sizeof(KBlock) - sizeof(unsigned int)
                  == sizeof(NBlock) + mdsize);
     ECRS_encryptInPlace(&hc,
                        &knb->nblock,
-                       size - sizeof(KBlock));
+                       size - sizeof(KBlock) - sizeof(unsigned int));
+    printf("SIGN size: %u\n",
+          sizeof(NBlock) + mdsize);
+
     GNUNET_ASSERT(OK == sign(pk,
                             sizeof(NBlock) + mdsize,
                             &knb->nblock,
@@ -244,7 +251,12 @@
     if (OK != FS_insert(sock, knvalue))
       ret = SYSERR;
     FREE(keywords[i]);
+    /* restore nblock to avoid re-encryption! */
+    memcpy(&knb->nblock,
+          cpy,            
+          size - sizeof(KBlock) - sizeof(unsigned int));
   }
+  FREE(cpy);
   GROW(keywords, keywordCount, 0);
   FREE(knvalue);
   releaseClientSocket(sock);

Modified: GNUnet/src/applications/fs/ecrs/namespacetest.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/namespacetest.c     2005-03-27 04:21:46 UTC 
(rev 500)
+++ GNUnet/src/applications/fs/ecrs/namespacetest.c     2005-03-27 05:20:08 UTC 
(rev 501)
@@ -28,6 +28,7 @@
 #include "gnunet_util.h"
 #include "gnunet_ecrs_lib.h"
 #include "ecrs.h"
+#include <sys/wait.h>
 
 #define ABORT() { fprintf(stderr, "Error at %s:%d\n", __FILE__, __LINE__); 
return 1; }
 #define CHECK(c) { do { if (!(c)) ABORT(); } while(0); }
@@ -49,7 +50,7 @@
   };
   
 
-  CHECK(SYSERR == ECRS_deleteNamespace(CHECKNAME));
+  ECRS_deleteNamespace(CHECKNAME); /* make sure old one is deleted */
   meta = ECRS_createMetaData();
   adv = ECRS_keywordsToUri(keys);
   hash("root", 4, &root);
@@ -94,13 +95,14 @@
                                     NULL));
   FREENONNULL(setConfigurationString("GNUNET",
                                     "LOGLEVEL",
-                                    "NOTHING"));
+                                    "DEBUG"));
   return OK;
 }
 
 int main(int argc, char * argv[]) {
   pid_t daemon;
-  int failureCount = 0;
+  int status;
+  int failureCount = 0; 
 
   daemon = fork();
   if (daemon == 0) {
@@ -131,8 +133,7 @@
     if (daemon != waitpid(daemon, &status, 0))
       DIE_STRERROR("waitpid");
 
-    if (! ( (WEXITSTATUS(status) == 0) &&
-           (ok == YES) ) )
+    if (WEXITSTATUS(status) != 0)
       failureCount++;
   }
   if (failureCount == 0)

Modified: GNUnet/src/applications/fs/ecrs/uri.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/uri.c       2005-03-27 04:21:46 UTC (rev 
500)
+++ GNUnet/src/applications/fs/ecrs/uri.c       2005-03-27 05:20:08 UTC (rev 
501)
@@ -519,7 +519,7 @@
     kd = MALLOC(strlen(key) + 13);
     memset(kd, 0, strlen(key) + 13);
     strcpy(kd, key);
-    strftime(kd[strlen(key)],
+    strftime(&kd[strlen(key)],
             13,
             "-%Y-%m-%d",
             &t);

Modified: GNUnet/src/applications/fs/ecrs_core.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core.c      2005-03-27 04:21:46 UTC (rev 
500)
+++ GNUnet/src/applications/fs/ecrs_core.c      2005-03-27 05:20:08 UTC (rev 
501)
@@ -222,8 +222,11 @@
       return SYSERR;
     }
     kb = (const KNBlock*) data;
+    LOG(LOG_NOTHING,
+       "VERIFY size: %u\n",
+       size - sizeof(KBlock) - sizeof(unsigned int));
     if ( (OK != verifySig(&kb->nblock,
-                         size - sizeof(Signature) - sizeof(PublicKey) - 
sizeof(unsigned int),
+                         size - sizeof(KBlock) - sizeof(unsigned int),
                          &kb->kblock.signature,
                          &kb->kblock.keyspace)) ) {
       BREAK();

Modified: GNUnet/todo
===================================================================
--- GNUnet/todo 2005-03-27 04:21:46 UTC (rev 500)
+++ GNUnet/todo 2005-03-27 05:20:08 UTC (rev 501)
@@ -1,10 +1,10 @@
 0.7.0pre1 [4'05] (aka "preview"):
 Testing:
+- fix namespacetest (currently fails)
 - multi-peer:
   * fix dhttest (currently fails)
   * extend dht test to actually test get/put/del
 - FSUI
-- gnunet-pseudonym
 
 0.7.0 [5'05] (aka "compatibility? what's that?"):
 - Features removed but to be revived:





reply via email to

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