Greenbone Vulnerability Manager  22.4.0~dev1
Data Structures | Macros | Functions | Variables
manage_sql_secinfo.c File Reference

GVM management layer: SecInfo. More...

#include "debug_utils.h"
#include "manage_sql.h"
#include "manage_sql_secinfo.h"
#include "sql.h"
#include "utils.h"
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <fnmatch.h>
#include <ftw.h>
#include <glib/gstdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <gvm/base/gvm_sentry.h>
#include <bsd/unistd.h>
#include <gvm/util/fileutils.h>

Data Structures

struct  inserts_t
 Buffer for INSERT statements. More...
 

Macros

#define _GNU_SOURCE
 Enable extra GNU functions.
 
#define G_LOG_DOMAIN   "md manage"
 GLib log domain.
 
#define CPE_MAX_CHUNK_SIZE   10000
 Maximum number of rows in an INSERT.
 

Functions

void manage_db_remove (const gchar *)
 Attach external databases. More...
 
int manage_db_init (const gchar *)
 Init external database. More...
 
int manage_db_init_indexes (const gchar *)
 Init external database. More...
 
int manage_db_add_constraints (const gchar *)
 Init external database. More...
 
static int sync_cert ()
 Sync the CERT DB. More...
 
static int update_scap (gboolean reset_scap_db)
 Update all data in the SCAP DB. More...
 
static gchar * sql_quote_element_text (element_t element)
 Get SQL quoted version of element's text. More...
 
static int parse_iso_time_element_text (element_t element)
 Get ISO time from element's text. More...
 
static gchar * string_replace (const gchar *string, const gchar *to,...)
 Replace text in a string. More...
 
static void increment_transaction_size (int *current_size)
 Increment transaction size, commit and reset at secinfo_commit_size. More...
 
static const gchar * split_xml_file (gchar *path, const gchar *size, const gchar *tail)
 Split a file. More...
 
static void inserts_init (inserts_t *inserts, int max_chunk_size, const gchar *open_sql, const gchar *close_sql)
 Check size of current statement. More...
 
static void inserts_statement_close (inserts_t *inserts)
 Close the current statement. More...
 
static int inserts_check_size (inserts_t *inserts)
 Check size of current statement. More...
 
static void inserts_free (inserts_t *inserts)
 Free everything. More...
 
static void inserts_run (inserts_t *inserts)
 Run the INSERT SQL, freeing the buffers. More...
 
static const column_tcpe_info_select_columns ()
 Gets the SELECT columns for CPE iterators and counts. More...
 
static const char ** cpe_info_filter_columns ()
 Gets the filter columns for CPE iterators and counts. More...
 
int cpe_info_count (const get_data_t *get)
 Count number of cpe. More...
 
int init_cpe_info_iterator (iterator_t *iterator, get_data_t *get, const char *name)
 Initialise a info iterator. More...
 
static const column_tcve_info_select_columns ()
 Gets the SELECT columns for CVE iterators and counts. More...
 
static const char ** cve_info_filter_columns ()
 Gets the filter columns for CVE iterators and counts. More...
 
void init_cpe_cve_iterator (iterator_t *iterator, const char *cve, int ascending, const char *sort_field)
 Initialise an CVE iterator, for CVEs reported for a certain CPE. More...
 
gchar * cve_cvss_base (const gchar *cve)
 Get the CVSS score for a CVE. More...
 
int cve_info_count (const get_data_t *get)
 Count number of cve. More...
 
int init_cve_info_iterator (iterator_t *iterator, get_data_t *get, const char *name)
 Initialise a info iterator. More...
 
static const column_tcert_bund_adv_info_select_columns ()
 Gets the SELECT columns for CERT-Bund advisory iterators and counts. More...
 
static const char ** cert_bund_adv_info_filter_columns ()
 Gets the filter columns for CERT-Bund advisory iterators and counts. More...
 
int init_cert_bund_adv_info_iterator (iterator_t *iterator, get_data_t *get, const char *name)
 Initialise an CERT-Bund advisory (cert_bund_adv) info iterator. More...
 
