Greenbone Vulnerability Manager
22.4.0~dev1
|
GVM management layer: PostgreSQL specific facilities. More...
#include <strings.h>
#include <assert.h>
#include "sql.h"
#include "manage_sql.h"
#include "manage_utils.h"
#include "manage_acl.h"
Macros | |
#define | G_LOG_DOMAIN "md manage" |
GLib log domain. | |
#define | OVERRIDES_SQL(severity_sql) |
Common overrides SQL for SQL functions. More... | |
Functions | |
int | check_db_extensions () |
Ensure all extensions are installed. More... | |
void | manage_session_init (const char *uuid) |
Setup session. More... | |
void | manage_session_set_timezone (const char *zone) |
Setup session timezone. More... | |
int | manage_db_empty () |
Check whether database is empty. More... | |
int | manage_cert_db_exists () |
Check if CERT db exists. More... | |
int | manage_scap_db_exists () |
Check if SCAP db exists. More... | |
void | sql_rename_column (const char *old_table, const char *new_table, const char *old_name, const char *new_name) |
Move data from a table to a new table, heeding column rename. More... | |
int | manage_create_sql_functions () |
Create functions. More... | |
void | manage_create_result_indexes () |
Create result indexes. | |
void | create_view_vulns () |
Create or replace the vulns view. | |
void | create_tables () |
Create all tables. | |
void | check_db_sequences () |
Ensure sequences for automatic ids are in a consistent state. More... | |
static gboolean | db_extension_available (const char *name) |
Check if an extension is available and can be installed. More... | |
void | manage_attach_databases () |
Attach external databases. | |
void | manage_db_remove (const gchar *name) |
Attach external databases. More... | |
int | manage_db_init (const gchar *name) |
Init external database. More... | |
int | manage_db_add_constraints (const gchar *name) |
Init external database. More... | |
int | manage_db_init_indexes (const gchar *name) |
Init external database. More... | |
int | manage_cert_loaded () |
Check whether CERT is available. More... | |
int | manage_scap_loaded () |
Check whether SCAP is available. More... | |
GVM management layer: PostgreSQL specific facilities.
This file contains the parts of the GVM management layer that need to be coded for each backend. This is the PostgreSQL version.
#define OVERRIDES_SQL | ( | severity_sql | ) |
Common overrides SQL for SQL functions.
int check_db_extensions | ( | ) |
Ensure all extensions are installed.
void check_db_sequences | ( | ) |
Ensure sequences for automatic ids are in a consistent state.
Caller must organise a transaction.
|
static |
Check if an extension is available and can be installed.
[in] | name | Name of the extension to check. |
int manage_cert_db_exists | ( | ) |
Check if CERT db exists.
int manage_cert_loaded | ( | ) |
Check whether CERT is available.
int manage_create_sql_functions | ( | ) |
Create functions.
int manage_db_add_constraints | ( | const gchar * | name | ) |
Init external database.
[in] | name | Name. Currently only "scap". |
int manage_db_empty | ( | ) |
Check whether database is empty.
int manage_db_init | ( | const gchar * | name | ) |
Init external database.
[in] | name | Name. "cert" or "scap". |
int manage_db_init_indexes | ( | const gchar * | name | ) |
Init external database.
[in] | name | Name. Currently only "scap". |
void manage_db_remove | ( | const gchar * | name | ) |
Attach external databases.
[in] | name | Database name. |
int manage_scap_db_exists | ( | ) |
Check if SCAP db exists.
int manage_scap_loaded | ( | ) |
Check whether SCAP is available.
void manage_session_init | ( | const char * | uuid | ) |
Setup session.
[in] | uuid | User UUID. |
void manage_session_set_timezone | ( | const char * | zone | ) |
Setup session timezone.
[in] | zone | Timezone. |
void sql_rename_column | ( | const char * | old_table, |
const char * | new_table, | ||
const char * | old_name, | ||
const char * | new_name | ||
) |
Move data from a table to a new table, heeding column rename.
[in] | old_table | Existing table. |
[in] | new_table | New empty table with renamed column. |
[in] | old_name | Name of column in old table. |
[in] | new_name | Name of column in new table. |