Skip to content

Commit

Permalink
Merge pull request #2275 from greenbone/redundant-id-attrs
Browse files Browse the repository at this point in the history
Remove redundant note and override ID fields
  • Loading branch information
a-h-abdelsalam authored Sep 4, 2024
2 parents 27240c9 + 8d01d17 commit 648c4d1
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,6 @@ get_info_data_reset (get_info_data_t *data)
typedef struct
{
get_data_t get; ///< Get args.
char *note_id; ///< ID of single note to get.
char *nvt_oid; ///< OID of NVT to which to limit listing.
char *task_id; ///< ID of task to which to limit listing.
int result; ///< Boolean. Whether to include associated results.
Expand All @@ -1807,7 +1806,6 @@ typedef struct
static void
get_notes_data_reset (get_notes_data_t *data)
{
free (data->note_id);
free (data->nvt_oid);
free (data->task_id);

Expand Down Expand Up @@ -1876,7 +1874,6 @@ get_nvt_families_data_reset (get_nvt_families_data_t *data)
typedef struct
{
get_data_t get; ///< Get args.
char *override_id; ///< ID of override to get.
char *nvt_oid; ///< OID of NVT to which to limit listing.
char *task_id; ///< ID of task to which to limit listing.
int result; ///< Boolean. Whether to include associated results.
Expand All @@ -1890,7 +1887,6 @@ typedef struct
static void
get_overrides_data_reset (get_overrides_data_t *data)
{
free (data->override_id);
free (data->nvt_oid);
free (data->task_id);

Expand Down Expand Up @@ -5332,7 +5328,7 @@ gmp_xml_handle_start_element (/* unused */ GMarkupParseContext* context,
attribute_names,
attribute_values);
set_client_state (CLIENT_GET_LICENSE);
}
}
else if (strcasecmp ("GET_NOTES", element_name) == 0)
{
const gchar* attribute;
Expand All @@ -5341,9 +5337,6 @@ gmp_xml_handle_start_element (/* unused */ GMarkupParseContext* context,
attribute_names,
attribute_values);

append_attribute (attribute_names, attribute_values, "note_id",
&get_notes_data->note_id);

append_attribute (attribute_names, attribute_values, "nvt_oid",
&get_notes_data->nvt_oid);

Expand Down Expand Up @@ -5434,9 +5427,6 @@ gmp_xml_handle_start_element (/* unused */ GMarkupParseContext* context,
attribute_names,
attribute_values);

append_attribute (attribute_names, attribute_values, "override_id",
&get_overrides_data->override_id);

append_attribute (attribute_names, attribute_values, "nvt_oid",
&get_overrides_data->nvt_oid);

Expand Down Expand Up @@ -13648,12 +13638,12 @@ handle_get_notes (gmp_parser_t *gmp_parser, GError **error)
nvt_t nvt = 0;
task_t task = 0;

if (get_notes_data->note_id && get_notes_data->nvt_oid)
if (get_notes_data->get.id && get_notes_data->nvt_oid)
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("get_notes",
"Only one of NVT and the note_id attribute"
" may be given"));
else if (get_notes_data->note_id && get_notes_data->task_id)
else if (get_notes_data->get.id && get_notes_data->task_id)
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("get_notes",
"Only one of the note_id and task_id"
Expand Down Expand Up @@ -14053,12 +14043,12 @@ handle_get_overrides (gmp_parser_t *gmp_parser, GError **error)
nvt_t nvt = 0;
task_t task = 0;

if (get_overrides_data->override_id && get_overrides_data->nvt_oid)
if (get_overrides_data->get.id && get_overrides_data->nvt_oid)
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("get_overrides",
"Only one of NVT and the override_id attribute"
" may be given"));
else if (get_overrides_data->override_id
else if (get_overrides_data->get.id
&& get_overrides_data->task_id)
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("get_overrides",
Expand Down

0 comments on commit 648c4d1

Please sign in to comment.