mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2026-05-08 07:36:28 -04:00
msxml_parser: add MSXML_JSON_MULTI option for tracking multiple entries for same key
This commit is contained in:
@@ -260,6 +260,21 @@ static int msxml_parse_element(struct msxml_ctx *mxctx, xmlTextReaderPtr reader,
|
||||
cli_msxmlmsg("msxml_parse_element: retrieved json object [Count]\n");
|
||||
}
|
||||
|
||||
/* check if multiple entries are allowed */
|
||||
if (thisjobj && (keyinfo->type & MSXML_JSON_MULTI)) {
|
||||
/* replace this object with an array entry object */
|
||||
json_object *multi = cli_jsonarray(thisjobj, "Multi");
|
||||
if (!multi) {
|
||||
return CL_EMEM;
|
||||
}
|
||||
cli_msxmlmsg("msxml_parse_element: generated or retrieved json multi array\n");
|
||||
|
||||
thisjobj = cli_jsonobj(multi, NULL);
|
||||
if (!thisjobj)
|
||||
return CL_EMEM;
|
||||
cli_msxmlmsg("msxml_parse_element: generated json multi entry object\n");
|
||||
}
|
||||
|
||||
/* handle attributes */
|
||||
if (thisjobj && (keyinfo->type & MSXML_JSON_ATTRIB)) {
|
||||
state = xmlTextReaderHasAttributes(reader);
|
||||
|
||||
@@ -50,19 +50,20 @@ struct attrib_entry {
|
||||
|
||||
struct key_entry {
|
||||
/* how */
|
||||
#define MSXML_IGNORE 0x00
|
||||
#define MSXML_IGNORE_ELEM 0x01
|
||||
#define MSXML_SCAN_CB 0x02
|
||||
#define MSXML_SCAN_B64 0x04
|
||||
#define MSXML_IGNORE 0x0
|
||||
#define MSXML_IGNORE_ELEM 0x1
|
||||
#define MSXML_SCAN_CB 0x2
|
||||
#define MSXML_SCAN_B64 0x4
|
||||
/* where */
|
||||
#define MSXML_JSON_ROOT 0x08
|
||||
#define MSXML_JSON_WRKPTR 0x10
|
||||
#define MSXML_JSON_ROOT 0x8
|
||||
#define MSXML_JSON_WRKPTR 0x10
|
||||
#define MSXML_JSON_MULTI 0x20
|
||||
|
||||
#define MSXML_JSON_TRACK (MSXML_JSON_ROOT | MSXML_JSON_WRKPTR)
|
||||
/* what */
|
||||
#define MSXML_JSON_COUNT 0x20
|
||||
#define MSXML_JSON_VALUE 0x40
|
||||
#define MSXML_JSON_ATTRIB 0x80
|
||||
#define MSXML_JSON_COUNT 0x40
|
||||
#define MSXML_JSON_VALUE 0x80
|
||||
#define MSXML_JSON_ATTRIB 0x100
|
||||
|
||||
const char *key;
|
||||
const char *name;
|
||||
|
||||
Reference in New Issue
Block a user