- namestore.conf not installed
authorMatthias Wachs <wachs@net.in.tum.de>
Fri, 2 Mar 2012 08:45:06 +0000 (08:45 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Fri, 2 Mar 2012 08:45:06 +0000 (08:45 +0000)
src/namestore/Makefile.am
src/namestore/gnunet-service-namestore.c
src/namestore/test_namestore_api_sign_verify.c

index 4d9410f7b1707c0db709e276ba9660f439fd0050..852788a2d827f1442c253425ee6ee65e325d8d25 100644 (file)
@@ -2,10 +2,11 @@ INCLUDES = -I$(top_srcdir)/src/include
 
 plugindir = $(libdir)/gnunet
 
-pkgcfgdir= $(pkgnamedir)/config.d/
+pkgcfgdir= $(pkgdatadir)/config.d/
+
+pkgcfg_DATA = \
+   namestore.conf
 
-pkgcfg_NAME = \
-  namestore.conf
 
 if MINGW
   WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
index 7bb6ddd9166506911bdfd28df4f2b818c15239a8..c64ad3195421a87f1a794de98d8b56fcd03b668e 100644 (file)
@@ -464,7 +464,13 @@ static void handle_record_put (void *cls,
 
   rd_ser = &name[name_len];
   struct GNUNET_NAMESTORE_RecordData rd[rd_count];
-  GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_ser, rd_count, rd);
+  res = GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_ser, rd_count, rd);
+  if (res != GNUNET_OK)
+  {
+    GNUNET_break_op (0);
+    goto send;
+  }
+
 
   GNUNET_HashCode zone_hash;
   GNUNET_CRYPTO_hash (zone_key, key_len, &zone_hash);
@@ -483,7 +489,7 @@ static void handle_record_put (void *cls,
       name, (res == GNUNET_OK) ? "OK" : "FAIL");
 
   /* Send response */
-
+send:
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_PUT_RESPONSE");
   rpr_msg.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_PUT_RESPONSE);
   rpr_msg.op_id = rp_msg->gns_header.r_id;
@@ -502,8 +508,6 @@ struct CreateRecordContext
   struct GNUNET_NAMESTORE_RecordData *rd;
   struct GNUNET_CRYPTO_RsaPrivateKey *pkey;
   struct GNUNET_TIME_Absolute expire;
-  uint32_t op_id;
-  struct GNUNET_NAMESTORE_Client *nc;
 };
 
 
@@ -518,7 +522,6 @@ handle_create_record_it (void *cls,
 {
   struct CreateRecordContext * crc = cls;
   struct GNUNET_CRYPTO_RsaSignature *signature_new;
-  struct RecordCreateResponseMessage rcr_msg;
   int res;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u existing records for `%s'\n", rd_count, name);
@@ -541,18 +544,6 @@ handle_create_record_it (void *cls,
   GNUNET_free (signature_new);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Update result for name %u\n", res);
-  /* Send response */
-
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_CREATE_RESPONSE");
-  rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE);
-  rcr_msg.gns_header.r_id = htonl (crc->op_id);
-  rcr_msg.gns_header.header.size = htons (sizeof (struct RecordCreateResponseMessage));
-  if (GNUNET_OK == res)
-    rcr_msg.op_result = htons (GNUNET_OK);
-  else
-    rcr_msg.op_result = htons (GNUNET_NO);
-  GNUNET_SERVER_notification_context_unicast (snc, crc->nc->client, (const struct GNUNET_MessageHeader *) &rcr_msg, GNUNET_NO);
-
 }
 
 static void handle_record_create (void *cls,
@@ -564,6 +555,7 @@ static void handle_record_create (void *cls,
   struct CreateRecordContext crc;
   struct GNUNET_CRYPTO_RsaPrivateKey *pkey;
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
+  struct RecordCreateResponseMessage rcr_msg;
   GNUNET_HashCode pubkey_hash;
   size_t name_len;
   size_t msg_size;
@@ -576,7 +568,6 @@ static void handle_record_create (void *cls,
   char *rd_ser;
   int rd_count;
 
-
   int res = GNUNET_SYSERR;
 
   if (ntohs (message->size) < sizeof (struct RecordCreateMessage))
@@ -630,7 +621,12 @@ static void handle_record_create (void *cls,
   }
 
   struct GNUNET_NAMESTORE_RecordData rd[rd_count];
-  GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_ser, rd_count, rd);
+  res = GNUNET_NAMESTORE_records_deserialize(rd_ser_len, rd_ser, rd_count, rd);
+  if (res != GNUNET_OK)
+  {
+    GNUNET_break_op (0);
+    goto send;
+  }
   GNUNET_assert (rd_count == 1);
 
   /* Extracting and converting private key */
@@ -641,8 +637,6 @@ static void handle_record_create (void *cls,
 
   crc.pkey = pkey;
   crc.rd = rd;
-  crc.nc = nc;
-  crc.op_id = rid;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating record for name `%s' in zone `%s'\n", name_tmp, GNUNET_h2s(&pubkey_hash));
 
@@ -651,6 +645,18 @@ static void handle_record_create (void *cls,
 
   GNUNET_CRYPTO_rsa_key_free(pkey);
 
+  /* Send response */
+send:
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message\n", "RECORD_CREATE_RESPONSE");
+  rcr_msg.gns_header.header.type = htons (GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_CREATE_RESPONSE);
+  rcr_msg.gns_header.r_id = htonl (rid);
+  rcr_msg.gns_header.header.size = htons (sizeof (struct RecordCreateResponseMessage));
+  if (GNUNET_OK == res)
+    rcr_msg.op_result = htons (GNUNET_OK);
+  else
+    rcr_msg.op_result = htons (GNUNET_NO);
+  GNUNET_SERVER_notification_context_unicast (snc, nc->client, (const struct GNUNET_MessageHeader *) &rcr_msg, GNUNET_NO);
+
   GNUNET_SERVER_receive_done (client, GNUNET_OK);
 }
 
index 8a350ac8552eea5b601a5967fe9f6e838725b89c..084285eded56938a67b2dc7c7e6858df902b46bc 100644 (file)
@@ -97,6 +97,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   signature = GNUNET_NAMESTORE_create_signature (privkey, s_name, s_rd, RECORDS);
   GNUNET_break (signature != NULL);
 
+  GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "FYI: The next warning is intended!\n");
   res_w = GNUNET_NAMESTORE_verify_signature(&pubkey, s_name, RECORDS - 1, s_rd, signature);
   GNUNET_break (res_w == GNUNET_SYSERR);