[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r20177 - gnunet/src/namestore
From: |
gnunet |
Subject: |
[GNUnet-SVN] r20177 - gnunet/src/namestore |
Date: |
Thu, 1 Mar 2012 17:48:01 +0100 |
Author: wachs
Date: 2012-03-01 17:48:01 +0100 (Thu, 01 Mar 2012)
New Revision: 20177
Modified:
gnunet/src/namestore/test_namestore_api_create.c
gnunet/src/namestore/test_namestore_api_remove.c
gnunet/src/namestore/test_namestore_api_remove_not_existing_record.c
Log:
- added signature check
Modified: gnunet/src/namestore/test_namestore_api_create.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_create.c 2012-03-01 16:31:20 UTC
(rev 20176)
+++ gnunet/src/namestore/test_namestore_api_create.c 2012-03-01 16:48:01 UTC
(rev 20177)
@@ -198,6 +198,12 @@
}
}
+ if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature(&pubkey, n, rd_count,
rd, signature))
+ {
+ GNUNET_break (0);
+ failed = GNUNET_YES;
+ }
+
found = GNUNET_YES;
if (failed == GNUNET_NO)
res = 0;
Modified: gnunet/src/namestore/test_namestore_api_remove.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_remove.c 2012-03-01 16:31:20 UTC
(rev 20176)
+++ gnunet/src/namestore/test_namestore_api_remove.c 2012-03-01 16:48:01 UTC
(rev 20177)
@@ -174,7 +174,12 @@
GNUNET_break (0 == memcmp (rd[c].data, s_rd[c+1].data,
TEST_RECORD_DATALEN));
}
- found = GNUNET_YES;
+ if (GNUNET_OK != GNUNET_NAMESTORE_verify_signature(&pubkey, n, rd_count,
rd, signature))
+ {
+ GNUNET_break (0);
+ failed = GNUNET_YES;
+ }
+
if (failed == GNUNET_NO)
res = 0;
else
@@ -205,7 +210,7 @@
else
{
res = 1;
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to put records for name
`%s'\n", name);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to remove record for name
`%s'\n", name);
GNUNET_SCHEDULER_add_now(&end, NULL);
}
Modified: gnunet/src/namestore/test_namestore_api_remove_not_existing_record.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_remove_not_existing_record.c
2012-03-01 16:31:20 UTC (rev 20176)
+++ gnunet/src/namestore/test_namestore_api_remove_not_existing_record.c
2012-03-01 16:48:01 UTC (rev 20177)
@@ -196,7 +196,7 @@
remove_cont (void *cls, int32_t success, const char *emsg)
{
char *name = cls;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Remove record for `%s': %s\n", name,
(success == GNUNET_YES) ? "SUCCESS" : "FAIL", emsg);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Remove record for `%s': %s `%s'\n",
name, (success == GNUNET_YES) ? "SUCCESS" : "FAIL", emsg);
if (success == GNUNET_OK)
{
res = 0;
@@ -219,9 +219,16 @@
if (success == GNUNET_OK)
{
res = 0;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing record for `%s'\n", name);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing non existing record for
`%s'\n", name);
- GNUNET_NAMESTORE_record_remove (nsh, privkey, name, &s_rd[0],
&remove_cont, name);
+ struct GNUNET_NAMESTORE_RecordData rd;
+ char data[TEST_REMOVE_RECORD_DATALEN];
+ rd.expiration = GNUNET_TIME_absolute_get();
+ rd.record_type = TEST_REMOVE_RECORD_TYPE;
+ rd.data_size = TEST_REMOVE_RECORD_DATALEN;
+ rd.data = &data;
+
+ GNUNET_NAMESTORE_record_remove (nsh, privkey, name, &rd, &remove_cont,
name);
}
else
{
@@ -238,14 +245,7 @@
struct GNUNET_NAMESTORE_RecordData * rd;
rd = GNUNET_malloc (count * sizeof (struct GNUNET_NAMESTORE_RecordData));
- rd[0].expiration = GNUNET_TIME_absolute_get();
- rd[0].record_type = 0;
- rd[0].data_size = TEST_REMOVE_RECORD_DATALEN;
- rd[0].data = GNUNET_malloc(TEST_RECORD_DATALEN);
- memset ((char *) rd[0].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN);
-
-
- for (c = 1; c < RECORDS; c++)
+ for (c = 0; c < RECORDS; c++)
{
rd[c].expiration = GNUNET_TIME_absolute_get();
rd[c].record_type = TEST_RECORD_TYPE;
@@ -293,8 +293,6 @@
nsh = GNUNET_NAMESTORE_connect (cfg);
GNUNET_break (NULL != nsh);
-
-
GNUNET_break (s_rd != NULL);
GNUNET_break (s_name != NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r20177 - gnunet/src/namestore,
gnunet <=