aboutsummaryrefslogtreecommitdiff
path: root/src/regex
diff options
context:
space:
mode:
authorBart Polot <bart@net.in.tum.de>2013-09-20 12:15:59 +0000
committerBart Polot <bart@net.in.tum.de>2013-09-20 12:15:59 +0000
commit5a45188a6d8bf111023b9c6cd81915c4b94b2fb3 (patch)
tree98ae9e8872130125ec0e33f0016f607c124b21c6 /src/regex
parentafa377f3c8aee8c10433629d8273850b650bd90a (diff)
downloadgnunet-5a45188a6d8bf111023b9c6cd81915c4b94b2fb3.tar.gz
gnunet-5a45188a6d8bf111023b9c6cd81915c4b94b2fb3.zip
- dont require xquery for PUTs
Diffstat (limited to 'src/regex')
-rw-r--r--src/regex/plugin_block_regex.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c
index 681ade880..5f3825f84 100644
--- a/src/regex/plugin_block_regex.c
+++ b/src/regex/plugin_block_regex.c
@@ -60,35 +60,37 @@ evaluate_block_regex (void *cls, enum GNUNET_BLOCK_Type type,
60 size_t reply_block_size) 60 size_t reply_block_size)
61{ 61{
62 if (NULL == reply_block) 62 if (NULL == reply_block)
63 { 63 {
64 if (0 != xquery_size) 64 if (0 != xquery_size)
65 { 65 {
66 const char *s; 66 const char *s;
67 67
68 s = (const char *) xquery; 68 s = (const char *) xquery;
69 if ('\0' != s[xquery_size - 1]) /* must be valid 0-terminated string */ 69 if ('\0' != s[xquery_size - 1]) /* must be valid 0-terminated string */
70 { 70 {
71 GNUNET_break_op (0); 71 GNUNET_break_op (0);
72 return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; 72 return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID;
73 } 73 }
74 } 74 }
75 return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; 75 return GNUNET_BLOCK_EVALUATION_REQUEST_VALID;
76 } 76 }
77 if (0 != xquery_size) 77 if (0 != xquery_size)
78 { 78 {
79 const char *query; 79 const char *s;
80 80
81 query = (const char *) xquery; 81 s = (const char *) xquery;
82 if ('\0' != query[xquery_size - 1]) /* must be valid 0-terminated string */ 82 if ('\0' != s[xquery_size - 1]) /* must be valid 0-terminated string */
83 { 83 {
84 GNUNET_break_op (0); 84 GNUNET_break_op (0);
85 return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; 85 return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID;
86 } 86 }
87 } 87 }
88 else 88 else if (NULL != query)
89 { 89 {
90 /* xquery is required for regex, at least an empty string */ 90 /* xquery is required for regex, at least an empty string */
91 GNUNET_break_op (0); 91 GNUNET_break_op (0);
92 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "type %d, query %p, xquery %p\n",
93 type, query, xquery);
92 return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; 94 return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID;
93 } 95 }
94 switch (REGEX_BLOCK_check (reply_block, 96 switch (REGEX_BLOCK_check (reply_block,