int cert_bund_adv_info_count (const get_data_t *get)
 Count number of cert_bund_adv. More...
 
void init_cve_cert_bund_adv_iterator (iterator_t *iterator, const char *cve, int ascending, const char *sort_field)
 Initialise CVE iterator, for CVEs referenced by a CERT-Bund advisory. More...
 
void init_nvt_cert_bund_adv_iterator (iterator_t *iterator, const char *oid)
 Initialise an CERT-Bund iterator, for advisories relevant to a NVT. More...
 
static const column_tdfn_cert_adv_info_select_columns ()
 Gets the SELECT columns for DFN-CERT advisory iterators and counts. More...
 
static const char ** dfn_cert_adv_info_filter_columns ()
 Gets the filter columns for DFN-CERT advisory iterators and counts. More...
 
int init_dfn_cert_adv_info_iterator (iterator_t *iterator, get_data_t *get, const char *name)
 Initialise an DFN-CERT advisory (dfn_cert_adv) info iterator. More...
 
int dfn_cert_adv_info_count (const get_data_t *get)
 Count number of dfn_cert_adv. More...
 
void init_cve_dfn_cert_adv_iterator (iterator_t *iterator, const char *cve, int ascending, const char *sort_field)
 Initialise CVE iterator, for CVEs referenced by a DFN-CERT advisory. More...
 
void init_nvt_dfn_cert_adv_iterator (iterator_t *iterator, const char *oid)
 Initialise an DFN-CERT iterator, for advisories relevant to a NVT. More...
 
int secinfo_count_after (const get_data_t *get, const char *type, time_t count_time, gboolean get_modified)
 Count number of SecInfo items created or modified after a given time. More...
 
static int update_dfn_xml (const gchar *xml_path, int last_cert_update, int last_dfn_update)
 Update DFN-CERT info from a single XML feed file. More...
 
static int update_dfn_cert_advisories (int last_cert_update)
 Update DFN-CERTs. More...
 
static int update_bund_xml (const gchar *xml_path, int last_cert_update, int last_bund_update)
 Update CERT-Bund info from a single XML feed file. More...
 
static int update_cert_bund_advisories (int last_cert_update)
 Update CERT-Bunds. More...
 
static int insert_scap_cpe (inserts_t *inserts, element_t cpe_item, element_t item_metadata, int modification_time)
 Insert a SCAP CPE. More...
 
static int update_scap_cpes_from_file (const gchar *path)
 Update SCAP CPEs from a file. More...
 
static int update_scap_cpes ()
 Update SCAP CPEs. More...
 
static int last_appearance (element_t product)
 Check if this is the last appearance of a product in its siblings. More...
 
static int hashed_cpes_cpe_id (GHashTable *hashed_cpes, const gchar *product_tilde)
 Get the ID of a CPE from a hashtable. More...
 
static void insert_cve_products (element_t list, resource_t cve, int time_modified, int time_published, GHashTable *hashed_cpes, int *transaction_size)
 Insert products for a CVE. More...
 
static int insert_cve_from_entry (element_t entry, element_t last_modified, GHashTable *hashed_cpes, int *transaction_size)
 Insert a CVE. More...
 
static int update_cve_xml (const gchar *xml_path, GHashTable *hashed_cpes)
 Update CVE info from a single XML feed file. More...
 
static int update_scap_cves ()
 Update SCAP CVEs. More...
 
static int manage_db_reinit (const gchar *name)
 Reinit a db. More...
 
static void sync_secinfo (sigset_t *sigmask_current, int(*update)(void), const gchar *process_title)
 Sync a SecInfo DB. More...
 
static int manage_feed_timestamp (const gchar *name)
 Get the feed timestamp. More...
 
int secinfo_feed_version_status (const char *feed_type)
 Gets the SCAP or CERT database version status. More...
 
int check_cert_db_version ()
 Ensure CERT db is at the right version, and in the right mode. More...
 
static int update_cert_timestamp ()
 Update timestamp in CERT db from feed timestamp. More...
 
static void update_cvss_dfn_cert (int updated_dfn_cert, int last_cert_update, int last_scap_update)
 Update DFN-CERT Max CVSS. More...
 
static void update_cvss_cert_bund (int updated_cert_bund, int last_cert_update, int last_scap_update)
 Update CERT-Bund Max CVSS. More...
 
void manage_sync_cert (sigset_t *sigmask_current)
 Sync the CERT DB. More...
 
int check_scap_db_version ()
 Ensure SCAP db is at the right version, and in the right mode. More...
 
static int update_scap_timestamp ()
 Update timestamp in SCAP db from feed timestamp. More...
 
static void update_scap_cvss ()
 Update SCAP Max CVSS.
 
static void update_scap_placeholders ()
 Update SCAP placeholder CVES.
 
static int update_scap_end ()
 Finish scap update. More...
 
static int try_load_csv ()
 Try load the feed from feed CSV files. More...
 
static int sync_scap ()
 Sync the SCAP DB. More...
 
void manage_sync_scap (sigset_t *sigmask_current)
 Sync the SCAP DB. More...
 
static int rebuild_scap ()
 Rebuild the entire SCAP DB. More...
 
int manage_rebuild_scap (GSList *log_config, const db_conn_info_t *database)
 Rebuild part of the SCAP DB. More...
 
void set_secinfo_commit_size (int new_commit_size)
 Set the SecInfo update commit size. More...
 

Variables

static int secinfo_commit_size = SECINFO_COMMIT_SIZE_DEFAULT
 Commit size for updates.
 

Detailed Description

GVM management layer: SecInfo.

The SecInfo parts of the GVM management layer.

Function Documentation

◆ cert_bund_adv_info_count()

int cert_bund_adv_info_count ( const get_data_t get)

Count number of cert_bund_adv.

Parameters
[in]getGET params.
Returns
Total number of CERT-Bund advisories in filtered set.

◆ cert_bund_adv_info_filter_columns()

static const char** cert_bund_adv_info_filter_columns ( )
static

Gets the filter columns for CERT-Bund advisory iterators and counts.

Returns
The filter columns.

◆ cert_bund_adv_info_select_columns()

static const column_t* cert_bund_adv_info_select_columns ( )
static

Gets the SELECT columns for CERT-Bund advisory iterators and counts.

Returns
The SELECT columns.

◆ check_cert_db_version()

int check_cert_db_version ( )

Ensure CERT db is at the right version, and in the right mode.

Returns
0 success, -1 error.

◆ check_scap_db_version()

int check_scap_db_version ( )

Ensure SCAP db is at the right version, and in the right mode.

Returns
0 success, -1 error.

◆ cpe_info_count()

int cpe_info_count ( const get_data_t get)

Count number of cpe.

Parameters
[in]getGET params.
Returns
Total number of cpes in filtered set.

◆ cpe_info_filter_columns()

static const char** cpe_info_filter_columns ( )
static

Gets the filter columns for CPE iterators and counts.

Returns
The filter columns.

◆ cpe_info_select_columns()

static const column_t* cpe_info_select_columns ( )
static

Gets the SELECT columns for CPE iterators and counts.

Returns
The SELECT columns.

◆ cve_cvss_base()

gchar* cve_cvss_base ( const gchar *  cve)

Get the CVSS score for a CVE.

Parameters
[in]cveCVE-ID of the CVE to get the score of.
Returns
The CVSS score of the CVE.

◆ cve_info_count()

int cve_info_count ( const get_data_t get)

Count number of cve.

Parameters
[in]getGET params.
Returns
Total number of cpes in filtered set.

◆ cve_info_filter_columns()

static const char** cve_info_filter_columns ( )
static

Gets the filter columns for CVE iterators and counts.

Returns
The filter columns.

◆ cve_info_select_columns()

static const column_t* cve_info_select_columns ( )
static

Gets the SELECT columns for CVE iterators and counts.

