Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix notes XML for lean reports (9.0) #836

Merged
merged 2 commits into from
Oct 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix preference ID in "Host Discovery" config [#828](https://github.com/greenbone/gvmd/pull/828)
- Fix order of fingerprints in get_tls_certificates [#833](https://github.com/greenbone/gvmd/pull/833)
- Update config preferences after updating NVTs [#832](https://github.com/greenbone/gvmd/pull/832)
- Fix notes XML for lean reports [#836](https://github.com/greenbone/gvmd/pull/836)

### Removed

Expand Down
17 changes: 12 additions & 5 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -9928,6 +9928,8 @@ buffer_result_notes_xml (GString *buffer, result_t result, task_t task,
{
get_data_t get;
iterator_t notes;
GString *temp_buffer;

memset (&get, '\0', sizeof (get));
/* Most recent first. */
get.filter = "sort-reverse=created owner=any permission=any";
Expand All @@ -9941,15 +9943,20 @@ buffer_result_notes_xml (GString *buffer, result_t result, task_t task,
result,
task);

if (lean == 0 || next (&notes))
g_string_append (buffer, "<notes>");
buffer_notes_xml (buffer,
temp_buffer = g_string_new ("");
buffer_notes_xml (temp_buffer,
&notes,
include_notes_details,
0,
NULL);
if (lean == 0 || next (&notes))
g_string_append (buffer, "</notes>");

if (lean == 0 || strlen (temp_buffer->str))
{
g_string_append (buffer, "<notes>");
g_string_append (buffer, temp_buffer->str);
g_string_append (buffer, "</notes>");
}
g_string_free (temp_buffer, TRUE);

cleanup_iterator (&notes);
}
Expand Down