Skip to content

Commit

Permalink
Merge branch 'main' into GEA-635_Use_compression_in_feed_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelmold authored Oct 22, 2024
2 parents 02cb67f + 8a1c684 commit 356100d
Show file tree
Hide file tree
Showing 7 changed files with 712 additions and 90 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ include (CPack)

set (GVMD_DATABASE_VERSION 256)

set (GVMD_SCAP_DATABASE_VERSION 21)
set (GVMD_SCAP_DATABASE_VERSION 22)

set (GVMD_CERT_DATABASE_VERSION 8)

Expand Down
38 changes: 30 additions & 8 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -13473,24 +13473,36 @@ handle_get_info (gmp_parser_t *gmp_parser, GError **error)
"<title>%s</title>",
cpe_info_iterator_title (&info));
xml_string_append (result,
"<nvd_id>%s</nvd_id>"
"<cpe_name_id>%s</cpe_name_id>"
"<severity>%s</severity>"
"<cve_refs>%s</cve_refs>"
"<status>%s</status>",
cpe_info_iterator_nvd_id (&info)
? cpe_info_iterator_nvd_id (&info)
"<deprecated>%s</deprecated>",
cpe_info_iterator_cpe_name_id (&info)
? cpe_info_iterator_cpe_name_id (&info)
: "",
cpe_info_iterator_severity (&info)
? cpe_info_iterator_severity (&info)
: "",
cpe_info_iterator_cve_refs (&info),
cpe_info_iterator_status (&info)
? cpe_info_iterator_status (&info)
: "");
cpe_info_iterator_deprecated (&info)
? cpe_info_iterator_deprecated (&info)
: "0");

if (get_info_data->details == 1)
{
iterator_t cves;
iterator_t deprecated_by, cves, refs;

init_cpe_deprecated_by_iterator (&deprecated_by,
get_iterator_name (&info));
while (next (&deprecated_by))
{
xml_string_append (result,
"<deprecated_by cpe_id=\"%s\"/>",
cpe_deprecated_by_iterator_deprecated_by
(&deprecated_by));
}
cleanup_iterator (&deprecated_by);

g_string_append (result, "<cves>");
init_cpe_cve_iterator (&cves, get_iterator_name (&info), 0, NULL);
while (next (&cves))
Expand Down Expand Up @@ -13518,6 +13530,16 @@ handle_get_info (gmp_parser_t *gmp_parser, GError **error)
: "");
cleanup_iterator (&cves);
g_string_append (result, "</cves>");

g_string_append (result, "<references>");
init_cpe_reference_iterator (&refs, get_iterator_name (&info));
while (next (&refs))
xml_string_append (result,
"<reference href=\"%s\">%s</reference>",
cpe_reference_iterator_href (&refs),
cpe_reference_iterator_type (&refs));
cleanup_iterator (&refs);
g_string_append (result, "</references>");
}
}
else if (g_strcmp0 ("cve", get_info_data->type) == 0)
Expand Down
23 changes: 18 additions & 5 deletions src/manage.h
Original file line number Diff line number Diff line change
Expand Up @@ -3339,6 +3339,12 @@ manage_scap_update_time ();

/* CPE. */

void
init_cpe_deprecated_by_iterator (iterator_t *, const char *);

const char *
cpe_deprecated_by_iterator_deprecated_by (iterator_t *);

void
init_cpe_cve_iterator (iterator_t *, const char *, int, const char *);

Expand All @@ -3355,23 +3361,30 @@ const char*
cpe_info_iterator_title (iterator_t*);

const char*
cpe_info_iterator_status (iterator_t*);
cpe_info_iterator_deprecated (iterator_t*);

const char *
cpe_info_iterator_severity (iterator_t*);

const char*
cpe_info_iterator_deprecated_by_id (iterator_t*);

const char*
cpe_info_iterator_cve_refs (iterator_t*);

const char*
cpe_info_iterator_nvd_id (iterator_t*);
cpe_info_iterator_cpe_name_id (iterator_t*);

gchar *
cpe_details_xml (const char*);

void
init_cpe_reference_iterator (iterator_t *, const char *);

const char*
cpe_reference_iterator_href (iterator_t *);

const char*
cpe_reference_iterator_type (iterator_t *);


/* CVE. */

const char*
Expand Down
16 changes: 14 additions & 2 deletions src/manage_pg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3525,10 +3525,22 @@ manage_db_init (const gchar *name)
" modification_time integer,"
" title text,"
" status text,"
" deprecated_by_id INTEGER,"
" severity DOUBLE PRECISION DEFAULT 0,"
" cve_refs INTEGER DEFAULT 0,"
" nvd_id text);");
" nvd_id text,"
" deprecated integer,"
" cpe_name_id text);");

sql ("CREATE TABLE scap2.cpe_refs"
" (id SERIAL PRIMARY KEY,"
" cpe INTEGER,"
" ref TEXT,"
" type TEXT);");

sql ("CREATE TABLE scap2.cpes_deprecated_by"
" (id SERIAL PRIMARY KEY,"
" cpe TEXT,"
" deprecated_by TEXT);");

sql ("CREATE TABLE scap2.cpe_match_nodes"
" (id SERIAL PRIMARY KEY,"
Expand Down
Loading

0 comments on commit 356100d

Please sign in to comment.