-
Notifications
You must be signed in to change notification settings - Fork 158
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
Try to get NVT preferences by id in create_config (9.0) #821
Conversation
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.
There was a problem hiding this 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?
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.
I've updated the PR to remove the selection by preference name, simplify the selection from the |
There was a problem hiding this 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.
The NULL value first assigned to alts was unused.
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: