mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-11-15 17:12:14 +03:00
Finish XMLArgs processing in v3
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#ifdef WITH_LIBXML2
|
||||
#include <libxml/xmlschemas.h>
|
||||
#include <libxml/xpath.h>
|
||||
#include <libxml/SAX.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
@@ -33,12 +34,50 @@ namespace RequestBodyProcessor {
|
||||
|
||||
#ifdef WITH_LIBXML2
|
||||
|
||||
/*
|
||||
* NodeData for parsing XML into args
|
||||
*/
|
||||
class NodeData {
|
||||
public:
|
||||
explicit NodeData();
|
||||
~NodeData();
|
||||
|
||||
bool has_child;
|
||||
};
|
||||
|
||||
/*
|
||||
* XMLNodes for parsing XML into args
|
||||
*/
|
||||
class XMLNodes {
|
||||
public:
|
||||
std::vector<std::shared_ptr<NodeData>> nodes;
|
||||
unsigned long int node_depth;
|
||||
std::string currpath;
|
||||
std::string currval;
|
||||
Transaction *m_transaction;
|
||||
// need to store context - this is the same as at the xml_data
|
||||
// need to stop parsing if the number of arguments reached the limit
|
||||
xmlParserCtxtPtr parsing_ctx_arg;
|
||||
|
||||
explicit XMLNodes (Transaction *);
|
||||
~XMLNodes();
|
||||
};
|
||||
|
||||
struct xml_data {
|
||||
xmlSAXHandler *sax_handler;
|
||||
std::unique_ptr<xmlSAXHandler> sax_handler;
|
||||
xmlParserCtxtPtr parsing_ctx;
|
||||
xmlDocPtr doc;
|
||||
|
||||
unsigned int well_formed;
|
||||
|
||||
/* error reporting and XML array flag */
|
||||
std::string xml_error;
|
||||
|
||||
/* another parser context for arguments */
|
||||
xmlParserCtxtPtr parsing_ctx_arg;
|
||||
|
||||
/* parser state for SAX parser */
|
||||
std::unique_ptr<XMLNodes> xml_parser_state;
|
||||
};
|
||||
|
||||
typedef struct xml_data xml_data;
|
||||
|
||||
Reference in New Issue
Block a user