Greenbone Vulnerability Manager
22.4.0~dev1
|
GVM manage layer: Configs. More...
#include "gmp_configs.h"
#include "manage_configs.h"
#include "manage_sql.h"
#include "manage_sql_configs.h"
#include "utils.h"
#include <errno.h>
#include <glib.h>
#include <gvm/util/fileutils.h>
#include <stdlib.h>
#include <string.h>
Macros | |
#define | G_LOG_DOMAIN "md manage" |
GLib log domain. | |
Functions | |
int | config_predefined_uuid (const gchar *config_id) |
Return whether a config is predefined. More... | |
static const gchar * | feed_dir_configs () |
Get path to configs in feed. More... | |
static void | create_feed_config_permissions (const gchar *config_id) |
Grant 'Feed Import Roles' access to a config. More... | |
static int | update_config_from_file (config_t config, const gchar *path) |
Create a config from an XML file. More... | |
static int | create_config_from_file (const gchar *path) |
Create a config from an XML file. More... | |
static int | should_sync_config_from_path (const char *path, gboolean rebuild, config_t *config) |
Gets if a config must be synced a file path in the feed. More... | |
static void | sync_config_with_feed (const gchar *path, gboolean rebuild) |
Sync a single config with the feed. More... | |
static int | try_open_configs_feed_dir (GDir **dir, gboolean set_current_user) |
Open the configs feed directory if it is available and the feed owner is set. Optionally set the current user to the feed owner on success. More... | |
int | sync_configs_with_feed (gboolean rebuild) |
Sync all configs with the feed. More... | |
gboolean | configs_feed_dir_exists () |
Tests if the configs feed directory exists. More... | |
void | manage_sync_configs () |
Sync configs with the feed. | |
int | manage_rebuild_configs () |
Rebuild configs from the feed. More... | |
gboolean | should_sync_configs () |
Checks if the configs should be synced with the feed. More... | |
GVM manage layer: Configs.
General functions for managing scan configs.
int config_predefined_uuid | ( | const gchar * | config_id | ) |
Return whether a config is predefined.
[in] | config_id | UUID of config. |
gboolean configs_feed_dir_exists | ( | ) |
Tests if the configs feed directory exists.
|
static |
Create a config from an XML file.
[in] | path | Path to config XML. |
|
static |
Grant 'Feed Import Roles' access to a config.
[in] | config_id | UUID of config. |
|
static |
Get path to configs in feed.
int manage_rebuild_configs | ( | ) |
Rebuild configs from the feed.
|
static |
Gets if a config must be synced a file path in the feed.
[in] | path | Path to config XML in feed. |
[in] | rebuild | Whether ignore timestamps to force a rebuild. |
[out] | config | Config row id if it already exists, 0 if config is new. |
gboolean should_sync_configs | ( | ) |
Checks if the configs should be synced with the feed.
|
static |
Sync a single config with the feed.
[in] | path | Path to config XML in feed. |
[in] | rebuild | Whether ignore timestamps to force a rebuild. |
int sync_configs_with_feed | ( | gboolean | rebuild | ) |
Sync all configs with the feed.
Create configs that exists in the feed but not in the db. Update configs in the db that have changed on the feed. Do nothing to configs in db that have been removed from the feed.
[in] | rebuild | Whether ignore timestamps to force a rebuild. |
|
static |
Open the configs feed directory if it is available and the feed owner is set. Optionally set the current user to the feed owner on success.
The sync will be skipped if the feed directory does not exist or the feed owner is not set. For configs the NVTs also have to exist.
[out] | dir | The directory as GDir if available and feed owner is set, NULL otherwise. |
[in] | set_current_user | Whether to set current user to feed owner. |
|
static |
Create a config from an XML file.
[in] | config | Existing config. |
[in] | path | Full path to config XML. |