Skip to content

Commit

Permalink
Merge pull request #1058 from mattmundell/schedule-permission
Browse files Browse the repository at this point in the history
Stop current scheduling of task when permission denied
  • Loading branch information
timopollmeier authored Apr 30, 2020
2 parents c61a234 + aa5d0ca commit bf7d8e1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Perform integrity check of VTs after updates [#1024](https://github.com/greenbone/gvmd/pull/1024) [#1035](https://github.com/greenbone/gvmd/pull/1035)
- Ensure path of listening UNIX socket exists [#1040](https://github.com/greenbone/gvmd/pull/1040)
- Add --rebuild-scap option [#1051](https://github.com/greenbone/gvmd/pull/1051)
- Stop current scheduling of task when permission denied [#1058](https://github.com/greenbone/gvmd/pull/1058)

### Changed
- Update SCAP and CERT feed info in sync scripts [#810](https://github.com/greenbone/gvmd/pull/810)
Expand Down
28 changes: 21 additions & 7 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -7111,14 +7111,28 @@ scheduled_task_start (scheduled_task_t *scheduled_task,
scheduled_task->task_uuid,
NULL))
{
if (gmp_start_task_report_c (&connection,
scheduled_task->task_uuid,
NULL))
gmp_start_task_opts_t opts;

opts = gmp_start_task_opts_defaults;
opts.task_id = scheduled_task->task_uuid;

switch (gmp_start_task_ext_c (&connection, opts))
{
g_warning ("%s: gmp_start_task and gmp_resume_task failed", __func__);
scheduled_task_free (scheduled_task);
gvm_connection_free (&connection);
exit (EXIT_FAILURE);
case 0:
break;

case 99:
g_warning ("%s: user denied permission to start task", __func__);
scheduled_task_free (scheduled_task);
gvm_connection_free (&connection);
/* Return success, so that parent stops trying to start the task. */
exit (EXIT_SUCCESS);

default:
g_warning ("%s: gmp_start_task and gmp_resume_task failed", __func__);
scheduled_task_free (scheduled_task);
gvm_connection_free (&connection);
exit (EXIT_FAILURE);
}
}

Expand Down

0 comments on commit bf7d8e1

Please sign in to comment.