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

Account for -1 of orphans when deleting permission #1345

Merged
merged 3 commits into from
Nov 5, 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 @@ -40,6 +40,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Switch result filter column 'task' from task ID to name task name [#1317](https://github.com/greenbone/gvmd/pull/1317)
- Correct check of get_certificate_info return [#1318](https://github.com/greenbone/gvmd/pull/1318)
- Fix GMP doc text of `active` elem for notes and overrides [#1323](https://github.com/greenbone/gvmd/pull/1323)
- Account for -1 of orphans when deleting permission [#1345](https://github.com/greenbone/gvmd/pull/1345)
- Move feed object in trash checks to startup [#1325](https://github.com/greenbone/gvmd/pull/1325)
- Always check for 'All' when deleting selectors [#1342](https://github.com/greenbone/gvmd/pull/1342)
- Do not inherit settings from deleted users [#1328](https://github.com/greenbone/gvmd/pull/1328)
Expand Down
5 changes: 3 additions & 2 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -44381,7 +44381,8 @@ delete_permission (const char *permission_id, int ultimate)
cache_permissions_for_resource (resource_type, resource, NULL);

/* Update Reports cache */
if (resource_type && resource && strcmp (resource_type, "override") == 0)
if (resource_type && (resource > 0) && strcmp (resource_type, "override")
== 0)
{
reports = reports_for_override (resource);
}
Expand Down Expand Up @@ -56123,7 +56124,7 @@ cache_permissions_for_resource (const char *type, resource_t resource,
{
int free_users;

if (type == NULL || resource == 0)
if (type == NULL || resource == 0 || resource == -1)
return;

if (cache_users == NULL)
Expand Down