Skip to content

Commit dba8311

Browse files
ozgengreenbonebot
authored andcommitted
expose target type in get_scan_report response
1 parent 1b924f0 commit dba8311

4 files changed

Lines changed: 55 additions & 5 deletions

File tree

src/gmp_scan_report.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,12 @@ send_scan_report_task (gmp_parser_t *gmp_parser,
233233
target->comment ? target->comment : ""))
234234
return TRUE;
235235

236+
if (send_report_xml (
237+
gmp_parser,
238+
"<target_type>%s</target_type>",
239+
report_target_type_to_string (target->type)))
240+
return TRUE;
241+
236242
if (send_report_xml (gmp_parser, "</target>"))
237243
return TRUE;
238244
}

src/manage_scan_report.c

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,38 @@ manage_get_scan_report_summary (const gchar *report_id,
391391

392392
return MANAGE_GET_SCAN_REPORT_SUCCESS;
393393
}
394+
395+
/**
396+
* @brief Get the string representation of a report target type.
397+
*
398+
* @param[in] type Report target type.
399+
*
400+
* @return String representation of the report target type.
401+
*/
402+
const gchar *
403+
report_target_type_to_string (report_target_type_t type)
404+
{
405+
switch (type)
406+
{
407+
case REPORT_TARGET_TYPE_NONE:
408+
return "none";
409+
410+
case REPORT_TARGET_TYPE_TARGET:
411+
return "target";
412+
413+
case REPORT_TARGET_TYPE_OCI_IMAGE:
414+
return "oci_image";
415+
416+
case REPORT_TARGET_TYPE_WEB_APPLICATION:
417+
return "web_application";
418+
419+
case REPORT_TARGET_TYPE_AGENT_GROUP:
420+
return "agent_group";
421+
422+
case REPORT_TARGET_TYPE_IMPORT:
423+
return "import";
424+
425+
default:
426+
return "unknown";
427+
}
428+
}

src/manage_scan_report.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,11 +176,13 @@ report_summary_t
176176
report_summary_new (void);
177177

178178
void
179-
report_summary_free (report_summary_t summary);
179+
report_summary_free (report_summary_t);
180180

181181
manage_get_scan_report_response_t
182-
manage_get_scan_report_summary (const gchar *report_id,
183-
const get_data_t *get,
184-
report_summary_t *summary);
182+
manage_get_scan_report_summary (const gchar *, const get_data_t *,
183+
report_summary_t *);
184+
185+
const gchar *
186+
report_target_type_to_string (report_target_type_t);
185187

186188
#endif /* _GVMD_MANAGE_SCAN_REPORT_H */

src/schema_formats/XML/GMP.xml.in

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20410,6 +20410,7 @@ END:VCALENDAR
2041020410
<e>trash</e>
2041120411
<e>name</e>
2041220412
<e>comment</e>
20413+
<e>target_type</e>
2041320414
</pattern>
2041420415
<ele>
2041520416
<name>trash</name>
@@ -20426,6 +20427,11 @@ END:VCALENDAR
2042620427
<summary>Comment associated with the target</summary>
2042720428
<pattern>text</pattern>
2042820429
</ele>
20430+
<ele>
20431+
<name>target_type</name>
20432+
<summary>Type of the target associated with the task</summary>
20433+
<pattern>text</pattern>
20434+
</ele>
2042920435
</ele>
2043020436
<ele>
2043120437
<name>progress</name>
@@ -20756,8 +20762,9 @@ END:VCALENDAR
2075620762
<comment></comment>
2075720763
<target id="4809d998-2d2d-4a65-9148-f99f04799b09">
2075820764
<trash>0</trash>
20759-
<name>samsung-tv</name>
20765+
<name>test-target</name>
2076020766
<comment></comment>
20767+
<target_type>target</target_type>
2076120768
</target>
2076220769
<progress>100</progress>
2076320770
</task>

0 commit comments

Comments
 (0)