forked from OpenSCAP/openscap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcve.c
85 lines (68 loc) · 2.07 KB
/
cve.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*! \file cve.c
* \brief Interface to Common Vulnerability and Exposure dictionary
*
* See details at:
* http://cve.mitre.org/
* http://nvd.nist.gov/download.cfm
*
*/
/*
* Copyright 2008-2009 Red Hat Inc., Durham, North Carolina.
* All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Maros Barabas <[email protected]>
* Tomas Heinrich <[email protected]>
* Brian Kolbay <[email protected]>
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "public/cve_nvd.h"
#include "cve_priv.h"
#include "common/util.h"
#include "common/list.h"
#define CVE_SUPPORTED "2.0"
/**
* Public function to import CVE model from OSCAP import source.
* Function returns CVE model, need to free source after calling this function
*/
struct cve_model *cve_model_import(const char *file)
{
__attribute__nonnull__(file);
if (file == NULL)
return NULL;
struct cve_model *cve;
cve = cve_model_parse_xml(file);
return cve;
}
/**
* Public function to export CVE model to OSCAP export target.
* Function fill the structure _target_ with model that is represented by structure
* _cve_.
*/
void cve_model_export(struct cve_model *cve, const char *file)
{
__attribute__nonnull__(file);
if (file == NULL)
return;
cve_model_export_xml(cve, file);
}
const char * cve_model_supported(void)
{
return CVE_SUPPORTED;
}