|
Greenbone Vulnerability Manager
9.0.1
|
GVM management layer: Config SQL. More...
#include "manage_configs.h"#include "manage_acl.h"#include "manage_sql.h"#include "manage_sql_configs.h"#include "manage_sql_nvts.h"#include "sql.h"#include <assert.h>#include <stdlib.h>#include <string.h>#include <gvm/util/uuidutils.h>Macros | |
| #define | G_LOG_DOMAIN "md manage" |
| GLib log domain. | |
Functions | |
| static int | switch_representation (config_t config, int constraining) |
| Switch between constraining and generating representation. More... | |
| static void | nvt_selector_add (const char *quoted_selector, const char *quoted_family_or_nvt, const char *quoted_family, int exclude) |
| Add a selector to an NVT selector. More... | |
| static void | nvt_selector_remove_selector (const char *quoted_selector, const char *family_or_nvt, int type) |
| Remove all selectors of a certain type from an NVT selector. More... | |
| static void | update_config_caches (config_t config) |
| Update the cached count and growing information in every config. More... | |
| static int | nvt_selector_families_growing (const char *selector) |
| Get the family growth status of an NVT selector. More... | |
| static int | nvt_selector_nvts_growing_2 (const char *quoted_selector, int families_growing) |
| Get the NVT growth status of an NVT selector. More... | |
| static int | insert_nvt_selectors (const char *quoted_name, const array_t *selectors) |
| Insert NVT selectors. More... | |
| static int | member (GPtrArray *array, const char *string) |
| Test whether a string equal to a given string exists in an array. More... | |
| int | nvt_selector_family_count (const char *quoted_selector, int families_growing) |
| Get the number of families selected by an NVT selector. More... | |
| int | config_nvts_growing (config_t config) |
| Get the NVT growth status of a config. More... | |
| int | config_families_growing (config_t config) |
| Get the family growth status of a config. More... | |
| void | init_nvt_selector_iterator (iterator_t *iterator, const char *selector, config_t config, int type) |
| Initialise an NVT selector iterator. More... | |
| int | nvt_selector_iterator_include (iterator_t *iterator) |
| Get whether the selector rule is an include rule. More... | |
| int | nvt_selector_iterator_type (iterator_t *iterator) |
| Get the type from an NVT selector. More... | |
| void | init_family_iterator (iterator_t *iterator, int all, const char *selector, int ascending) |
| Initialise an NVT selector family iterator. More... | |
| int | nvt_selector_family_growing (const char *selector, const char *family, int all) |
| Get whether an NVT selector family is growing. More... | |
| int | nvt_selector_nvt_count (const char *selector, const char *family, int growing) |
| Get the number of NVTs selected by an NVT selector. More... | |
| static void | nvt_selector_remove (const char *quoted_selector, const char *quoted_family, int type) |
| Remove all selectors of a certain family from an NVT selector. More... | |
| static void | nvt_selector_set_family (const char *quoted_selector, const char *family_or_nvt, int type, const char *family) |
| Set the family of an NVT selector. More... | |
| static int | family_is_selected (const char *quoted_selector, const char *quoted_family) |
| Check whether a family is selected. More... | |
| static int | nvt_selector_has (const char *quoted_selector, const char *family_or_nvt, int type, int exclude) |
| Check whether an NVT selector has a particular selector. More... | |
| int | manage_set_config_families (const gchar *config_id, GPtrArray *growing_all_families, GPtrArray *static_all_families, GPtrArray *growing_families, int grow_families) |
| Refresh NVT selection of a config from given families. More... | |
| static int | config_update_nvt_family (resource_t config, const char *oid, const char *old_family, const char *new_family) |
| Change the family of an NVT in a config. More... | |
| static int | update_nvt_family (const char *oid, const char *old_family, const char *new_family) |
| Change the family of an NVT in all configs. More... | |
| int | check_config_families () |
| Ensure that all configs refer to the right NVT families. More... | |
| void | manage_nvt_preference_add (const char *name, const char *value) |
| Add/replace an NVT preference. More... | |
| void | manage_nvt_preferences_enable () |
| Enable the NVT preferences. | |
| void | init_nvt_preference_iterator (iterator_t *iterator, const char *oid) |
| Initialise an NVT preference iterator. More... | |
| char * | nvt_preference_iterator_real_name (iterator_t *iterator) |
| Get the real name from an NVT preference iterator. More... | |
| char * | nvt_preference_iterator_type (iterator_t *iterator) |
| Get the type from an NVT preference iterator. More... | |
| char * | nvt_preference_iterator_oid (iterator_t *iterator) |
| Get the NVT from an NVT preference iterator. More... | |
| char * | nvt_preference_iterator_id (iterator_t *iterator) |
| Get the ID from an NVT preference iterator. More... | |
| char * | nvt_preference_iterator_config_value (iterator_t *iterator, config_t config) |
| Get the config value from an NVT preference iterator. More... | |
| int | nvt_preference_count (const char *oid) |
| Get the number preferences available for an NVT. More... | |
| char * | task_preference_value (task_t task, const char *name) |
| Get the value of a task preference. More... | |
| int | set_task_preferences (task_t task, array_t *preferences) |
| Set the preferences of a task. More... | |
| gboolean | find_config_with_permission (const char *uuid, config_t *config, const char *permission) |
| Find a config for a set of permissions, given a UUID. More... | |
| preference_t * | get_nvt_preference_by_id (const char *nvt_oid, const char *find_id, const char *check_name, const char *check_type, const char *value) |
| Gets an NVT preference by id or by name. More... | |
| static int | config_insert_preferences (config_t config, const array_t *preferences, const char *config_type) |
| Insert preferences into a config. More... | |
| int | create_config (const char *proposed_name, const char *comment, const array_t *selectors, const array_t *preferences, const char *config_type, const char *usage_type, config_t *config, char **name) |
| Create a config. More... | |
| static GSList * | get_scanner_params (scanner_t scanner) |
| Get list of OSP Scanner parameters. More... | |
| static int | insert_osp_parameter (osp_param_t *param, config_t config) |
| Insert an OSP parameter into a config if not already present. More... | |
| gchar * | configs_extra_where (const char *usage_type) |
| Generate an extra WHERE clause for selecting configs. More... | |
| int | create_config_from_scanner (const char *scanner_id, const char *name, const char *comment, const char *usage_type, char **uuid) |
| Create a config from an OSP scanner. More... | |
| char * | config_uuid (config_t config) |
| Return the UUID of a config. More... | |
| int | config_type (config_t config) |
| Return the type of a config. More... | |
| static scanner_t | config_scanner (config_t config) |
| Return the scanner associated with a config, if any. More... | |
| char * | config_nvt_timeout (config_t config, const char *oid) |
| Get the timeout value for an NVT in a config. More... | |
| int | create_task_check_config_scanner (config_t config, scanner_t scanner) |
| Check scanner and config values match for a task. More... | |
| int | modify_task_check_config_scanner (task_t task, const char *config_id, const char *scanner_id) |
| Check scanner and config values match for a task. More... | |
| int | copy_config (const char *name, const char *comment, const char *config_id, const char *usage_type, config_t *new_config) |
| Create a config from an existing config. More... | |
| int | delete_config (const char *config_id, int ultimate) |
| Delete a config. More... | |
| static void | update_config_params (config_t config, const char *config_id, GSList *params) |
| Update a config with a list of parameters. More... | |
| int | sync_config (const char *config_id) |
| Synchronize a config. More... | |
| int | config_count (const get_data_t *get) |
| Count the number of scan configs. More... | |
| void | init_user_config_iterator (iterator_t *iterator, config_t config, int trash, int ascending, const char *sort_field) |
| Initialise a config iterator, limited to user's configs. More... | |
| int | init_config_iterator (iterator_t *iterator, const get_data_t *get) |
| Initialise a scan config iterator. More... | |
| int | config_iterator_family_count (iterator_t *iterator) |
| Get the family count from a config iterator. More... | |
| int | config_iterator_nvt_count (iterator_t *iterator) |
| Get the nvt count from a config iterator. More... | |
| int | config_iterator_families_growing (iterator_t *iterator) |
| Get the families growing state from a config iterator. More... | |
| int | config_iterator_nvts_growing (iterator_t *iterator) |
| Get the NVTs growing state from a config iterator. More... | |
| int | config_iterator_type (iterator_t *iterator) |
| Get the type from a config iterator. More... | |
| scanner_t | config_iterator_scanner (iterator_t *iterator) |
| Get the scanner from a config iterator. More... | |
| int | config_iterator_scanner_trash (iterator_t *iterator) |
| Get whether scanner is in trash from a config iterator. More... | |
| int | config_in_use (config_t config) |
| Return whether a config is referenced by a task. More... | |
| int | config_writable (config_t config) |
| Return whether a config can be modified. More... | |
| int | trash_config_in_use (config_t config) |
| Return whether a trashcan config is referenced by a task. More... | |
| int | trash_config_writable (config_t config) |
| Return whether a trashcan config is writable. More... | |
| int | trash_config_readable_uuid (const gchar *config_id) |
| Return whether a trashcan config is readable. More... | |
| void | init_config_preference_iterator (iterator_t *iterator, config_t config) |
| Initialise a preference iterator. More... | |
| void | init_preference_iterator (iterator_t *iterator, config_t config, const char *section) |
| Initialise a config preference iterator, with defaults. More... | |
| char * | config_nvt_selector (config_t config) |
| Return the NVT selector associated with a config. More... | |
| int | manage_set_config_preference (const gchar *config_id, const char *nvt, const char *name, const char *value_64) |
| Set a preference of a config. More... | |
| int | manage_set_config (const gchar *config_id, const char *name, const char *comment, const char *scanner_id) |
| Set the name, comment and scanner of a config. More... | |
| int | manage_set_config_nvts (const gchar *config_id, const char *family, GPtrArray *selected_nvts) |
| Set the NVT's selected for a single family of a config. More... | |
| void | init_config_task_iterator (iterator_t *iterator, config_t config, int ascending) |
| Initialise a config task iterator. More... | |
| int | config_task_iterator_readable (iterator_t *iterator) |
| Get the read permission status from a GET iterator. More... | |
| void | init_config_timeout_iterator (iterator_t *iterator, config_t config) |
| Initialise a config timeout iterator. More... | |
| void | update_config_preference (const char *config_id, const char *type, const char *preference_name, const char *new_value, gboolean insert) |
| Update or optionally insert a NVT preference. More... | |
| static void | update_config_cache (iterator_t *configs) |
| Update the cached count and growing information in a config. More... | |
| void | update_all_config_caches () |
| Update count and growing info in every config across all users. More... | |
| void | update_config_cache_init (const char *uuid) |
| Update count and growing info in config, without checking user. More... | |
GVM management layer: Config SQL.
The Config SQL for the GVM management layer.
| int check_config_families | ( | ) |
Ensure that all configs refer to the right NVT families.
When the family of an NVT is changed in the feed, then the config refers to the wrong family.
| int config_count | ( | const get_data_t * | get | ) |
Count the number of scan configs.
| [in] | get | GET params. |
| int config_families_growing | ( | config_t | config | ) |
Get the family growth status of a config.
| [in] | config | Config. |
| int config_in_use | ( | config_t | config | ) |
Return whether a config is referenced by a task.
The predefined configs are always in use.
| [in] | config | Config. |
|
static |
Insert preferences into a config.
| [in] | config | Config. |
| [in] | preferences | Preferences. |
| [in] | config_type | Config type. |
| int config_iterator_families_growing | ( | iterator_t * | iterator | ) |
Get the families growing state from a config iterator.
| [in] | iterator | Iterator. |
| int config_iterator_family_count | ( | iterator_t * | iterator | ) |
Get the family count from a config iterator.
| [in] | iterator | Iterator. |
| int config_iterator_nvt_count | ( | iterator_t * | iterator | ) |
Get the nvt count from a config iterator.
| [in] | iterator | Iterator. |
| int config_iterator_nvts_growing | ( | iterator_t * | iterator | ) |
Get the NVTs growing state from a config iterator.
| [in] | iterator | Iterator. |
| scanner_t config_iterator_scanner | ( | iterator_t * | iterator | ) |
Get the scanner from a config iterator.
| [in] | iterator | Iterator. |
| int config_iterator_scanner_trash | ( | iterator_t * | iterator | ) |
Get whether scanner is in trash from a config iterator.
| [in] | iterator | Iterator. |
| int config_iterator_type | ( | iterator_t * | iterator | ) |
Get the type from a config iterator.
| [in] | iterator | Iterator. |
| char* config_nvt_selector | ( | config_t | config | ) |
Return the NVT selector associated with a config.
| [in] | config | Config. |
| char* config_nvt_timeout | ( | config_t | config, |
| const char * | oid | ||
| ) |
Get the timeout value for an NVT in a config.
| [in] | config | Config. |
| [in] | oid | ID of NVT. |
| int config_nvts_growing | ( | config_t | config | ) |
Get the NVT growth status of a config.
| [in] | config | Config. |
|
static |
Return the scanner associated with a config, if any.
| [in] | config | Config. |
| int config_task_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a GET iterator.
| [in] | iterator | Iterator. |
| int config_type | ( | config_t | config | ) |
Return the type of a config.
| [in] | config | Config. |
|
static |
Change the family of an NVT in a config.
| [in] | config | Config. |
| [in] | oid | NVT OID. |
| [in] | old_family | Name of old family. |
| [in] | new_family | Name of new family. |
| char* config_uuid | ( | config_t | config | ) |
Return the UUID of a config.
| [in] | config | Config. |
| int config_writable | ( | config_t | config | ) |
Return whether a config can be modified.
| [in] | config | Config. |
| gchar* configs_extra_where | ( | const char * | usage_type | ) |
Generate an extra WHERE clause for selecting configs.
| [in] | usage_type | The usage type to limit the selection to. |
| int copy_config | ( | const char * | name, |
| const char * | comment, | ||
| const char * | config_id, | ||
| const char * | usage_type, | ||
| config_t * | new_config | ||
| ) |
Create a config from an existing config.
| [in] | name | Name of new config and NVT selector. |
| [in] | comment | Comment on new config. |
| [in] | config_id | UUID of existing config. |
| [in] | usage_type | Optional new usage type for the new config. |
| [out] | new_config | New config. |
| int create_config | ( | const char * | proposed_name, |
| const char * | comment, | ||
| const array_t * | selectors, | ||
| const array_t * | preferences, | ||
| const char * | config_type, | ||
| const char * | usage_type, | ||
| config_t * | config, | ||
| char ** | name | ||
| ) |
Create a config.
If a config with the same name exists already then add a unique integer suffix onto the name.
| [in] | proposed_name | Proposed name of config. |
| [in] | comment | Comment on config. |
| [in] | selectors | NVT selectors. |
| [in] | preferences | Preferences. |
| [in] | config_type | Config type. |
| [in] | usage_type | The usage type ("scan" or "policy") |
| [out] | config | On success the config. |
| [out] | name | On success the name of the config. |
| int create_config_from_scanner | ( | const char * | scanner_id, |
| const char * | name, | ||
| const char * | comment, | ||
| const char * | usage_type, | ||
| char ** | uuid | ||
| ) |
Create a config from an OSP scanner.
| [in] | scanner_id | UUID of scanner to create config from. |
| [in] | name | Name for config. |
| [in] | comment | Comment for config. |
| [in] | usage_type | The usage type ("scan" or "policy") |
| [out] | uuid | Config UUID, on success. |
| int create_task_check_config_scanner | ( | config_t | config, |
| scanner_t | scanner | ||
| ) |
Check scanner and config values match for a task.
| [in] | config | Scan Config. |
| [in] | scanner | Scanner. |
| int delete_config | ( | const char * | config_id, |
| int | ultimate | ||
| ) |
Delete a config.
| [in] | config_id | UUID of config. |
| [in] | ultimate | Whether to remove entirely, or to trashcan. |
|
static |
Check whether a family is selected.
Only works for "generating from empty" selection.
| [in] | quoted_selector | SQL-quoted selector name. |
| [in] | quoted_family | SQL-quoted family name (NULL for families). |
| gboolean find_config_with_permission | ( | const char * | uuid, |
| config_t * | config, | ||
| const char * | permission | ||
| ) |
Find a config for a set of permissions, given a UUID.
| [in] | uuid | UUID of config. |
| [out] | config | Config return, 0 if successfully failed to find config. |
| [in] | permission | Permission. |
| preference_t* get_nvt_preference_by_id | ( | const char * | nvt_oid, |
| const char * | find_id, | ||
| const char * | check_name, | ||
| const char * | check_type, | ||
| const char * | value | ||
| ) |
Gets an NVT preference by id or by name.
Note: This currently only gets the fields needed by create_config.
| [in] | nvt_oid | OID of the NVT the preference belongs to. |
| [in] | find_id | Preference id to find, or NULL. |
| [in] | check_name | Preference name to check. |
| [in] | check_type | Preference name to check. |
| [in] | value | Value to assign to the preference. |
|
static |
Get list of OSP Scanner parameters.
| [in] | scanner | Scanner. |
| int init_config_iterator | ( | iterator_t * | iterator, |
| const get_data_t * | get | ||
| ) |
Initialise a scan config iterator.
| [in] | iterator | Iterator. |
| [in] | get | GET data. |
| void init_config_preference_iterator | ( | iterator_t * | iterator, |
| config_t | config | ||
| ) |
Initialise a preference iterator.
Assume the caller has permission to access the config.
| [in] | iterator | Iterator. |
| [in] | config | Config. |
| void init_config_task_iterator | ( | iterator_t * | iterator, |
| config_t | config, | ||
| int | ascending | ||
| ) |
Initialise a config task iterator.
Iterate over all tasks that use the config.
| [in] | iterator | Iterator. |
| [in] | config | Config. |
| [in] | ascending | Whether to sort ascending or descending. |
| void init_config_timeout_iterator | ( | iterator_t * | iterator, |
| config_t | config | ||
| ) |
Initialise a config timeout iterator.
Iterate over all timeout preferences of NVTs that have timeouts.
| [in] | iterator | Iterator. |
| [in] | config | Config. |
| void init_family_iterator | ( | iterator_t * | iterator, |
| int | all, | ||
| const char * | selector, | ||
| int | ascending | ||
| ) |
Initialise an NVT selector family iterator.
| [in] | iterator | Iterator. |
| [in] | all | True if families are growing in the selector, else 0. Only considered with a selector. |
| [in] | selector | Name of NVT selector. NULL for all families. |
| [in] | ascending | Whether to sort ascending or descending. |
| void init_nvt_preference_iterator | ( | iterator_t * | iterator, |
| const char * | oid | ||
| ) |
Initialise an NVT preference iterator.
| [in] | iterator | Iterator. |
| [in] | oid | OID of NVT, NULL for all preferences. |
| void init_nvt_selector_iterator | ( | iterator_t * | iterator, |
| const char * | selector, | ||
| config_t | config, | ||
| int | type | ||
| ) |
Initialise an NVT selector iterator.
| [in] | iterator | Iterator. |
| [in] | selector | Name of single selector to iterate over, NULL for all. |
| [in] | config | Config to limit iteration to, 0 for all. |
| [in] | type | Type of selector. All if config is given. |
| void init_preference_iterator | ( | iterator_t * | iterator, |
| config_t | config, | ||
| const char * | section | ||
| ) |
Initialise a config preference iterator, with defaults.
Assume the caller has permission to access the config.
This version substitutes the NVT preference when the config preference is missing.
| [in] | iterator | Iterator. |
| [in] | config | Config containing preferences. |
| [in] | section | Preference section. |
| void init_user_config_iterator | ( | iterator_t * | iterator, |
| config_t | config, | ||
| int | trash, | ||
| int | ascending, | ||
| const char * | sort_field | ||
| ) |
Initialise a config iterator, limited to user's configs.
| [in] | iterator | Iterator. |
| [in] | config | Config. 0 for all. |
| [in] | trash | Whether to iterate over trashcan configs. |
| [in] | ascending | Whether to sort ascending or descending. |
| [in] | sort_field | Field to sort on, or NULL for "id". |
|
static |
Insert NVT selectors.
| [in] | quoted_name | Name of NVT selector. |
| [in] | selectors | NVT selectors. |
|
static |
Insert an OSP parameter into a config if not already present.
| [in] | param | OSP parameter to insert. |
| [in] | config | Config to insert parameter into. |
| void manage_nvt_preference_add | ( | const char * | name, |
| const char * | value | ||
| ) |
Add/replace an NVT preference.
| [in] | name | The name of the preference. |
| [in] | value | The value of the preference. |
| int manage_set_config | ( | const gchar * | config_id, |
| const char * | name, | ||
| const char * | comment, | ||
| const char * | scanner_id | ||
| ) |
Set the name, comment and scanner of a config.
| [in] | config_id | Config. |
| [in] | name | New name, not updated if NULL. |
| [in] | comment | New comment, not updated if NULL. |
| [in] | scanner_id | UUID of new scanner, not updated if NULL. |
| int manage_set_config_families | ( | const gchar * | config_id, |
| GPtrArray * | growing_all_families, | ||
| GPtrArray * | static_all_families, | ||
| GPtrArray * | growing_families, | ||
| int | grow_families | ||
| ) |
Refresh NVT selection of a config from given families.
| [in] | config_id | Config. |
| [in] | growing_all_families | Growing families with all selection. |
| [in] | static_all_families | Static families with all selection. |
| [in] | growing_families | The rest of the growing families. |
| [in] | grow_families | 1 if families should grow, else 0. |
| int manage_set_config_nvts | ( | const gchar * | config_id, |
| const char * | family, | ||
| GPtrArray * | selected_nvts | ||
| ) |
Set the NVT's selected for a single family of a config.
| [in] | config_id | Config. |
| [in] | family | Family name. |
| [in] | selected_nvts | NVT's. |
| int manage_set_config_preference | ( | const gchar * | config_id, |
| const char * | nvt, | ||
| const char * | name, | ||
| const char * | value_64 | ||
| ) |
Set a preference of a config.
| [in] | config_id | Config. |
| [in] | nvt | UUID of NVT. NULL for scanner preference. |
| [in] | name | Preference name, including NVT name and preference type. |
| [in] | value_64 | Preference value in base64. NULL for an NVT preference removes the preference from the config. |
|
static |
Test whether a string equal to a given string exists in an array.
| [in] | array | Array of gchar* pointers. |
| [in] | string | String. |
| int modify_task_check_config_scanner | ( | task_t | task, |
| const char * | config_id, | ||
| const char * | scanner_id | ||
| ) |
Check scanner and config values match for a task.
| [in] | task | Task. |
| [in] | config_id | ID of config. "0" to use task's config. |
| [in] | scanner_id | ID of scanner. |
| int nvt_preference_count | ( | const char * | oid | ) |
Get the number preferences available for an NVT.
| [in] | oid | OID of NVT. |
| char* nvt_preference_iterator_config_value | ( | iterator_t * | iterator, |
| config_t | config | ||
| ) |
Get the config value from an NVT preference iterator.
| [in] | iterator | Iterator. |
| [in] | config | Config. |
| char* nvt_preference_iterator_id | ( | iterator_t * | iterator | ) |
Get the ID from an NVT preference iterator.
| [in] | iterator | Iterator. |
| char* nvt_preference_iterator_oid | ( | iterator_t * | iterator | ) |
Get the NVT from an NVT preference iterator.
| [in] | iterator | Iterator. |
| char* nvt_preference_iterator_real_name | ( | iterator_t * | iterator | ) |
Get the real name from an NVT preference iterator.
| [in] | iterator | Iterator. |
| char* nvt_preference_iterator_type | ( | iterator_t * | iterator | ) |
Get the type from an NVT preference iterator.
| [in] | iterator | Iterator. |
|
static |
Add a selector to an NVT selector.
| [in] | quoted_selector | SQL-quoted selector name. |
| [in] | quoted_family_or_nvt | SQL-quoted family or NVT name. |
| [in] | quoted_family | SQL-quoted family name (NULL for families). |
| [in] | exclude | 1 exclude selector, 0 include selector. |
|
static |
Get the family growth status of an NVT selector.
| [in] | selector | NVT selector. |
| int nvt_selector_family_count | ( | const char * | quoted_selector, |
| int | families_growing | ||
| ) |
Get the number of families selected by an NVT selector.
A growing family which has all current NVT's excluded is still considered as selected by the NVT selector.
| [in] | quoted_selector | SQL-quoted selector name. |
| [in] | families_growing | 1 if families are growing, else 0. |
| int nvt_selector_family_growing | ( | const char * | selector, |
| const char * | family, | ||
| int | all | ||
| ) |
Get whether an NVT selector family is growing.
| [in] | selector | NVT selector. |
| [in] | family | Family name. |
| [in] | all | True if selector is an "all" selector, else 0. |
|
static |
Check whether an NVT selector has a particular selector.
| [in] | quoted_selector | SQL-quoted selector name. |
| [in] | family_or_nvt | SQL-quoted UUID of NVT, or family name. |
| [in] | type | Selector type. |
| [in] | exclude | 1 exclude, 0 include. |
| int nvt_selector_iterator_include | ( | iterator_t * | iterator | ) |
Get whether the selector rule is an include rule.
| [in] | iterator | Iterator. |
| int nvt_selector_iterator_type | ( | iterator_t * | iterator | ) |
Get the type from an NVT selector.
| [in] | iterator | Iterator. |
| int nvt_selector_nvt_count | ( | const char * | selector, |
| const char * | family, | ||
| int | growing | ||
| ) |
Get the number of NVTs selected by an NVT selector.
| [in] | selector | NVT selector. |
| [in] | family | Family name. NULL for all. |
| [in] | growing | True if the given family is growing, else 0. If |
| family | is NULL, true if the the families are growing, else 0. |
|
static |
Get the NVT growth status of an NVT selector.
| [in] | quoted_selector | SQL-quoted selector name. |
| [in] | families_growing | 1 if families are growing, else 0. |
|
static |
Remove all selectors of a certain family from an NVT selector.
| [in] | quoted_selector | SQL-quoted selector name. |
| [in] | quoted_family | SQL-quoted family name. |
| [in] | type | Selector type to remove. |
|
static |
Remove all selectors of a certain type from an NVT selector.
| [in] | quoted_selector | SQL-quoted selector name. |
| [in] | family_or_nvt | SQL-quoted family name or NVT UUID. |
| [in] | type | Selector type to remove. |
|
static |
Set the family of an NVT selector.
| [in] | quoted_selector | SQL-quoted selector name. |
| [in] | family_or_nvt | Family name or NVT OID of selector. |
| [in] | type | Selector type to remove. |
| [in] | family | New family. |
| int set_task_preferences | ( | task_t | task, |
| array_t * | preferences | ||
| ) |
Set the preferences of a task.
Only the given preferences are affected. A NULL value means to remove the preference (reverts to using scanner value).
| [in] | task | Task. |
| [in] | preferences | Preferences. |
|
static |
Switch between constraining and generating representation.
It's up to the caller to start and end a transaction.
| [in] | config | Config name. |
| [in] | constraining | 1 families currently growing, 0 families currently static. |
| int sync_config | ( | const char * | config_id | ) |
Synchronize a config.
| [in] | config_id | UUID of config. |
| char* task_preference_value | ( | task_t | task, |
| const char * | name | ||
| ) |
Get the value of a task preference.
| [in] | task | Task. |
| [in] | name | Preference name. |
| int trash_config_in_use | ( | config_t | config | ) |
Return whether a trashcan config is referenced by a task.
| [in] | config | Config. |
| int trash_config_readable_uuid | ( | const gchar * | config_id | ) |
Return whether a trashcan config is readable.
| [in] | config_id | Config UUID. |
| int trash_config_writable | ( | config_t | config | ) |
Return whether a trashcan config is writable.
| [in] | config | Config. |
| void update_all_config_caches | ( | ) |
Update count and growing info in every config across all users.
It's up to the caller to organise a transaction.
|
static |
Update the cached count and growing information in a config.
It's up to the caller to organise a transaction.
| [in] | configs | Config to update. |
| void update_config_cache_init | ( | const char * | uuid | ) |
Update count and growing info in config, without checking user.
For use during initialisation.
| [in] | uuid | Config UUID. |
It's up to the caller to organise a transaction.
|
static |
Update the cached count and growing information in every config.
Only consider configs for the current user.
It's up to the caller to organise a transaction.
| [in] | config | Config to update. 0 for all. |
|
static |
Update a config with a list of parameters.
| [in] | config | Config ID. |
| [in] | config_id | Config UUID. |
| [in] | params | List of new config parameters. |
| void update_config_preference | ( | const char * | config_id, |
| const char * | type, | ||
| const char * | preference_name, | ||
| const char * | new_value, | ||
| gboolean | insert | ||
| ) |
Update or optionally insert a NVT preference.
| [in] | config_id | UUID of the config to set the preference in |
| [in] | type | Type of the preference, e.g. "PLUGINS_PREFS" |
| [in] | preference_name | Full name of the preference |
| [in] | new_value | The new value to set |
| [in] | insert | Whether to insert the preference if missing |
|
static |
Change the family of an NVT in all configs.
| [in] | oid | NVT OID. |
| [in] | old_family | Name of old family. |
| [in] | new_family | Name of new family. |