SHA256
1
0
forked from pool/openscap
Marcus Meissner 2017-11-14 15:21:10 +00:00 committed by Git OBS Bridge
parent fd2df3e5a6
commit 69d55966cf
2 changed files with 0 additions and 78 deletions

View File

@ -1,76 +0,0 @@
Index: openscap-1.2.16/utils/oscap-cvrf.c
===================================================================
--- openscap-1.2.16.orig/utils/oscap-cvrf.c
+++ openscap-1.2.16/utils/oscap-cvrf.c
@@ -59,7 +59,8 @@ static struct oscap_module CVRF_EVALUATE
.func = app_cvrf_evaluate,
.help = "Options:\n"
" --index\r\t\t\t\t - Use index file to evaluate a directory of CVRF files.\n"
- " --results\r\t\t\t\t - Filename to which evaluation results will be saved.\n",
+ " --results\r\t\t\t\t - Filename to which evaluation results will be saved.\n"
+ " --productid\r\t\t\t\t - Product ID to use (currently not yet auto-detected).\n",
};
static struct oscap_module CVRF_EXPORT_MODULE = {
@@ -97,11 +98,19 @@ static int app_cvrf_evaluate(const struc
int result = OSCAP_OK;
// Temporary hardcoded CPE until CPE name can be found without input by CVRF functions
// themselves
- const char *os_name = "Red Hat Enterprise Linux Desktop Supplementary (v. 6)";
- struct oscap_source *import_source = oscap_source_new_from_file(action->cvrf_action->f_cvrf);
- struct oscap_source *export_source = cvrf_model_get_results_source(import_source, os_name);
- if (export_source == NULL)
+ char *os_name = "Red Hat Enterprise Linux Desktop Supplementary (v. 6)";
+ struct oscap_source *import_source;
+ struct oscap_source *export_source;
+
+ if (action->cvrf_action->f_productid)
+ os_name = action->cvrf_action->f_productid;
+
+ import_source = oscap_source_new_from_file(action->cvrf_action->f_cvrf);
+ export_source = cvrf_model_get_results_source(import_source, os_name);
+ if (export_source == NULL) {
+ fprintf(stderr, "Could not find results for product %s\n", os_name);
return -1;
+ }
if (oscap_source_save_as(export_source, action->cvrf_action->f_results) == -1) {
result = OSCAP_ERROR;
@@ -180,6 +189,7 @@ enum cvrf_opt {
CVRF_OPT_INDEX,
CVRF_OPT_RESULT_FILE,
CVRF_OPT_OUTPUT_FILE,
+ CVRF_OPT_PRODUCT_ID,
};
bool getopt_cvrf(int argc, char **argv, struct oscap_action *action) {
@@ -191,6 +201,7 @@ bool getopt_cvrf(int argc, char **argv,
{"index", 0, NULL, CVRF_OPT_INDEX},
{"results", 1, NULL, CVRF_OPT_RESULT_FILE},
{"output", 1, NULL, CVRF_OPT_OUTPUT_FILE},
+ {"productid", 1, NULL, CVRF_OPT_PRODUCT_ID},
{0, 0, 0, 0}
};
@@ -206,6 +217,9 @@ bool getopt_cvrf(int argc, char **argv,
case CVRF_OPT_OUTPUT_FILE:
cvrf_action->f_output = optarg;
break;
+ case CVRF_OPT_PRODUCT_ID:
+ cvrf_action->f_productid = optarg;
+ break;
default:
return oscap_module_usage(action->module, stderr, NULL);
}
Index: openscap-1.2.16/utils/oscap-tool.h
===================================================================
--- openscap-1.2.16.orig/utils/oscap-tool.h
+++ openscap-1.2.16/utils/oscap-tool.h
@@ -104,6 +104,7 @@ struct cvrf_action {
char *f_cvrf;
char *f_results;
char *f_output;
+ char *f_productid;
};
struct oscap_action {

View File

@ -30,7 +30,6 @@ Source2: sysconfig.oscap-scan
# Generated from http://gitorious.org/test-suite/scap # Generated from http://gitorious.org/test-suite/scap
Source3: scap-yast2sec-xccdf.xml Source3: scap-yast2sec-xccdf.xml
Source4: scap-yast2sec-oval.xml Source4: scap-yast2sec-oval.xml
Patch0: openscap-productid-cvrf.patch
Url: http://www.open-scap.org/ Url: http://www.open-scap.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: doxygen BuildRequires: doxygen
@ -167,7 +166,6 @@ commonly used and require additional dependencies.
%prep %prep
%setup -q %setup -q
%patch0 -p1
%build %build