Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert "severity_date" value to seconds since epoch #412

Merged
merged 2 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
[#410](https://github.com/greenbone/gvm-libs/pull/410)
- Add multiple severities for nvti [#317](https://github.com/greenbone/gvm-libs/pull/317)
- Add support for new OSP element for defining alive test methods via separate subelements. [#409](https://github.com/greenbone/gvm-libs/pull/409)
- Add severity_date tag in epoch time format. [#412](https://github.com/greenbone/gvm-libs/pull/412)

### Changed
- Add separators for a new (ip address) field in ERRMSG and DEADHOST messages. [#376](https://github.com/greenbone/gvm-libs/pull/376)
Expand Down
10 changes: 6 additions & 4 deletions base/nvti.c
Original file line number Diff line number Diff line change
Expand Up @@ -1458,10 +1458,10 @@ nvti_set_solution_method (nvti_t *n, const gchar *solution_method)

/**
* @brief Add a tag to the NVT tags.
* The tag names "last_modification" and "creation_date" are
* treated special: The value is expected to be a timestamp
* and it is being converted to seconds since epoch before
* added as a tag value.
* The tag names "severity_date", "last_modification" and
* "creation_date" are treated special: The value is expected
* to be a timestamp and it is being converted to seconds
* since epoch before added as a tag value.
* The tag name "cvss_base" will be ignored and not added.
*
* @param n The NVT Info structure.
Expand Down Expand Up @@ -1496,6 +1496,8 @@ nvti_add_tag (nvti_t *n, const gchar *name, const gchar *value)
nvti_set_creation_time (n, parse_nvt_timestamp (value));
newvalue = g_strdup_printf ("%i", (int) nvti_creation_time (n));
}
else if (!strcmp (name, "severity_date"))
newvalue = g_strdup_printf ("%i", (int) parse_nvt_timestamp (value));
else if (!strcmp (name, "cvss_base"))
{
/* Ignore this tag because it is not being used.
Expand Down