[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3758 - in GNUnet/src: applications/fs applications/fs/ecrs
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3758 - in GNUnet/src: applications/fs applications/fs/ecrs applications/fs/module applications/gap include |
Date: |
Mon, 13 Nov 2006 18:56:48 -0800 (PST) |
Author: grothoff
Date: 2006-11-13 18:56:38 -0800 (Mon, 13 Nov 2006)
New Revision: 3758
Modified:
GNUnet/src/applications/fs/ecrs/search.c
GNUnet/src/applications/fs/ecrs_core.c
GNUnet/src/applications/fs/module/fs.c
GNUnet/src/applications/gap/gap.c
GNUnet/src/include/ecrs_core.h
Log:
fixing Mantis #1147
Modified: GNUnet/src/applications/fs/ecrs/search.c
===================================================================
--- GNUnet/src/applications/fs/ecrs/search.c 2006-11-14 02:06:59 UTC (rev
3757)
+++ GNUnet/src/applications/fs/ecrs/search.c 2006-11-14 02:56:38 UTC (rev
3758)
@@ -358,6 +358,7 @@
(YES == isDatumApplicable(type,
size,
(const DBlock*) &value[1],
+ &query,
ps->keyCount,
ps->keys)) ) {
switch (type) {
Modified: GNUnet/src/applications/fs/ecrs_core.c
===================================================================
--- GNUnet/src/applications/fs/ecrs_core.c 2006-11-14 02:06:59 UTC (rev
3757)
+++ GNUnet/src/applications/fs/ecrs_core.c 2006-11-14 02:56:38 UTC (rev
3758)
@@ -55,7 +55,9 @@
GE_ASSERT(NULL, len >= sizeof(DBlock));
GE_ASSERT(NULL, (data!=NULL) && (query != NULL));
- hash(&data[1], len - sizeof(DBlock), &hc);
+ hash(&data[1],
+ len - sizeof(DBlock),
+ &hc);
hashToKey(&hc,
&skey,
&iv);
@@ -67,26 +69,27 @@
val->expirationTime = htonl(0);
db = (DBlock*) &val[1];
db->type = htonl(D_BLOCK);
- GE_ASSERT(NULL, len - sizeof(DBlock) < MAX_BUFFER_SIZE);
- GE_ASSERT(NULL, len - sizeof(DBlock)
- == encryptBlock(&data[1],
- len - sizeof(DBlock),
- &skey,
- &iv,
- &db[1]));
+ GE_ASSERT(NULL,
+ len - sizeof(DBlock) < MAX_BUFFER_SIZE);
+ GE_ASSERT(NULL,
+ len - sizeof(DBlock)
+ == encryptBlock(&data[1],
+ len - sizeof(DBlock),
+ &skey,
+ &iv,
+ &db[1]));
hash(&db[1],
len - sizeof(DBlock),
&hc);
- if (equalsHashCode512(query,
- &hc)) {
- *value = val;
- return OK;
- } else {
+ if (! equalsHashCode512(query,
+ &hc)) {
FREE(val);
GE_BREAK(NULL, 0);
*value = NULL;
return SYSERR;
}
+ *value = val;
+ return OK;
}
/**
@@ -274,6 +277,7 @@
* @param type the type of the query
* @param size the size of the data
* @param data the encoded data
+ * @param hc result of getQueryFor
* @param keyCount the number of keys in the query,
* use 0 to match only primary key
* @param keys the keys of the query
@@ -284,19 +288,16 @@
int isDatumApplicable(unsigned int type,
unsigned int size,
const DBlock * data,
+ const HashCode512 * hc,
unsigned int keyCount,
const HashCode512 * keys) {
- HashCode512 hc;
+ HashCode512 h;
if (type != getTypeOfBlock(size, data)) {
GE_BREAK(NULL, 0);
return SYSERR; /* type mismatch */
}
- if (OK != getQueryFor(size, data, YES, &hc)) {
- GE_BREAK(NULL, 0); /* malformed data */
- return SYSERR;
- }
- if (! equalsHashCode512(&hc, &keys[0])) {
+ if (! equalsHashCode512(hc, &keys[0])) {
GE_BREAK(NULL, 0); /* mismatch between primary queries,
we should not even see those here. */
return SYSERR;
@@ -309,23 +310,21 @@
return SYSERR; /* no match */
hash(&((const SBlock*)data)->subspace,
sizeof(PublicKey),
- &hc);
+ &h);
if (equalsHashCode512(&keys[1],
- &hc))
+ &h))
return OK;
- else
- return SYSERR;
+ return SYSERR;
case N_BLOCK:
if (keyCount != 2)
return SYSERR; /* no match */
hash(&((const NBlock*)data)->subspace,
sizeof(PublicKey),
- &hc);
- if (equalsHashCode512(&keys[1],
- &hc))
- return OK;
- else
+ &h);
+ if (! equalsHashCode512(&keys[1],
+ &h))
return SYSERR;
+ return OK;
case D_BLOCK:
case K_BLOCK:
case KN_BLOCK:
Modified: GNUnet/src/applications/fs/module/fs.c
===================================================================
--- GNUnet/src/applications/fs/module/fs.c 2006-11-14 02:06:59 UTC (rev
3757)
+++ GNUnet/src/applications/fs/module/fs.c 2006-11-14 02:56:38 UTC (rev
3758)
@@ -181,6 +181,7 @@
if (YES != isDatumApplicable(ntohl(dv->type),
ntohl(dv->size) - sizeof(Datastore_Value),
(DBlock*) &dv[1],
+ &hc,
0,
query)) {
GE_BREAK(ectx, 0);
@@ -674,6 +675,7 @@
ret = isDatumApplicable(ntohl(value->type),
ntohl(value->size) - sizeof(Datastore_Value),
(const DBlock*) &value[1],
+ key,
ggc->keyCount,
ggc->keys);
if (ret == SYSERR) {
@@ -868,6 +870,7 @@
ret = isDatumApplicable(ntohl(value->type),
ntohl(value->size) - sizeof(Datastore_Value),
(const DBlock*) &value[1],
+ key,
ggc->keyCount,
ggc->keys);
if (ret == SYSERR) {
Modified: GNUnet/src/applications/gap/gap.c
===================================================================
--- GNUnet/src/applications/gap/gap.c 2006-11-14 02:06:59 UTC (rev 3757)
+++ GNUnet/src/applications/gap/gap.c 2006-11-14 02:56:38 UTC (rev 3758)
@@ -1355,10 +1355,10 @@
primaryKey);
#endif
+ if (rhf == NULL)
+ return OK; /* drop, not fully initialized! */
/* check seen */
ite = &ROUTING_indTable_[computeRoutingIndex(primaryKey)];
- if (rhf == NULL)
- return OK; /* drop, not fully initialized! */
rhf(value,
&hc);
for (i=0;i<ite->seenIndex;i++)
@@ -1635,13 +1635,15 @@
if (ret == SYSERR) {
EncName enc;
- IF_GELOG(ectx, GE_ERROR | GE_BULK | GE_USER,
- if (host != NULL)
- hash2enc(&host->hashPubKey,
- &enc));
- GE_LOG(ectx, GE_ERROR | GE_BULK | GE_USER,
- _("GAP received invalid content from `%s'\n"),
- (host != NULL) ? (const char*)&enc : _("myself"));
+ IF_GELOG(ectx,
+ GE_ERROR | GE_BULK | GE_USER,
+ if (host != NULL)
+ hash2enc(&host->hashPubKey,
+ &enc));
+ GE_LOG(ectx,
+ GE_ERROR | GE_BULK | GE_USER,
+ _("GAP received invalid content from `%s'\n"),
+ (host != NULL) ? (const char*)&enc : _("myself"));
GE_BREAK(ectx, 0);
FREE(value);
return SYSERR; /* invalid */
Modified: GNUnet/src/include/ecrs_core.h
===================================================================
--- GNUnet/src/include/ecrs_core.h 2006-11-14 02:06:59 UTC (rev 3757)
+++ GNUnet/src/include/ecrs_core.h 2006-11-14 02:56:38 UTC (rev 3758)
@@ -216,6 +216,7 @@
* @param type the type of the queryo
* @param size the size of the data
* @param data the encoded data
+ * @param knownDatumQuery result of getQueryFor
* @param keyCount the number of keys in the query
* @param keys the keys of the query
* @return YES if this data matches the query, otherwise
@@ -225,6 +226,7 @@
int isDatumApplicable(unsigned int type,
unsigned int size,
const DBlock * data,
+ const HashCode512 * knownDatumQuery,
unsigned int keyCount,
const HashCode512 * keys);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3758 - in GNUnet/src: applications/fs applications/fs/ecrs applications/fs/module applications/gap include,
grothoff <=