Greenbone Vulnerability Manager
22.4.0~dev1
|
GVM GMP layer: Configs. More...
#include "gmp_configs.h"
#include "gmp_base.h"
#include "gmp_get.h"
#include "manage_acl.h"
#include "manage_configs.h"
#include <assert.h>
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <gvm/util/xmlutils.h>
Data Structures | |
struct | create_config_t |
The create_config command. More... | |
struct | modify_config_t |
The modify_config command. More... | |
Macros | |
#define | G_LOG_DOMAIN "md gmp" |
GLib log domain. | |
Functions | |
static gpointer | nvt_selector_new (char *name, char *type, int include, char *family_or_nvt) |
Create a new NVT selector. More... | |
static void | create_config_reset () |
Reset command data. | |
void | create_config_start (gmp_parser_t *gmp_parser, const gchar **attribute_names, const gchar **attribute_values) |
Start a command. More... | |
void | create_config_element_start (gmp_parser_t *gmp_parser, const gchar *name, const gchar **attribute_names, const gchar **attribute_values) |
Start element. More... | |
static gchar * | text_or_null (entity_t entity) |
Get the text of entity. More... | |
static gchar * | attr_or_null (entity_t entity, const gchar *name) |
Get the attribute of entity. More... | |
int | parse_config_entity (entity_t config, const char **config_id, char **name, char **comment, char **usage_type, int *all_selector, array_t **import_nvt_selectors, array_t **import_preferences) |
Get creation data from a config entity. More... | |
void | create_config_run (gmp_parser_t *gmp_parser, GError **error) |
Execute command. More... | |
int | create_config_element_end (gmp_parser_t *gmp_parser, GError **error, const gchar *name) |
End element. More... | |
void | create_config_element_text (const gchar *text, gsize text_len) |
Add text to element. More... | |
static void | modify_config_reset () |
Reset command data. | |
void | modify_config_start (gmp_parser_t *gmp_parser, const gchar **attribute_names, const gchar **attribute_values) |
Start a command. More... | |
void | modify_config_element_start (gmp_parser_t *gmp_parser, const gchar *name, const gchar **attribute_names, const gchar **attribute_values) |
Start element. More... | |
static int | modify_config_handle_basic_fields (config_t config, const char *name, const char *comment, gmp_parser_t *gmp_parser, GError **error) |
Handle basic, single-value fields of modify_config. More... | |
static int | modify_config_collect_selection_families (entities_t entities, array_t **families_growing_all, array_t **families_growing_empty, array_t **families_static_all) |
Collect VT families from parsed modify_config XML into arrays. More... | |
static int | modify_config_handle_family_selection (config_t config, array_t *families_growing_all, array_t *families_growing_empty, array_t *families_static_all, int family_selection_growing, gmp_parser_t *gmp_parser, GError **error) |
Handles a family selection inside a modify_config command. More... | |
static int | modify_config_collect_selection_nvts (entities_t entities, array_t **nvt_oids) |
Collect a list of VT OIDs for a particular family in modify_config. More... | |
static int | modify_config_handle_nvt_selection (config_t config, const char *nvt_selection_family, GPtrArray *nvt_selection, gmp_parser_t *gmp_parser, GError **error) |
Changes the VT selection of a given family in modify_config. More... | |
static int | modify_config_handle_preference (config_t config, const char *nvt_oid, const char *name, const char *value, gmp_parser_t *gmp_parser, GError **error) |
Modifies a single preference inside a modify_config command. More... | |
static void | modify_config_run (gmp_parser_t *gmp_parser, GError **error) |
Execute command. More... | |
int | modify_config_element_end (gmp_parser_t *gmp_parser, GError **error, const gchar *name) |
End element. More... | |
void | modify_config_element_text (const gchar *text, gsize text_len) |
Add text to element. More... | |
Variables | |
static create_config_t | create_config_data |
Parser callback data. More... | |
static modify_config_t | modify_config_data |
Parser callback data. More... | |
GVM GMP layer: Configs.
GMP configs.
|
static |
Get the attribute of entity.
[in] | entity | Entity. Can be NULL. |
[in] | name | Name of attribute. |
int create_config_element_end | ( | gmp_parser_t * | gmp_parser, |
GError ** | error, | ||
const gchar * | name | ||
) |
End element.
[in] | gmp_parser | GMP parser. |
[in] | error | Error parameter. |
[in] | name | Element name. |
void create_config_element_start | ( | gmp_parser_t * | gmp_parser, |
const gchar * | name, | ||
const gchar ** | attribute_names, | ||
const gchar ** | attribute_values | ||
) |
Start element.
[in] | gmp_parser | GMP parser. |
[in] | name | Element name. |
[in] | attribute_names | All attribute names. |
[in] | attribute_values | All attribute values. |
void create_config_element_text | ( | const gchar * | text, |
gsize | text_len | ||
) |
Add text to element.
[in] | text | Text. |
[in] | text_len | Text length. |
void create_config_run | ( | gmp_parser_t * | gmp_parser, |
GError ** | error | ||
) |
Execute command.
[in] | gmp_parser | GMP parser. |
[in] | error | Error parameter. |
void create_config_start | ( | gmp_parser_t * | gmp_parser, |
const gchar ** | attribute_names, | ||
const gchar ** | attribute_values | ||
) |
Start a command.
[in] | gmp_parser | GMP parser. |
[in] | attribute_names | All attribute names. |
[in] | attribute_values | All attribute values. |
|
static |
Collect VT families from parsed modify_config XML into arrays.
Family name strings are to be freed with entity. VT families not collected are assumed to be static and empty.
[in] | entities | The entities struct with family elems as children. |
[out] | families_growing_all | Array of growing families with all VTs. |
[out] | families_growing_empty | Array of growing, empty families. |
[out] | families_static_all | Array of static families with all VTs. |
|
static |
Collect a list of VT OIDs for a particular family in modify_config.
[in] | entities | The entities containing nvt elements as children. |
[out] | nvt_oids | The list of VT OIDs to select. |
int modify_config_element_end | ( | gmp_parser_t * | gmp_parser, |
GError ** | error, | ||
const gchar * | name | ||
) |
End element.
[in] | gmp_parser | GMP parser. |
[in] | error | Error parameter. |
[in] | name | Element name. |
void modify_config_element_start | ( | gmp_parser_t * | gmp_parser, |
const gchar * | name, | ||
const gchar ** | attribute_names, | ||
const gchar ** | attribute_values | ||
) |
Start element.
[in] | gmp_parser | GMP parser. |
[in] | name | Element name. |
[in] | attribute_names | All attribute names. |
[in] | attribute_values | All attribute values. |
void modify_config_element_text | ( | const gchar * | text, |
gsize | text_len | ||
) |
Add text to element.
[in] | text | Text. |
[in] | text_len | Text length. |
|
static |
Handle basic, single-value fields of modify_config.
[in] | config | The config to modify. |
[in] | name | The name to set or NULL to keep old value. |
[in] | comment | The comment to set or NULL to keep old value. |
[in] | gmp_parser | GMP parser. |
[out] | error | GError output. |
|
static |
Handles a family selection inside a modify_config command.
[in] | config | The config to modify. |
[in] | families_growing_all | Array of growing families with all VTs. |
[in] | families_growing_empty | Array of growing, empty families. |
[in] | families_static_all | Array of static families with all VTs. |
[in] | family_selection_growing | 1 if families should grow, else 0. |
[in] | gmp_parser | The GMP parser. |
[out] | error | GError output. |
|
static |
Changes the VT selection of a given family in modify_config.
[in] | config | The config to modify. |
[in] | nvt_selection_family | The family to set the VT selection of. |
[in] | nvt_selection | Array of VT OIDs to select of the family. |
[in] | gmp_parser | The GMP parser. |
[out] | error | GError output. |
|
static |
Modifies a single preference inside a modify_config command.
[in] | config | The config to modify. |
[in] | nvt_oid | VT OID of the preference or NULL for scanner pref. |
[in] | name | Name of the preference to change. |
[in] | value | Value to set for the preference. |
[in] | gmp_parser | The GMP parser. |
[out] | error | GError output. |
|
static |
Execute command.
[in] | gmp_parser | GMP parser. |
[out] | error | Error parameter. |
void modify_config_start | ( | gmp_parser_t * | gmp_parser, |
const gchar ** | attribute_names, | ||
const gchar ** | attribute_values | ||
) |
Start a command.
[in] | gmp_parser | GMP parser. |
[in] | attribute_names | All attribute names. |
[in] | attribute_values | All attribute values. |
|
static |
Create a new NVT selector.
[in] | name | Name of NVT selector. |
[in] | type | Type of NVT selector. |
[in] | include | Include/exclude flag. |
[in] | family_or_nvt | Family or NVT. |
int parse_config_entity | ( | entity_t | config, |
const char ** | config_id, | ||
char ** | name, | ||
char ** | comment, | ||
char ** | usage_type, | ||
int * | all_selector, | ||
array_t ** | import_nvt_selectors, | ||
array_t ** | import_preferences | ||
) |
Get creation data from a config entity.
[in] | config | Config entity. |
[out] | config_id | Address for config ID, or NULL. |
[out] | name | Address for name. |
[out] | comment | Address for comment. |
[out] | usage_type | Address for usage type. |
[out] | all_selector | True if ALL_SELECTOR was present. |
[out] | import_nvt_selectors | Address for selectors. |
[out] | import_preferences | Address for preferences. |
|
static |
Get the text of entity.
[in] | entity | Entity. Can be NULL. |
|
static |
Parser callback data.
This is initially 0 because it's a global variable.
|
static |
Parser callback data.
This is initially 0 because it's a global variable.