Returns
The SELECT columns.

◆ dfn_cert_adv_info_count()

int dfn_cert_adv_info_count ( const get_data_t get)

Count number of dfn_cert_adv.

Parameters
[in]getGET params.
Returns
Total number of DFN-CERT advisories in filtered set.

◆ dfn_cert_adv_info_filter_columns()

static const char** dfn_cert_adv_info_filter_columns ( )
static

Gets the filter columns for DFN-CERT advisory iterators and counts.

Returns
The filter columns.

◆ dfn_cert_adv_info_select_columns()

static const column_t* dfn_cert_adv_info_select_columns ( )
static

Gets the SELECT columns for DFN-CERT advisory iterators and counts.

Returns
The SELECT columns.

◆ hashed_cpes_cpe_id()

static int hashed_cpes_cpe_id ( GHashTable *  hashed_cpes,
const gchar *  product_tilde 
)
static

Get the ID of a CPE from a hashtable.

Parameters
[in]hashed_cpesCPEs.
[in]product_tildeUUID/Name.
Returns
ID of CPE from hashtable.

◆ increment_transaction_size()

static void increment_transaction_size ( int *  current_size)
inlinestatic

Increment transaction size, commit and reset at secinfo_commit_size.

Parameters
[in,out]current_sizePointer to current size to increment and compare.

◆ init_cert_bund_adv_info_iterator()

int init_cert_bund_adv_info_iterator ( iterator_t iterator,
get_data_t get,
const char *  name 
)

Initialise an CERT-Bund advisory (cert_bund_adv) info iterator.

Parameters
[in]iteratorIterator.
[in]getGET data.
[in]nameName of the info
Returns
0 success, 1 failed to find target, 2 failed to find filter, -1 error.

◆ init_cpe_cve_iterator()

void init_cpe_cve_iterator ( iterator_t iterator,
const char *  cve,
int  ascending,
const char *  sort_field 
)

Initialise an CVE iterator, for CVEs reported for a certain CPE.

Parameters
[in]iteratorIterator.
[in]cveCVE.
[in]ascendingWhether to sort ascending or descending.
[in]sort_fieldField to sort on, or NULL for "id".

◆ init_cpe_info_iterator()

int init_cpe_info_iterator ( iterator_t iterator,
get_data_t get,
const char *  name 
)

Initialise a info iterator.

Parameters
[in]iteratorIterator.
[in]getGET data.
[in]nameName of the info
Returns
0 success, 1 failed to find target, 2 failed to find filter, -1 error.

◆ init_cve_cert_bund_adv_iterator()

void init_cve_cert_bund_adv_iterator ( iterator_t iterator,
const char *  cve,
int  ascending,
const char *  sort_field 
)

Initialise CVE iterator, for CVEs referenced by a CERT-Bund advisory.

Parameters
[in]iteratorIterator.
[in]cveName of the CVE.
[in]ascendingWhether to sort ascending or descending.
[in]sort_fieldField to sort on, or NULL for "id".

◆ init_cve_dfn_cert_adv_iterator()

void init_cve_dfn_cert_adv_iterator ( iterator_t iterator,
const char *  cve,
int  ascending,
const char *  sort_field 
)

Initialise CVE iterator, for CVEs referenced by a DFN-CERT advisory.

Parameters
[in]iteratorIterator.
[in]cveName of the CVE.
[in]ascendingWhether to sort ascending or descending.
[in]sort_fieldField to sort on, or NULL for "id".

◆ init_cve_info_iterator()

int init_cve_info_iterator ( iterator_t iterator,
get_data_t get,
const char *  name 
)

Initialise a info iterator.

Parameters
[in]iteratorIterator.
[in]getGET data.
[in]nameName of the info
Returns
0 success, 1 failed to find target, 2 failed to find filter, -1 error.

◆ init_dfn_cert_adv_info_iterator()

int init_dfn_cert_adv_info_iterator ( iterator_t iterator,
get_data_t get,
const char *  name 
)

