From 14b8de5fc446b1f93e7fc56c307884899f0e3071 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Wed, 24 Jul 2024 23:46:01 +0200 Subject: [PATCH 1/4] Clean alignment in handle_get_nvts --- src/gmp.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/gmp.c b/src/gmp.c index 68902bb48..128ff751a 100644 --- a/src/gmp.c +++ b/src/gmp.c @@ -13793,25 +13793,25 @@ handle_get_nvts (gmp_parser_t *gmp_parser, GError **error) (XML_ERROR_SYNTAX ("get_nvts", "Too many parameters at once")); else if ((get_nvts_data->details == 0) - && get_nvts_data->preference_count) + && get_nvts_data->preference_count) SEND_TO_CLIENT_OR_FAIL (XML_ERROR_SYNTAX ("get_nvts", "The preference_count attribute" " requires the details attribute")); else if ((get_nvts_data->details == 0) - && get_nvts_data->preferences) + && get_nvts_data->preferences) SEND_TO_CLIENT_OR_FAIL (XML_ERROR_SYNTAX ("get_nvts", "The preferences attribute" " requires the details attribute")); else if ((get_nvts_data->details == 0) - && get_nvts_data->skip_cert_refs) + && get_nvts_data->skip_cert_refs) SEND_TO_CLIENT_OR_FAIL (XML_ERROR_SYNTAX ("get_nvts", "The skip_cert_refs attribute" " requires the details attribute")); else if ((get_nvts_data->details == 0) - && get_nvts_data->skip_tags) + && get_nvts_data->skip_tags) SEND_TO_CLIENT_OR_FAIL (XML_ERROR_SYNTAX ("get_nvts", "The skip_tags attribute" @@ -13825,14 +13825,14 @@ handle_get_nvts (gmp_parser_t *gmp_parser, GError **error) else if (((get_nvts_data->details == 0) || ((get_nvts_data->config_id == NULL) && (get_nvts_data->preferences_config_id == NULL))) - && get_nvts_data->timeout) + && get_nvts_data->timeout) SEND_TO_CLIENT_OR_FAIL (XML_ERROR_SYNTAX ("get_nvts", "The timeout attribute" " requires the details and config_id" " attributes")); else if (get_nvts_data->nvt_oid - && find_nvt (get_nvts_data->nvt_oid, &nvt)) + && find_nvt (get_nvts_data->nvt_oid, &nvt)) SEND_TO_CLIENT_OR_FAIL (XML_INTERNAL_ERROR ("get_nvts")); else if (get_nvts_data->nvt_oid && nvt == 0) @@ -13846,15 +13846,15 @@ handle_get_nvts (gmp_parser_t *gmp_parser, GError **error) } } else if (get_nvts_data->config_id - && get_nvts_data->preferences_config_id) + && get_nvts_data->preferences_config_id) SEND_TO_CLIENT_OR_FAIL (XML_ERROR_SYNTAX ("get_nvts", "config_id and" " preferences_config_id both given")); else if (get_nvts_data->config_id - && find_config_with_permission (get_nvts_data->config_id, - &config, - NULL)) + && find_config_with_permission (get_nvts_data->config_id, + &config, + NULL)) SEND_TO_CLIENT_OR_FAIL (XML_INTERNAL_ERROR ("get_nvts")); else if (get_nvts_data->config_id && (config == 0)) @@ -13868,19 +13868,19 @@ handle_get_nvts (gmp_parser_t *gmp_parser, GError **error) } } else if (get_nvts_data->preferences_config_id - && find_config_with_permission + && find_config_with_permission (get_nvts_data->preferences_config_id, - &preferences_config, - NULL)) + &preferences_config, + NULL)) SEND_TO_CLIENT_OR_FAIL (XML_INTERNAL_ERROR ("get_nvts")); else if (get_nvts_data->preferences_config_id - && (preferences_config == 0)) + && (preferences_config == 0)) { if (send_find_error_to_client ("get_nvts", "config", - get_nvts_data->preferences_config_id, - gmp_parser)) + get_nvts_data->preferences_config_id, + gmp_parser)) { error_send_to_client (error); return; @@ -13896,16 +13896,16 @@ handle_get_nvts (gmp_parser_t *gmp_parser, GError **error) " status_text=\"" STATUS_OK_TEXT "\">"); init_nvt_iterator (&nvts, - nvt, - get_nvts_data->nvt_oid - /* Presume the NVT is in the config (if - * a config was given). */ - ? 0 - : config, - get_nvts_data->family, - NULL, - get_nvts_data->sort_order, - get_nvts_data->sort_field); + nvt, + get_nvts_data->nvt_oid + /* Presume the NVT is in the config (if + * a config was given). */ + ? 0 + : config, + get_nvts_data->family, + NULL, + get_nvts_data->sort_order, + get_nvts_data->sort_field); if (preferences_config) config = preferences_config; if (get_nvts_data->details) @@ -13921,7 +13921,7 @@ handle_get_nvts (gmp_parser_t *gmp_parser, GError **error) if (get_nvts_data->preferences && (timeout == NULL)) timeout = config_nvt_timeout (config, - nvt_iterator_oid (&nvts)); + nvt_iterator_oid (&nvts)); if (get_nvts_data->preference_count) { From ff50da4847113f96e456042d6f5aaf414bc5ffb1 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Thu, 25 Jul 2024 00:08:15 +0200 Subject: [PATCH 2/4] GMP doc: add HR_NAME to PREFERENCE in GET_NVTS --- src/schema_formats/XML/GMP.xml.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/schema_formats/XML/GMP.xml.in b/src/schema_formats/XML/GMP.xml.in index 44fb9e906..357599d87 100644 --- a/src/schema_formats/XML/GMP.xml.in +++ b/src/schema_formats/XML/GMP.xml.in @@ -14618,6 +14618,7 @@ END:VCALENDAR nvt name + hr_name id type value @@ -14646,6 +14647,11 @@ END:VCALENDAR The name of the preference text + + hr_name + The human readable name of the preference + name + id The ID of the preference From 26af2722d9e0179f062734400b2b64c7b9ee9c32 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Thu, 25 Jul 2024 00:18:03 +0200 Subject: [PATCH 3/4] GMP doc: GET_NVTS: move category list into response --- src/schema_formats/XML/GMP.xml.in | 35 ++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) diff --git a/src/schema_formats/XML/GMP.xml.in b/src/schema_formats/XML/GMP.xml.in index 357599d87..f81eaa5f0 100644 --- a/src/schema_formats/XML/GMP.xml.in +++ b/src/schema_formats/XML/GMP.xml.in @@ -14200,10 +14200,6 @@ END:VCALENDAR NVT information. If the manager cannot access a list of available NVTs at that time, it will reply with the 503 response.

