Skip to content
Open
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
36 changes: 36 additions & 0 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -29773,6 +29773,42 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context,
return;
}
break;
case 10: /* Internal error */
g_warning ("Internal error while sending command");
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("stop_task",
"Internal error while sending command"));
log_event_fail ("task", "Task",
stop_task_data->task_id,
"stopped");
break;
case 20: /* Sending command timed out */
g_warning ("Sending command timed out");
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("stop_task",
"Sending command timed out"));
log_event_fail ("task", "Task",
stop_task_data->task_id,
"stopped");
break;
case 30: /* Reading command response timed out */
g_warning ("Reading command response timed out");
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("stop_task",
"Reading command response timed out"));
log_event_fail ("task", "Task",
stop_task_data->task_id,
"stopped");
break;
case 40: /* Problem deleting scan from scanner */
g_warning ("Problem deleting scan from scanner");
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("stop_task",
"Problem deleting scan from scanner"));
log_event_fail ("task", "Task",
stop_task_data->task_id,
"stopped");
break;
case 99:
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("stop_task",
Expand Down
8 changes: 4 additions & 4 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -2334,6 +2334,8 @@ stop_osp_task (task_t task)
if (!connection)
goto end_stop_osp;
ret = osp_delete_scan (connection, scan_id);
if (ret)
ret = 4;
osp_connection_close (connection);

end_stop_osp:
Expand All @@ -2347,9 +2349,7 @@ stop_osp_task (task_t task)
}
current_scanner_task = previous_task;
global_current_report = previous_report;
if (ret)
return -1;
return 0;
return ret;
}

/**
Expand Down Expand Up @@ -2414,7 +2414,7 @@ stop_task (const char *task_id)

if (scanner_type (task_scanner (task)) == SCANNER_TYPE_OPENVAS
|| scanner_type (task_scanner (task)) == SCANNER_TYPE_OSP_SENSOR)
return stop_osp_task (task);
return stop_osp_task (task) * 10;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we have enough return codes for stop_task where using an enum and a small helper function that maps the return values from stop_osp_task would make things more readable.


#if ENABLE_OPENVASD
if (scanner_type (task_scanner (task)) == SCANNER_TYPE_OPENVASD
Expand Down
2 changes: 2 additions & 0 deletions src/manage_sql_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,8 @@ columns_select_column_single (column_t *select_columns,
*type = KEYWORD_TYPE_UNKNOWN;
if (select_columns == NULL)
return NULL;
if (filter_column == NULL)
return NULL;
Comment on lines +869 to +870

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This appears to be unrelated to the error handler improvements.

columns = select_columns;
while ((*columns).select)
{
Expand Down
Loading