[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r29436 - gnunet/src/regex
From: |
gnunet |
Subject: |
[GNUnet-SVN] r29436 - gnunet/src/regex |
Date: |
Fri, 20 Sep 2013 16:40:31 +0200 |
Author: bartpolot
Date: 2013-09-20 16:40:31 +0200 (Fri, 20 Sep 2013)
New Revision: 29436
Modified:
gnunet/src/regex/plugin_block_regex.c
gnunet/src/regex/regex_block_lib.c
gnunet/src/regex/regex_internal_dht.c
Log:
- fix block validation for DHT PUT requests
Modified: gnunet/src/regex/plugin_block_regex.c
===================================================================
--- gnunet/src/regex/plugin_block_regex.c 2013-09-20 13:43:59 UTC (rev
29435)
+++ gnunet/src/regex/plugin_block_regex.c 2013-09-20 14:40:31 UTC (rev
29436)
@@ -87,7 +87,7 @@
}
else if (NULL != query)
{
- /* xquery is required for regex, at least an empty string */
+ /* xquery is required for regex GETs, at least an empty string */
GNUNET_break_op (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "type %d, query %p, xquery %p\n",
type, query, xquery);
Modified: gnunet/src/regex/regex_block_lib.c
===================================================================
--- gnunet/src/regex/regex_block_lib.c 2013-09-20 13:43:59 UTC (rev 29435)
+++ gnunet/src/regex/regex_block_lib.c 2013-09-20 14:40:31 UTC (rev 29436)
@@ -211,6 +211,7 @@
struct CheckEdgeContext ctx;
int res;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Block check\n");
if (GNUNET_OK !=
REGEX_BLOCK_get_key (block, size,
&key))
@@ -218,16 +219,22 @@
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
- if (0 != memcmp (&key,
- query,
- sizeof (struct GNUNET_HashCode)))
+ if (NULL != query &&
+ 0 != memcmp (&key,
+ query,
+ sizeof (struct GNUNET_HashCode)))
{
GNUNET_break_op (0);
return GNUNET_SYSERR;
}
if ( (GNUNET_YES == ntohs (block->is_accepting)) &&
( (NULL == xquery) || ('\0' == xquery[0]) ) )
+ {
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ " out! Is accepting: %u, xquery %p\n",
+ ntohs(block->is_accepting), xquery);
return GNUNET_OK;
+ }
ctx.xquery = xquery;
ctx.found = GNUNET_NO;
res = REGEX_BLOCK_iterate (block, size, &check_edge, &ctx);
@@ -235,6 +242,7 @@
return GNUNET_SYSERR;
if (NULL == xquery)
return GNUNET_YES;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Result %d\n", ctx.found);
return ctx.found;
}
@@ -312,6 +320,7 @@
unsigned int n;
size_t off;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Block iterate\n");
if (size < sizeof (struct RegexBlock))
{
GNUNET_break_op (0);
@@ -347,8 +356,9 @@
for (n=0;n<num_edges;n++)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
- "Edge %u, off %u tokenlen %u\n", n, off,
- ntohs (edges[n].token_length));
+ " Edge %u/%u, off %u tokenlen %u (%.*s)\n", n+1, num_edges, off,
+ ntohs (edges[n].token_length), ntohs (edges[n].token_length),
+ &aux[off]);
if (NULL != iterator)
if (GNUNET_NO == iterator (iter_cls,
&aux[off],
Modified: gnunet/src/regex/regex_internal_dht.c
===================================================================
--- gnunet/src/regex/regex_internal_dht.c 2013-09-20 13:43:59 UTC (rev
29435)
+++ gnunet/src/regex/regex_internal_dht.c 2013-09-20 14:40:31 UTC (rev
29436)
@@ -595,11 +595,12 @@
const char *rest;
int result;
+ LOG (GNUNET_ERROR_TYPE_DEBUG, "Next edge\n");
/* Find the longest match for the current string position,
* among tokens in the given block */
ctx->longest_match = 0;
result = REGEX_BLOCK_iterate (block, size,
- ®ex_edge_iterator, ctx);
+ ®ex_edge_iterator, ctx);
GNUNET_break (GNUNET_OK == result);
/* Did anything match? */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r29436 - gnunet/src/regex,
gnunet <=