mirror of
https://github.com/clearlinux/cve-check-tool.git
synced 2026-09-06 13:41:48 +00:00
jira: Added check to prevent dups for same session
Signed-off-by: John L. Whiteman <john.l.whiteman@intel.com>
This commit is contained in:
+5
-1
@@ -459,6 +459,7 @@ bool track_bugs(const gchar *auto_bug_template)
|
||||
autofree(gchar) *cve_url = NULL;
|
||||
struct cve_entry_t *cve_entry = NULL;
|
||||
bool ret = true;
|
||||
GHashTable *no_dup_ids = NULL;
|
||||
|
||||
if (self == NULL || self->cdb == NULL) {
|
||||
return false;
|
||||
@@ -478,10 +479,11 @@ bool track_bugs(const gchar *auto_bug_template)
|
||||
if (!get_jira_issues(jira_search_json, &jira_issues)) {
|
||||
return false;
|
||||
}
|
||||
no_dup_ids = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
cves = g_hash_table_get_values(self->cdb);
|
||||
for (cve=cves; cve; cve=cve->next) {
|
||||
cve_entry = cve->data;
|
||||
if (!get_jira_issue(jira_issues, cve_entry->id)) {
|
||||
if (!get_jira_issue(jira_issues, cve_entry->id) && !g_hash_table_contains(no_dup_ids, cve_entry->id)) {
|
||||
cve_url = g_strdup_printf("https://cve.mitre.org/cgi-bin/cvename.cgi?name=%s", cve_entry->id);
|
||||
printf("Adding to bug database: %s\n -%s\n",
|
||||
cve_entry->id, cve_url);
|
||||
@@ -500,9 +502,11 @@ bool track_bugs(const gchar *auto_bug_template)
|
||||
if (!ret) {
|
||||
break;
|
||||
}
|
||||
g_hash_table_insert(no_dup_ids, cve_entry->id, cve_entry->id);
|
||||
}
|
||||
}
|
||||
g_list_free(cves);
|
||||
g_hash_table_destroy(no_dup_ids);
|
||||
free_jira_issues(&jira_issues);
|
||||
if (!ret) {
|
||||
printf("Error: Aborting adding CVEs to bug database due to errors\n");
|
||||
|
||||
Reference in New Issue
Block a user