Skip to content

Commit

Permalink
Add timestamps as explicit elements of nvti.
Browse files Browse the repository at this point in the history
  • Loading branch information
janowagner committed Sep 4, 2019
1 parent dccf3fe commit 21af6fe
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
69 changes: 69 additions & 0 deletions base/nvti.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ typedef struct nvti
gchar *affected; /**< @brief Affected systems */
gchar *impact; /**< @brief Impact of vulnerability */

gint creation_time; /**< @brief Time of creation, seconds since epoche */
gint modification_time; /**< @brief Time of last change, sec. since epoche */

gchar *solution; /**< @brief The solution */
gchar *solution_type; /**< @brief The solution type */

Expand Down Expand Up @@ -464,6 +467,34 @@ nvti_impact (const nvti_t *n)
return (n ? n->impact : NULL);
}

/**
* @brief Get the creation time.
*
* @param n The NVT Info structure of which the creation time should
* be returned.
*
* @return The creation time in seconds since epoche.
*/
gint
nvti_creation_time (const nvti_t *n)
{
return (n ? n->creation_time : 0);
}

/**
* @brief Get the modification time.
*
* @param n The NVT Info structure of which the modification time should
* be returned.
*
* @return The modification time in seconds since epoche.
*/
gint
nvti_modification_time (const nvti_t *n)
{
return (n ? n->modification_time : 0);
}

/**
* @brief Get the number of references of the NVT.
*
Expand Down Expand Up @@ -945,6 +976,44 @@ nvti_set_impact (nvti_t *n, const gchar *impact)
return (0);
}

/**
* @brief Set the creation time of a NVT.
*
* @param n The NVT Info structure.
*
* @param creation_time The creation time to set.
*
* @return 0 for success. Anything else indicates an error.
*/
int
nvti_set_creation_time (nvti_t *n, const gint creation_time)
{
if (!n)
return (-1);

n->creation_time = creation_time;
return (0);
}

/**
* @brief Set the modification time of a NVT.
*
* @param n The NVT Info structure.
*
* @param modification_time The modification time to set.
*
* @return 0 for success. Anything else indicates an error.
*/
int
nvti_set_modification_time (nvti_t *n, const gint modification_time)
{
if (!n)
return (-1);

n->modification_time = modification_time;
return (0);
}

/**
* @brief Set the solution of a NVT.
*
Expand Down
8 changes: 8 additions & 0 deletions base/nvti.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ gchar *
nvti_affected (const nvti_t *);
gchar *
nvti_impact (const nvti_t *);
gint
nvti_creation_time (const nvti_t *);
gint
nvti_modification_time (const nvti_t *);
gchar *
nvti_insight (const nvti_t *);
gchar *
Expand Down Expand Up @@ -144,6 +148,10 @@ nvti_set_affected (nvti_t *, const gchar *);
int
nvti_set_impact (nvti_t *, const gchar *);
int
nvti_set_creation_time (nvti_t *, const gint);
int
nvti_set_modification_time (nvti_t *, const gint);
int
nvti_set_solution (nvti_t *, const gchar *);
int
nvti_set_solution_type (nvti_t *, const gchar *);
Expand Down

0 comments on commit 21af6fe

Please sign in to comment.