Initialise an DFN-CERT advisory (dfn_cert_adv) info iterator.

Parameters
[in]iteratorIterator.
[in]getGET data.
[in]nameName of the info
Returns
0 success, 1 failed to find target, 2 failed to find filter, -1 error.

◆ init_nvt_cert_bund_adv_iterator()

void init_nvt_cert_bund_adv_iterator ( iterator_t iterator,
const char *  oid 
)

Initialise an CERT-Bund iterator, for advisories relevant to a NVT.

Parameters
[in]iteratorIterator.
[in]oidOID of the NVT.

◆ init_nvt_dfn_cert_adv_iterator()

void init_nvt_dfn_cert_adv_iterator ( iterator_t iterator,
const char *  oid 
)

Initialise an DFN-CERT iterator, for advisories relevant to a NVT.

Parameters
[in]iteratorIterator.
[in]oidOID of the NVT.

◆ insert_cve_from_entry()

static int insert_cve_from_entry ( element_t  entry,
element_t  last_modified,
GHashTable *  hashed_cpes,
int *  transaction_size 
)
static

Insert a CVE.

Parameters
[in]entryXML entry.
[in]last_modifiedXML last_modified element.
[in]transaction_sizeStatement counter for batching.
[in]hashed_cpesHashed CPEs.
Returns
0 success, -1 error.

◆ insert_cve_products()

static void insert_cve_products ( element_t  list,
resource_t  cve,
int  time_modified,
int  time_published,
GHashTable *  hashed_cpes,
int *  transaction_size 
)
static

Insert products for a CVE.

Parameters
[in]listXML product list.
[in]cveCVE.
[in]time_publishedTime published.
[in]time_modifiedTime modified.
[in]hashed_cpesHashed CPEs.
[in]transaction_sizeStatement counter for batching.

◆ insert_scap_cpe()

static int insert_scap_cpe ( inserts_t inserts,
element_t  cpe_item,
element_t  item_metadata,
int  modification_time 
)
static

Insert a SCAP CPE.

Parameters
[in]insertsPointer to SQL buffer.
[in]cpe_itemCPE item XML element.
[in]item_metadataItem's metadata element.
[in]modification_timeModification time of item.
Returns
0 success, -1 error.

◆ inserts_check_size()

static int inserts_check_size ( inserts_t inserts)
static

Check size of current statement.

Parameters
[in]insertsInsert buffer.
Returns
Whether this is the first value in the statement.

◆ inserts_free()

static void inserts_free ( inserts_t inserts)
static

Free everything.

Parameters
[in]insertsInsert buffer.

◆ inserts_init()

static void inserts_init ( inserts_t inserts,
int  max_chunk_size,
const gchar *  open_sql,
const gchar *  close_sql 
)
static

Check size of current statement.

Parameters
[in]insertsInsert buffer.
[in]max_chunk_sizeMax chunk size.
[in]open_sqlSQL to to start each statement.
[in]close_sqlSQL to append to the end of each statement.

◆ inserts_run()

static void inserts_run ( inserts_t inserts)
static

Run the INSERT SQL, freeing the buffers.

Parameters
[in]insertsInsert buffer.

◆ inserts_statement_close()

static void inserts_statement_close ( inserts_t inserts)
static

Close the current statement.

Parameters
[in]insertsInsert buffer.

◆ last_appearance()

static int last_appearance ( element_t  product)
static

Check if this is the last appearance of a product in its siblings.

Parameters
[in]productProduct.
Returns
1 if last appearance of product, else 0.

◆ manage_db_add_constraints()

int manage_db_add_constraints ( const gchar *  name)

Init external database.

Parameters
[in]nameName. Currently only "scap".
Returns
0 success, -1 error.

◆ manage_db_init()

int manage_db_init ( const gchar *  name)

Init external database.

Parameters
[in]nameName. "cert" or "scap".
Returns
0 success, -1 error.

◆ manage_db_init_indexes()

int manage_db_init_indexes ( const gchar *  name)

Init external database.

