From: Vsevolod Stakhov Date: Wed, 17 Jan 2018 07:41:11 +0000 (+0000) Subject: [Minor] Add debugging for xmlrpc module X-Git-Tag: 1.7.0~270 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=87cbd4c29d7d60848a4cb018c462817a0a654ec7;p=thirdparty%2Frspamd.git [Minor] Add debugging for xmlrpc module --- diff --git a/src/lua/lua_xmlrpc.c b/src/lua/lua_xmlrpc.c index 96edee8044..2f129f37d1 100644 --- a/src/lua/lua_xmlrpc.c +++ b/src/lua/lua_xmlrpc.c @@ -26,6 +26,11 @@ static const struct luaL_reg xmlrpclib_m[] = { {NULL, NULL} }; +#define msg_debug_xmlrpc(...) rspamd_default_log_function (G_LOG_LEVEL_DEBUG, \ + "xmlrpc", "", \ + G_STRFUNC, \ + __VA_ARGS__) + enum lua_xmlrpc_state { read_method_responce = 0, read_params = 1, @@ -105,11 +110,13 @@ xmlrpc_start_element (GMarkupParseContext *context, last_state = ud->parser_state; + msg_debug_xmlrpc ("got start element %s on state %d", name, last_state); + switch (ud->parser_state) { case read_method_responce: /* Expect tag methodResponse */ if (g_ascii_strcasecmp (name, "methodResponse") == 0) { - ud->parser_state =read_params; + ud->parser_state = read_params; } else { /* Error state */ @@ -302,6 +309,9 @@ xmlrpc_start_element (GMarkupParseContext *context, break; } + msg_debug_xmlrpc ("switched state on start tag %d->%d", last_state, + ud->parser_state); + if (ud->parser_state == error_state) { g_set_error (error, xmlrpc_error_quark (), 1, "xmlrpc parse error on state: %d, while parsing start tag: %s", @@ -320,6 +330,8 @@ xmlrpc_end_element (GMarkupParseContext *context, last_state = ud->parser_state; + msg_debug_xmlrpc ("got end element %s on state %d", name, last_state); + switch (ud->parser_state) { case read_method_responce: ud->parser_state = error_state; @@ -483,6 +495,9 @@ xmlrpc_end_element (GMarkupParseContext *context, break; } + msg_debug_xmlrpc ("switched state on end tag %d->%d", + last_state, ud->parser_state); + if (ud->parser_state == error_state) { g_set_error (error, xmlrpc_error_quark (), 1, "xmlrpc parse error on state: %d, while parsing end tag: %s", @@ -511,7 +526,7 @@ xmlrpc_text (GMarkupParseContext *context, } if (text_len > 0) { - + msg_debug_xmlrpc ("got data on state %d", ud->parser_state); switch (ud->parser_state) { case read_struct_member_value: /* Push key */