Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
Support configurable NVD directory in filesystem
Browse files Browse the repository at this point in the history
Allow user to supply path to the NVD directory in
filesystem as optional argument to the cve-check-{tool,update}.

If argument isn't specified defaults is to ~/NVDS.

This enables sharing of NVD for better storage utilization
and improved results consistency.

Signed-off-by: Sergey Popovich <[email protected]>
  • Loading branch information
Sergey Popovich authored and Serhii Popovych committed Jan 5, 2016
1 parent f432f9d commit 652ae0a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ static bool hide_patched = false;
static bool show_unaffected = false;
static bool _show_version = false;
static bool skip_update = false;
static gchar *nvds = NULL;
static gchar *forced_type = NULL;
static bool no_html = false;
static bool csv_mode = false;
Expand All @@ -239,6 +240,7 @@ static GOptionEntry _entries[] = {
{ "not-patched", 'n', 0, G_OPTION_ARG_NONE, &hide_patched, "Hide patched/addressed CVEs", NULL },
{ "not-affected", 'a', 0, G_OPTION_ARG_NONE, &show_unaffected, "Show unaffected items", NULL },
{ "skip-update", 'u', 0, G_OPTION_ARG_NONE, &skip_update, "Bypass forced updates", NULL },
{ "nvd-dir", 'd', 0, G_OPTION_ARG_STRING, &nvds, "NVD directory in filesystem", NULL },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &_show_version, "Show version", NULL },
{ "type", 't', 0, G_OPTION_ARG_STRING, &forced_type, "Set package type to T", "T" },
{ "no-html", 'N', 0, G_OPTION_ARG_NONE, &no_html, "Disable HTML report", NULL },
Expand Down Expand Up @@ -439,7 +441,7 @@ int main(int argc, char **argv)
goto cleanup;
}

db_path = get_db_path(NULL);
db_path = get_db_path(nvds);
if (!db_path) {
fprintf(stderr, "main(): Out of memory\n");
goto cleanup;
Expand Down
4 changes: 3 additions & 1 deletion src/update-main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ the Free Software Foundation; either version 2 of the License, or\n\
fprintf(stderr, "%s\n", msg);
}

static gchar *nvds = NULL;
static bool _show_version = false;
static bool _quiet = false;

static GOptionEntry _entries[] = {
{ "nvd-dir", 'd', 0, G_OPTION_ARG_STRING, &nvds, "NVD directory in filesystem", NULL },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &_show_version, "Show version", NULL },
{ "quiet", 'q', 0, G_OPTION_ARG_NONE, &_quiet, "Run silently", NULL },
{ .short_name = 0 }
Expand Down Expand Up @@ -72,7 +74,7 @@ int main(int argc, char **argv)
goto end;
}

db_path = get_db_path(NULL);
db_path = get_db_path(nvds);
if (!db_path) {
fprintf(stderr, "main(): Out of memory\n");
goto end;
Expand Down

0 comments on commit 652ae0a

Please sign in to comment.