Parameters
[in]nameName. Currently only "scap".
Returns
0 success, -1 error.

◆ manage_db_reinit()

static int manage_db_reinit ( const gchar *  name)
static

Reinit a db.

Parameters
[in]nameName of db.
Returns
0 success, -1 error.

◆ manage_db_remove()

void manage_db_remove ( const gchar *  name)

Attach external databases.

Parameters
[in]nameDatabase name.

◆ manage_feed_timestamp()

static int manage_feed_timestamp ( const gchar *  name)
static

Get the feed timestamp.

Parameters
[in]nameFeed type: SCAP or CERT.
Returns
Timestamp from feed. 0 if missing. -1 on error.

◆ manage_rebuild_scap()

int manage_rebuild_scap ( GSList *  log_config,
const db_conn_info_t database 
)

Rebuild part of the SCAP DB.

Parameters
[in]log_configLog configuration.
[in]databaseLocation of manage database.
Returns
0 success, -1 error.

◆ manage_sync_cert()

void manage_sync_cert ( sigset_t *  sigmask_current)

Sync the CERT DB.

Parameters
[in]sigmask_currentSigmask to restore in child.

◆ manage_sync_scap()

void manage_sync_scap ( sigset_t *  sigmask_current)

Sync the SCAP DB.

Parameters
[in]sigmask_currentSigmask to restore in child.

◆ parse_iso_time_element_text()

static int parse_iso_time_element_text ( element_t  element)
static

Get ISO time from element's text.

Parameters
[in]elementElement.
Returns
Seconds since epoch. 0 on error.

◆ rebuild_scap()

static int rebuild_scap ( )
static

Rebuild the entire SCAP DB.

Returns
0 success, 2 sync running, -1 error

◆ secinfo_count_after()

int secinfo_count_after ( const get_data_t get,
const char *  type,
time_t  count_time,
gboolean  get_modified 
)

Count number of SecInfo items created or modified after a given time.

Parameters
[in]getGET params.
[in]typeThe type of SecInfo to count.
[in]count_timeTime SecInfo must be created or modified after.
[in]get_modifiedWhether to get the modification time.
Returns
Total number of items in filtered set.

◆ secinfo_feed_version_status()

int secinfo_feed_version_status ( const char *  feed_type)

Gets the SCAP or CERT database version status.

Parameters
[in]feed_typeThe feed type to check. Must be "cert" or "scap".
Returns
0 feed current, 1 update needed, 2 database missing, 3 missing "last_update", 4 inconsistent data, -1 error.

◆ set_secinfo_commit_size()

void set_secinfo_commit_size ( int  new_commit_size)

Set the SecInfo update commit size.

Parameters
new_commit_sizeThe new SecInfo update commit size.

◆ split_xml_file()

static const gchar* split_xml_file ( gchar *  path,
const gchar *  size,
const gchar *  tail 
)
static

Split a file.

Parameters
[in]pathPath to file.
[in]sizeApprox size of split files. In same format that xml_split accepts, eg "200Kb".
[in]tailText to replace last line of split files.
Returns
Temp dir holding split files.

◆ sql_quote_element_text()

static gchar* sql_quote_element_text ( element_t  element)
static

Get SQL quoted version of element's text.

Parameters
[in]elementElement.
Returns
Freshly allocated quoted text.

◆ string_replace()

static gchar* string_replace ( const gchar *  string,
const gchar *  to,
  ... 
)
static

Replace text in a string.

Parameters
[in]stringString to replace in.
[in]toReplacement text.
Returns
Freshly allocated string with replacements.

◆ sync_cert()

static int sync_cert ( )
static

Sync the CERT DB.

Returns
0 success, -1 error.

◆ sync_scap()

static int sync_scap ( )
static

Sync the SCAP DB.

Returns
0 success, -1 error.

◆ sync_secinfo()

static void sync_secinfo ( sigset_t *  sigmask_current,
int(*)(void)  update,
const gchar *  process_title 
)
static

Sync a SecInfo DB.

Parameters
[in]sigmask_currentSigmask to restore in child.
[in]updateFunction to do the sync.
[in]process_titleProcess title.

◆ try_load_csv()

static int try_load_csv ( )
static

Try load the feed from feed CSV files.

Returns
0 success, -1 error, 1 no CSV.

◆ update_bund_xml()

static int update_bund_xml ( const gchar *  xml_path,
int  last_cert_update,
int  last_bund_update 
)
static

Update CERT-Bund info from a single XML feed file.

Parameters
[in]xml_pathXML path.
[in]last_cert_updateTime of last CERT update.
[in]last_bund_updateTime of last update to a DFN.
Returns
0 nothing to do, 1 updated, -1 error.

◆ update_cert_bund_advisories()

static int update_cert_bund_advisories ( int  last_cert_update)
static

Update CERT-Bunds.

Assume that the databases are attached.

Parameters
[in]last_cert_updateTime of last CERT update from meta.
Returns
0 nothing to do, 1 updated, -1 error.

◆ update_cert_timestamp()

static int update_cert_timestamp ( )
static

Update timestamp in CERT db from feed timestamp.

Returns
0 success, -1 error.

◆ update_cve_xml()

static int update_cve_xml ( const gchar *  xml_path,
GHashTable *  hashed_cpes 
)
static

Update CVE info from a single XML feed file.

Parameters
[in]xml_pathXML path.
[in]hashed_cpesHashed CPEs.
Returns
0 success, -1 error.

◆ update_cvss_cert_bund()

static void update_cvss_cert_bund ( int  updated_cert_bund,
int  last_cert_update,
int  last_scap_update 
)
static

Update CERT-Bund Max CVSS.

Parameters
[in]updated_cert_bundWhether CERT-Bund updated.
[in]last_cert_updateTime of last CERT update.
[in]last_scap_updateTime of last SCAP update.

◆ update_cvss_dfn_cert()

static void update_cvss_dfn_cert ( int  updated_dfn_cert,
int  last_cert_update,
int  last_scap_update 
)
static

Update DFN-CERT Max CVSS.

Parameters
[in]updated_dfn_certWhether CERT-Bund updated.
[in]last_cert_updateTime of last CERT update.
[in]last_scap_updateTime of last SCAP update.

◆ update_dfn_cert_advisories()

static int update_dfn_cert_advisories ( int  last_cert_update)
static

Update DFN-CERTs.

Assume that the databases are attached.

Parameters
[in]last_cert_updateTime of last CERT update from meta.
Returns
0 nothing to do, 1 updated, -1 error.

◆ update_dfn_xml()

static int update_dfn_xml ( const gchar *  xml_path,
int  last_cert_update,
int  last_dfn_update 
)
static

Update DFN-CERT info from a single XML feed file.

Parameters
[in]xml_pathXML path.
[in]last_cert_updateTime of last CERT update.
[in]last_dfn_updateTime of last update to a DFN.
Returns
0 nothing to do, 1 updated, -1 error.

◆ update_scap()

static int update_scap ( gboolean  reset_scap_db)
static

Update all data in the SCAP DB.

Parameters
[in]reset_scap_dbWhether to rebuild regardless of last_scap_update.
Returns
0 success, -1 error.

◆ update_scap_cpes()

static int update_scap_cpes ( )
static

Update SCAP CPEs.

Returns
0 success, -1 error.

◆ update_scap_cpes_from_file()

static int update_scap_cpes_from_file ( const gchar *  path)
static

Update SCAP CPEs from a file.

Parameters
[in]pathPath to file.
Returns
0 success, -1 error.

◆ update_scap_cves()

static int update_scap_cves ( )
static

Update SCAP CVEs.

Assume that the databases are attached.

Returns
0 success, -1 error.

◆ update_scap_end()

static int update_scap_end ( )
static

Finish scap update.

Returns
0 success, -1 error.

◆ update_scap_timestamp()

static int update_scap_timestamp ( )
static

Update timestamp in SCAP db from feed timestamp.

Returns
0 success, -1 error.