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

Resolve tags: solution and solution_type #681

Merged
merged 8 commits into from
Aug 11, 2019

Conversation

janowagner
Copy link
Member

@janowagner janowagner commented Aug 10, 2019

Internally stores solution explicitely in the nvts table like solution_type already was.

Remove solution and solution_type from the tag element of the nvts table by
actually not adding them anymore.

However, stay compatible with the API which means to append solution
and solution_type to the tag when creating a XML for the VT (get_nvts, get_results,
get_info).

In summary this is a plain internal change with no API change.
However, the API change for VT XML is prepared with one more step.

greenbone/gvm-libs#255 is required for this change.

Checklist:

This prepares to have both not anymore in the pipe-separated tag list.
However, this patch makes the solution appear twice in the nvts table
for the time being. Just like solution_type already.

This patch expects that there is a additional column in the nvt
table "solution." A migrator is forthcoming, for testing this can
be done:
ALTER TABLE IF EXISTS nvts ADD COLUMN solution text;
This allows to access solution and solution_type when
iterating over results.
This also serves get_info for type NVT.
The explicit elements "solution" and "solution_type" are appended
to the pipe-separated tag element of the nvt.
This is a temporary solution until the XML structure of a NVT
has explicit solution and solution_type elements. Once
that is established, we don't need to append them to the tags anymore.
This appends the explicit stored solution and solutions_type
to the pipe-separated tag element. Once the solution and
solution_type are explicit elements of the XML definition,
this can be dropped.
Since solution and solution_type are now appended
to the tag string for API compaitibility where the respective XML
is created, we do not need to store them into the tag in the database
anymmore!
@janowagner janowagner marked this pull request as ready for review August 11, 2019 12:52
@@ -15561,6 +15561,8 @@ update_nvti_cache ()
nvti_set_family (nvti, iterator_string (&nvts, 2));
nvti_set_cvss_base (nvti, iterator_string (&nvts, 3));
nvti_set_tag (nvti, iterator_string (&nvts, 4));
nvti_set_solution (nvti, iterator_string (&nvts, 5));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really related ;)

if (result_iterator_nvt_solution_type (results))
{
if (tags->str)
g_string_append_printf (tags, "|solution_type=%s", result_iterator_nvt_solution_type (results));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are getting long. Timo and I still pretty much always stick to the old 80 characters rule.

@mattmundell mattmundell merged commit 79e39dd into greenbone:master Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants