Skip to content

Commit

Permalink
Merge pull request #759 from timopollmeier/sensor-relays
Browse files Browse the repository at this point in the history
Allow "0" or empty credential_id in create_scanner
  • Loading branch information
mattmundell authored Sep 27, 2019
2 parents dbe3ac6 + 416e593 commit 82dc12d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Command cleanup-report-formats for --optimize option [#652](https://github.com/greenbone/gvmd/pull/652)
- Document container tasks in GMP doc [#688](https://github.com/greenbone/gvmd/pull/688)
- Add lean option to GET_REPORTS [#745](https://github.com/greenbone/gvmd/pull/745)
- Add scanner relays and OSP sensor scanner type [#756](https://github.com/greenbone/gvmd/pull/756)
- Add scanner relays and OSP sensor scanner type [#756](https://github.com/greenbone/gvmd/pull/756) [#759](https://github.com/greenbone/gvmd/pull/759)

### Changed
- Check if NVT preferences exist before inserting. [#406](https://github.com/greenbone/gvmd/pull/406)
Expand Down
10 changes: 8 additions & 2 deletions src/manage_sql.c
Original file line number Diff line number Diff line change
Expand Up @@ -42639,7 +42639,11 @@ create_scanner (const char* name, const char *comment, const char *host,
return 1;
}

if (!unix_socket && itype == SCANNER_TYPE_GMP && credential_id == NULL)
if (!unix_socket
&& itype == SCANNER_TYPE_GMP
&& (credential_id == NULL
|| strcmp (credential_id, "") == 0
|| strcmp (credential_id, "0") == 0))
{
sql_rollback ();
return 6;
Expand All @@ -42649,7 +42653,9 @@ create_scanner (const char* name, const char *comment, const char *host,
else
{
credential = 0;
if (credential_id)
if (credential_id
&& strcmp (credential_id, "")
&& strcmp (credential_id, "0"))
{
if (find_credential_with_permission
(credential_id, &credential, "get_credentials"))
Expand Down
6 changes: 6 additions & 0 deletions src/manage_sql_configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2538,6 +2538,8 @@ create_task_check_config_scanner (config_t config, scanner_t scanner)
return 1;
if (ctype == 0 && stype == SCANNER_TYPE_GMP)
return 1;
if (ctype == 0 && stype == SCANNER_TYPE_OSP_SENSOR)
return 1;
if (ctype == 1 && stype == SCANNER_TYPE_OSP)
return 1;

Expand Down Expand Up @@ -2615,6 +2617,10 @@ modify_task_check_config_scanner (task_t task, const char *config_id,
if (stype == SCANNER_TYPE_GMP && ctype == 0)
return 0;

/* OSP Sensor with OpenVAS config. */
if (stype == SCANNER_TYPE_OSP_SENSOR && ctype == 0)
return 0;

/* Default Scanner with OpenVAS Config. */
if (scanner == 0 && ctype == 0)
return 0;
Expand Down

0 comments on commit 82dc12d

Please sign in to comment.