From 5f1c0c4b874bf0213e8cd0da3f84c0fb16e1d325 Mon Sep 17 00:00:00 2001 From: Juan Jose Nicola Date: Fri, 17 Jan 2020 16:02:27 +0100 Subject: [PATCH 1/3] Extend osp with target's alive test option. --- osp/osp.c | 10 +++++++++- osp/osp.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osp/osp.c b/osp/osp.c index 207351f67..f4f856201 100644 --- a/osp/osp.c +++ b/osp/osp.c @@ -88,6 +88,7 @@ struct osp_target gchar *hosts; /** String defining one or many hosts to scan */ gchar *ports; /** String defining the ports to scan */ gchar *finished_hosts; /** String defining hosts to exclude as finished */ + int alive_test; /** Value defining an alive test method */ }; /** @@ -866,6 +867,11 @@ target_append_as_xml (osp_target_t *target, GString *xml_string) target->finished_hosts ? target->finished_hosts : "", target->ports ? target->ports : ""); + if (target->alive_test > 0) + xml_string_append (xml_string, + "%d", + target->alive_test); + if (target->credentials) { g_string_append (xml_string, ""); @@ -1394,7 +1400,8 @@ osp_credential_set_auth_data (osp_credential_t *credential, osp_target_t * osp_target_new (const char *hosts, const char *ports, - const char *exclude_hosts) + const char *exclude_hosts, + int alive_test) { osp_target_t *new_target; new_target = g_malloc0 (sizeof (osp_target_t)); @@ -1403,6 +1410,7 @@ osp_target_new (const char *hosts, new_target->hosts = hosts ? g_strdup (hosts) : NULL; new_target->ports = ports ? g_strdup (ports) : NULL; new_target->finished_hosts = NULL; + new_target->alive_test = alive_test ? alive_test : 0; return new_target; } diff --git a/osp/osp.h b/osp/osp.h index 7a0c80ab0..0d1bc9e07 100644 --- a/osp/osp.h +++ b/osp/osp.h @@ -199,7 +199,7 @@ osp_credential_set_auth_data (osp_credential_t *, const char*, const char*); /* OSP targets handling */ osp_target_t * -osp_target_new (const char *, const char *, const char *); +osp_target_new (const char *, const char *, const char *, int); void osp_target_set_finished_hosts (osp_target_t *, const char *); From f2e8ae261787888c420171102b29520350311bf8 Mon Sep 17 00:00:00 2001 From: Juan Jose Nicola Date: Fri, 17 Jan 2020 16:07:08 +0100 Subject: [PATCH 2/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 91b060d8d..2f92abc7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Added - Add nvti_get_tag() [#285](https://github.com/greenbone/gvm-libs/pull/285) - Add nvti_solution_method() and nvti_set_solution_method() [#283](https://github.com/greenbone/gvm-libs/pull/283) +- Extend osp with target's alive test option.[#312](https://github.com/greenbone/gvm-libs/pull/312) [20.4]: https://github.com/greenbone/gvm-libs/compare/gvm-libs-11.0...master From 7a700f44eda380cf5d7d0c46ee37f45309659cf3 Mon Sep 17 00:00:00 2001 From: Juan Jose Nicola Date: Fri, 17 Jan 2020 16:43:34 +0100 Subject: [PATCH 3/3] Add missing doc --- osp/osp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/osp/osp.c b/osp/osp.c index f4f856201..a22361067 100644 --- a/osp/osp.c +++ b/osp/osp.c @@ -1394,6 +1394,7 @@ osp_credential_set_auth_data (osp_credential_t *credential, * @param[in] hosts The hostnames of the target. * @param[in] ports The ports of the target. * @param[in] exclude_hosts The excluded hosts of the target. + * @param[in] alive_test The alive test method of the target. * * @return The newly allocated osp_target_t. */