Skip to content

Commit

Permalink
Use 'lookup_cve' db function instead of reduplicating its logic
Browse files Browse the repository at this point in the history
  • Loading branch information
HoussemNasri committed Jan 18, 2024
1 parent 1a2bba7 commit 4890402
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,9 @@ DECLARE
vulnerable_pkg_id_val numeric;
begin

IF NOT exists(SELECT cve FROM rhnCve cve WHERE cve.name = cve_name_in) THEN
INSERT INTO rhncve(id, name)
VALUES (nextval('rhn_cve_id_seq'), cve_name_in);
END IF;

SELECT id INTO cve_id_val FROM rhncve WHERE name = cve_name_in;

IF NOT exists(SELECT c FROM suseOVALPlatform c WHERE cpe = product_cpe_in) THEN
INSERT INTO suseovalplatform(id, cpe)
VALUES (nextval('suse_oval_platform_id_seq'), product_cpe_in);
END IF;
cve_id_val := lookup_cve(cve_name_in);

SELECT id INTO product_cpe_id_val FROM suseOVALPlatform WHERE cpe = product_cpe_in;
product_cpe_id_val := lookup_oval_platform(product_cpe_in);

IF NOT EXISTS(SELECT 1
FROM suseovalvulnerablepackage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,7 @@ DECLARE
vulnerable_pkg_id_val numeric;
begin

IF NOT exists(SELECT cve FROM rhnCve cve WHERE cve.name = cve_name_in) THEN
INSERT INTO rhncve(id, name)
VALUES (nextval('rhn_cve_id_seq'), cve_name_in);
END IF;

SELECT id INTO cve_id_val FROM rhncve WHERE name = cve_name_in;
cve_id_val := lookup_cve(cve_name_in);

product_cpe_id_val := lookup_oval_platform(product_cpe_in);

Expand Down

0 comments on commit 4890402

Please sign in to comment.