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:
John L. Whiteman
2015-04-29 14:25:54 -07:00
parent 71866dc00c
commit 70a2bdef07
+5 -1
View File
@@ -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");