-

- NVT categories: 0 init, 1 scanner, 2 settings, 3 infos, 4 attack, 5 mixed, - 6 destructive attack, 7 denial, 8 kill host, 9 flood, 10 end, and 11 unknown. -

@@ -14324,7 +14320,36 @@ END:VCALENDAR category The category of the NVT - integer + +

0: init

+

1: scanner

+

2: settings

+

3: infos

+

4: attack

+

5: mixed

+

6: destructive attack

+

7: denial

+

8: kill host

+

9: flood

+

10: end

+

11: unknown

+
+ + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + +
creation_time From eb43e211f1edf18641271b92031a7664e74be775 Mon Sep 17 00:00:00 2001 From: Matt Mundell Date: Thu, 25 Jul 2024 00:24:36 +0200 Subject: [PATCH 4/4] GMP doc: GET_NVTS: remove SUMMARY --- src/schema_formats/XML/GMP.xml.in | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/schema_formats/XML/GMP.xml.in b/src/schema_formats/XML/GMP.xml.in index f81eaa5f0..53d71da2b 100644 --- a/src/schema_formats/XML/GMP.xml.in +++ b/src/schema_formats/XML/GMP.xml.in @@ -14296,7 +14296,6 @@ END:VCALENDAR creation_time modification_time category - summary family cvss_base severities @@ -14407,11 +14406,6 @@ END:VCALENDAR
- - summary - Short description of the NVT - text - family Name of the family the NVT belongs to @@ -14719,7 +14713,6 @@ END:VCALENDAR 2011-01-14T10:12:23+01:00 2012-09-19T20:56:15+02:00 3 - Find what is listening on which port Service detection