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

Add: Use GMP GET_FEATURES in get_capabilities_gmp #177

Merged
merged 1 commit into from
Jul 2, 2024
Merged
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
45 changes: 44 additions & 1 deletion src/gsad_gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -17531,6 +17531,7 @@
entity_t entity = NULL;
GString *xml;

/* Get commands available to current user */
if (gvm_connection_sendf (connection,
"<help format=\"XML\" type=\"brief\"/>"))
{
Expand Down Expand Up @@ -17574,9 +17575,51 @@
return message;
}

/* Cleanup, and return transformed XML. */
/* Cleanup. */
free_entity (entity);

/* Get features list */
if (gvm_connection_sendf (connection, "<get_features/>"))
{
cmd_response_data_set_status_code (response_data,

Check warning on line 17584 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L17584

Added line #L17584 was not covered by tests
MHD_HTTP_INTERNAL_SERVER_ERROR);
g_string_free (xml, TRUE);
return gsad_message (

Check warning on line 17587 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L17586-L17587

Added lines #L17586 - L17587 were not covered by tests
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting the features list. "
"Diagnostics: Failure to send command to manager daemon.",
response_data);
}

/* Read the response. */
if (read_entity_and_string_c (connection, &entity, &xml))
{
g_string_free (xml, TRUE);
cmd_response_data_set_status_code (response_data,

Check warning on line 17598 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L17597-L17598

Added lines #L17597 - L17598 were not covered by tests
MHD_HTTP_INTERNAL_SERVER_ERROR);
return gsad_message (

Check warning on line 17600 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L17600

Added line #L17600 was not covered by tests
credentials, "Internal error", __func__, __LINE__,
"An internal error occurred while getting the feature list. "
"Diagnostics: Failure to receive response from manager daemon.",
response_data);
}

if (gmp_success (entity) != 1)
{
gchar *message;

set_http_status_from_entity (entity, response_data);

Check warning on line 17611 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L17611

Added line #L17611 was not covered by tests

message =
gsad_message (credentials, "Error", __func__, __LINE__,

Check warning on line 17614 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L17614

Added line #L17614 was not covered by tests
entity_attribute (entity, "status_text"), response_data);

g_string_free (xml, TRUE);
free_entity (entity);
return message;

Check warning on line 17619 in src/gsad_gmp.c

View check run for this annotation

Codecov / codecov/patch

src/gsad_gmp.c#L17617-L17619

Added lines #L17617 - L17619 were not covered by tests
}

/* Return transformed XML. */
g_string_append (xml, "</get_capabilities>");
return envelope_gmp (connection, credentials, params,
g_string_free (xml, FALSE), response_data);
Expand Down
Loading