Skip to content

Commit

Permalink
Modified GSAD validator to allow empty string for credential_id
Browse files Browse the repository at this point in the history
  • Loading branch information
saberlynx committed Sep 30, 2019
1 parent c0cab49 commit 4cdb6be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions gsa/src/web/pages/scanners/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ class ScannerDialog extends React.Component {

render() {
const {
ca_pub,
comment = '',
scanner,
ca_pub,
credentials,
host = 'localhost',
id,
Expand All @@ -165,6 +165,8 @@ class ScannerDialog extends React.Component {
onSave,
} = this.props;

let {credential_id} = this.props;

const data = {
ca_pub,
comment,
Expand All @@ -191,8 +193,6 @@ class ScannerDialog extends React.Component {
const isOspSensorType = type === OSP_SENSOR_SCANNER_TYPE;
const isOspScannerType = type === OSP_SCANNER_TYPE;

let {credential_id} = this.props;

if (isOspSensorType) {
credential_id = '';
}
Expand Down
3 changes: 1 addition & 2 deletions gsad/src/gsad_gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -10084,7 +10084,6 @@ create_scanner_gmp (gvm_connection_t *connection, credentials_t *credentials,
CHECK_VARIABLE_INVALID (type, "Create Scanner");
if (params_given (params, "ca_pub"))
CHECK_VARIABLE_INVALID (ca_pub, "Create Scanner");
CHECK_VARIABLE_INVALID (credential_id, "Create Scanner");

if (ca_pub)
ret = gmpf (connection, credentials, &response, &entity, response_data,
Expand All @@ -10102,7 +10101,7 @@ create_scanner_gmp (gvm_connection_t *connection, credentials_t *credentials,
"<host>%s</host><port>%s</port><type>%s</type>"
"<credential id=\"%s\"/>"
"</create_scanner>",
name, comment, host, port, type, credential_id);
name, comment, host, port, type, credential_id ? credential_id : "");
switch (ret)
{
case 0:
Expand Down

0 comments on commit 4cdb6be

Please sign in to comment.