diff options
author | Bart Polot <bart@net.in.tum.de> | 2013-09-20 12:15:59 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2013-09-20 12:15:59 +0000 |
commit | 5a45188a6d8bf111023b9c6cd81915c4b94b2fb3 (patch) | |
tree | 98ae9e8872130125ec0e33f0016f607c124b21c6 /src/regex/plugin_block_regex.c | |
parent | afa377f3c8aee8c10433629d8273850b650bd90a (diff) |
- dont require xquery for PUTs
Diffstat (limited to 'src/regex/plugin_block_regex.c')
-rw-r--r-- | src/regex/plugin_block_regex.c | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c index 681ade880a..5f3825f84d 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, size_t reply_block_size) { if (NULL == reply_block) - { - if (0 != xquery_size) - { - const char *s; - - s = (const char *) xquery; - if ('\0' != s[xquery_size - 1]) /* must be valid 0-terminated string */ - { - GNUNET_break_op (0); - return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; - } - } - return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; - } + { + if (0 != xquery_size) + { + const char *s; + + s = (const char *) xquery; + if ('\0' != s[xquery_size - 1]) /* must be valid 0-terminated string */ + { + GNUNET_break_op (0); + return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; + } + } + return GNUNET_BLOCK_EVALUATION_REQUEST_VALID; + } if (0 != xquery_size) { - const char *query; + const char *s; - query = (const char *) xquery; - if ('\0' != query[xquery_size - 1]) /* must be valid 0-terminated string */ + s = (const char *) xquery; + if ('\0' != s[xquery_size - 1]) /* must be valid 0-terminated string */ { GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; } } - else + else if (NULL != query) { /* xquery is required for regex, 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); return GNUNET_BLOCK_EVALUATION_REQUEST_INVALID; } switch (REGEX_BLOCK_check (reply_block, |