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

Add trash columns for target "elevate" credential #1636

Merged
merged 3 commits into from
Jul 22, 2021
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 @@ -35,6 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Removed
### Fixed
- Fix sending prefs for whole, growing VT families [#1603](https://github.com/greenbone/gvmd/pull/1603)
- Add trash columns for target "elevate" credential [#1636](https://github.com/greenbone/gvmd/pull/1636)

[Unreleased]: https://github.com/greenbone/gvmd/compare/v21.4.2...gvmd-21.04

Expand Down
136 changes: 71 additions & 65 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -31768,71 +31768,77 @@ modify_target (const char *target_id, const char *name, const char *hosts,
/**
* @brief Target iterator columns for trash case.
*/
#define TARGET_ITERATOR_TRASH_COLUMNS \
{ \
GET_ITERATOR_COLUMNS (targets_trash), \
{ "hosts", NULL, KEYWORD_TYPE_STRING }, \
{ "target_credential (id, 1, CAST ('ssh' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "target_login_port (id, 1, CAST ('ssh' AS text))", \
"ssh_port", \
KEYWORD_TYPE_INTEGER }, \
{ "target_credential (id, 1, CAST ('smb' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "port_list", NULL, KEYWORD_TYPE_INTEGER }, \
{ "trash_target_credential_location (id, CAST ('ssh' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "trash_target_credential_location (id, CAST ('smb' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ \
"(CASE" \
" WHEN port_list_location = " G_STRINGIFY (LOCATION_TRASH) \
" THEN (SELECT uuid FROM port_lists_trash" \
" WHERE port_lists_trash.id = port_list)" \
" ELSE (SELECT uuid FROM port_lists" \
" WHERE port_lists.id = port_list)" \
" END)", \
NULL, \
KEYWORD_TYPE_STRING \
}, \
{ \
"(CASE" \
" WHEN port_list_location = " G_STRINGIFY (LOCATION_TRASH) \
" THEN (SELECT name FROM port_lists_trash" \
" WHERE port_lists_trash.id = port_list)" \
" ELSE (SELECT name FROM port_lists" \
" WHERE port_lists.id = port_list)" \
" END)", \
NULL, \
KEYWORD_TYPE_STRING \
}, \
{ "port_list_location = " G_STRINGIFY (LOCATION_TRASH), \
NULL, \
KEYWORD_TYPE_STRING }, \
{ "exclude_hosts", NULL, KEYWORD_TYPE_STRING }, \
{ "reverse_lookup_only", NULL, KEYWORD_TYPE_INTEGER }, \
{ "reverse_lookup_unify", NULL, KEYWORD_TYPE_INTEGER }, \
{ "alive_test", NULL, KEYWORD_TYPE_INTEGER }, \
{ "target_credential (id, 1, CAST ('esxi' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "trash_target_credential_location (id, CAST ('esxi' AS text))",\
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "target_credential (id, 1, CAST ('snmp' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "trash_target_credential_location (id, CAST ('snmp' AS text))",\
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "allow_simultaneous_ips", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ NULL, NULL, KEYWORD_TYPE_UNKNOWN } \
#define TARGET_ITERATOR_TRASH_COLUMNS \
{ \
GET_ITERATOR_COLUMNS (targets_trash), \
{ "hosts", NULL, KEYWORD_TYPE_STRING }, \
{ "target_credential (id, 1, CAST ('ssh' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "target_login_port (id, 1, CAST ('ssh' AS text))", \
"ssh_port", \
KEYWORD_TYPE_INTEGER }, \
{ "target_credential (id, 1, CAST ('smb' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "port_list", NULL, KEYWORD_TYPE_INTEGER }, \
{ "trash_target_credential_location (id, CAST ('ssh' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "trash_target_credential_location (id, CAST ('smb' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ \
"(CASE" \
" WHEN port_list_location = " G_STRINGIFY (LOCATION_TRASH) \
" THEN (SELECT uuid FROM port_lists_trash" \
" WHERE port_lists_trash.id = port_list)" \
" ELSE (SELECT uuid FROM port_lists" \
" WHERE port_lists.id = port_list)" \
" END)", \
NULL, \
KEYWORD_TYPE_STRING \
}, \
{ \
"(CASE" \
" WHEN port_list_location = " G_STRINGIFY (LOCATION_TRASH) \
" THEN (SELECT name FROM port_lists_trash" \
" WHERE port_lists_trash.id = port_list)" \
" ELSE (SELECT name FROM port_lists" \
" WHERE port_lists.id = port_list)" \
" END)", \
NULL, \
KEYWORD_TYPE_STRING \
}, \
{ "port_list_location = " G_STRINGIFY (LOCATION_TRASH), \
NULL, \
KEYWORD_TYPE_STRING }, \
{ "exclude_hosts", NULL, KEYWORD_TYPE_STRING }, \
{ "reverse_lookup_only", NULL, KEYWORD_TYPE_INTEGER }, \
{ "reverse_lookup_unify", NULL, KEYWORD_TYPE_INTEGER }, \
{ "alive_test", NULL, KEYWORD_TYPE_INTEGER }, \
{ "target_credential (id, 1, CAST ('esxi' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "trash_target_credential_location (id, CAST ('esxi' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "target_credential (id, 1, CAST ('snmp' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "trash_target_credential_location (id, CAST ('snmp' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "target_credential (id, 1, CAST ('elevate' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "trash_target_credential_location (id, CAST ('elevate' AS text))", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ "allow_simultaneous_ips", \
NULL, \
KEYWORD_TYPE_INTEGER }, \
{ NULL, NULL, KEYWORD_TYPE_UNKNOWN } \
}

/**
Expand Down