Skip to content

Commit dbf9910

Browse files
ozgengreenbonebot
authored andcommitted
fix: use scan_report_id in get_scan_report
Use the generic get data ID field instead of storing the report ID separately. Update the GMP request attribute from report_id to scan_report_id and remove scan_report from the owned resource types.
1 parent 0d5c6e9 commit dbf9910

3 files changed

Lines changed: 8 additions & 25 deletions

File tree

src/gmp_scan_report.c

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
typedef struct
3131
{
3232
get_data_t get;
33-
gchar *report_id;
3433
} get_scan_report_data_t;
3534

3635
/**
@@ -45,7 +44,6 @@ static void
4544
get_scan_report_reset (void)
4645
{
4746
get_data_reset (&get_scan_report_data.get);
48-
g_free (get_scan_report_data.report_id);
4947

5048
memset (&get_scan_report_data, 0, sizeof (get_scan_report_data));
5149
}
@@ -539,24 +537,10 @@ void
539537
get_scan_report_start (const gchar **attribute_names,
540538
const gchar **attribute_values)
541539
{
542-
const gchar *attribute;
543-
544540
get_data_parse_attributes (&get_scan_report_data.get,
545-
"report",
541+
"scan_report",
546542
attribute_names,
547543
attribute_values);
548-
549-
if (find_attribute (attribute_names,
550-
attribute_values,
551-
"report_id",
552-
&attribute))
553-
{
554-
get_scan_report_data.report_id = g_strdup (attribute);
555-
556-
get_data_set_extra (&get_scan_report_data.get,
557-
"report_id",
558-
attribute);
559-
}
560544
}
561545

562546
/**
@@ -573,12 +557,12 @@ get_scan_report_run (gmp_parser_t *gmp_parser,
573557
report_summary_t summary = NULL;
574558
int ret;
575559

576-
if (get_scan_report_data.report_id == NULL)
560+
if (get_scan_report_data.get.id == NULL)
577561
{
578562
SEND_TO_CLIENT_OR_FAIL (
579563
XML_ERROR_SYNTAX (
580564
"get_scan_report",
581-
"Missing report_id attribute"));
565+
"Missing scan_report_id attribute"));
582566

583567
get_scan_report_reset ();
584568
return;
@@ -614,7 +598,7 @@ get_scan_report_run (gmp_parser_t *gmp_parser,
614598
g_free (get_scan_report_data.get.subtype);
615599
get_scan_report_data.get.subtype = g_strdup ("report");
616600
response = manage_get_scan_report_summary (
617-
get_scan_report_data.report_id,
601+
get_scan_report_data.get.id,
618602
&get_scan_report_data.get,
619603
&summary);
620604

@@ -627,7 +611,7 @@ get_scan_report_run (gmp_parser_t *gmp_parser,
627611
if (send_find_error_to_client (
628612
"get_scan_report",
629613
"report",
630-
get_scan_report_data.report_id,
614+
get_scan_report_data.get.id,
631615
gmp_parser))
632616
error_send_to_client (error);
633617

src/manage_resources.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,8 +325,7 @@ type_owned (const char* type)
325325
&& strcasecmp (type, "report_operating_system")
326326
&& strcasecmp (type, "report_port")
327327
&& strcasecmp (type, "report_tls_certificate")
328-
&& strcasecmp (type, "report_vuln")
329-
&& strcasecmp (type, "scan_report");
328+
&& strcasecmp (type, "report_vuln");
330329
}
331330

332331
/**

src/schema_formats/XML/GMP.xml.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20099,7 +20099,7 @@ END:VCALENDAR
2009920099
</description>
2010020100
<pattern>
2010120101
<attrib>
20102-
<name>report_id</name>
20102+
<name>scan_report_id</name>
2010320103
<summary>ID of the report to retrieve</summary>
2010420104
<type>uuid</type>
2010520105
<required>1</required>
@@ -20713,7 +20713,7 @@ END:VCALENDAR
2071320713
<summary>Get a structured vulnerability report</summary>
2071420714
<request>
2071520715
<get_scan_report
20716-
report_id="c00e2b2b-6b3a-4be9-a6df-337f76262fe0"
20716+
scan_report_id="c00e2b2b-6b3a-4be9-a6df-337f76262fe0"
2071720717
filter="apply_overrides=0 levels=chml min_qod=70 result_hosts_only=1">
2071820718
</get_scan_report>
2071920719
</request>

0 commit comments

Comments
 (0)