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

Check for opts params in osp_get_performance_ext() #268

Merged
merged 5 commits into from
Sep 26, 2019
Merged
Changes from 1 commit
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
22 changes: 18 additions & 4 deletions osp/osp.c
Original file line number Diff line number Diff line change
Expand Up @@ -462,13 +462,27 @@ osp_delete_scan (osp_connection_t *connection, const char *scan_id)
*/
int
osp_get_performance_ext (osp_connection_t *connection,
osp_get_performance_opts_t opts,
char **graph, char **error)
osp_get_performance_opts_t opts, char **graph,
char **error)
{
entity_t entity;
int rc;
time_t now;

if (!connection)
return 1;
mattmundell marked this conversation as resolved.
Show resolved Hide resolved

time (&now);

if (!opts.titles || !strcmp (opts.titles, "") || opts.start < 0
|| opts.start > now || opts.end < 0 || opts.end > now)
{
if (error)
*error = g_strdup ("Couldn't send get_performance command "
"to scanner. Bad or missing parameters.");
return 1;
}

assert (connection);
rc = osp_send_command (connection, &entity,
"<get_performance start='%d' "
"end='%d' titles='%s'/>",
Expand All @@ -482,7 +496,7 @@ osp_get_performance_ext (osp_connection_t *connection,
}

if (graph && entity_text (entity) && strcmp (entity_text (entity), "\0"))
*graph = g_strdup (entity_text (entity));
*graph = g_strdup (entity_text (entity));
else
{
const char *text = entity_attribute (entity, "status_text");
Expand Down