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

Try to get NVT preferences by id in create_config (9.0) #821

Merged
merged 10 commits into from
Oct 24, 2019

Conversation

timopollmeier
Copy link
Member

@timopollmeier timopollmeier commented Oct 18, 2019

When importing a config try to get the preferences by their id from the
nvt_preferences table in case their name has changed since the config
was exported.

Checklist:

When importing a config try to get the preferences by their id from the
nvt_preferences table in case their name has changed since the config
was exported.
The log message about getting the preference by name is only generated
when no id is given because it would be redundant for a id change.
@timopollmeier timopollmeier marked this pull request as ready for review October 18, 2019 13:26
Copy link
Contributor

@mattmundell mattmundell left a comment

Choose a reason for hiding this comment

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

I've reviewed the code but I'm not sure we should be allowing preferences to be specified by name. I will look more at the plan for preferences to try understand.

Also I wonder about creating multiple preference_t's during the import. It seems a bit convoluted. Wouldn't it be better to create the preference_t once with the right id/name in create_config_run?

src/manage_configs.h Show resolved Hide resolved
src/manage_sql_configs.c Outdated Show resolved Hide resolved
src/manage_sql_configs.c Outdated Show resolved Hide resolved
src/manage_sql_configs.c Outdated Show resolved Hide resolved
These functions are not just used by the GMP layer, so they are moved to
a new source file, gmp_configs.c.
The preferences are now fetched when processing the XML to avoid
building prefrerence_t structs twice.
The name is now only used to log changes if it is different from the one
in nvt_preferences.
If a type is given, a warning is logged if it is different from the one
in nvt_preferences.
@timopollmeier
Copy link
Member Author

I've updated the PR to remove the selection by preference name, simplify the selection from the
nvt_preferences table and to add a check if the type of a preference has changed.

Copy link
Contributor

@mattmundell mattmundell left a comment

Choose a reason for hiding this comment

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

That feels much better.

src/manage_sql_configs.c Outdated Show resolved Hide resolved
The NULL value first assigned to alts was unused.
@mattmundell mattmundell merged commit a28c66d into greenbone:gvmd-9.0 Oct 24, 2019
@timopollmeier timopollmeier deleted the fix-create_config-9.0 branch June 9, 2020 06:53
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