Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Add entry expansion function.
Vsevolod Stakhov committed 12 years ago
commit c11a0a38ab29b078ada5739d27f5ceda0e6142e6
parent a8d73f5
1 file changed +34 -0
modified src/audit.c
@@ -83,6 +83,7 @@ struct audit_entry {
	char *url;
	char *desc;
	char *id;
+
	bool ref;
	struct audit_entry *next;
};

@@ -216,6 +217,39 @@ fetch_and_extract(const char *src, const char *dest)
	return (retcode);
}

+
/*
+
 * Expand multiple names to a set of audit entries
+
 */
+
static void
+
audit_expand_entries(struct audit_entry *entry, struct audit_entry *head)
+
{
+
	struct audit_entry *n;
+
	struct audit_pkgname_entry *pcur;
+

+
	/* Set the name of the current entry */
+
	entry->pkgname = entry->names->pkgname;
+

+
	if (entry->names->next == NULL) {
+
		/* Nothing to expand */
+
		return;
+
	}
+

+
	LL_FOREACH(entry->names->next, pcur) {
+
		n = calloc(1, sizeof(struct audit_entry));
+
		if (n == NULL)
+
			err(1, "calloc(audit_entry)");
+
		n->pkgname = pcur->pkgname;
+
		/* Set new entry as reference entry */
+
		n->ref = true;
+
		n->cve = entry->cve;
+
		n->desc = entry->desc;
+
		n->versions = entry->versions;
+
		n->url = entry->url;
+
		n->id = entry->id;
+
		LL_PREPEND(head, n);
+
	}
+
}
+

enum vulnxml_parse_state {
	VULNXML_PARSE_INIT = 0,
	VULNXML_PARSE_VULN,