Skip to content

Commit

Permalink
Merge pull request #785 from jjnicola/file-type-pref-9
Browse files Browse the repository at this point in the history
If the nvt preference is "file" type, encode it into Base64 format. (gvmd-9)
  • Loading branch information
timopollmeier authored Oct 10, 2019
2 parents 7404016 + 6ea1d08 commit 527d213
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix array index error when modifying roles and groups [#762](https://github.com/greenbone/gvmd/pull/762)
- Add NULL check in nvts_feed_version_epoch [#773](https://github.com/greenbone/gvmd/pull/773)
- Fix percent sign escaping in report_port_count [#782](https://github.com/greenbone/gvmd/pull/782)
- If the nvt preference is "file" type, encode it into Base64 format [#785](https://github.com/greenbone/gvmd/pull/785)

### Removed
- The handling of NVT updates via OTP has been removed. [#575](https://github.com/greenbone/gvmd/pull/575)
Expand Down
9 changes: 7 additions & 2 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -3785,9 +3785,12 @@ target_osp_ssh_credential (target_t target)
if (strcmp (type, "usk") == 0)
{
const char *private_key = credential_iterator_private_key (&iter);
gchar *base64 = g_base64_encode ((guchar *) private_key,
strlen (private_key));
osp_credential_set_auth_data (osp_credential,
"private",
private_key);
"private", base64);
g_free (base64);

}
cleanup_iterator (&iter);
return osp_credential;
Expand Down Expand Up @@ -4091,6 +4094,8 @@ launch_osp_openvas_task (task_t task, target_t target, const char *scan_id,
osp_value = g_strdup (split_value[0]);
g_strfreev (split_value);
}
else if (strcmp (type, "file") == 0)
osp_value = g_base64_encode ((guchar*) value, strlen (value));

osp_vt = g_hash_table_lookup (vts_hash_table, oid);
if (osp_vt)
Expand Down

0 comments on commit 527d213

Please sign in to comment.