Skip to content

Commit

Permalink
Merge branch 'main' into code-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattmundell authored Dec 19, 2023
2 parents 2e07462 + b86b69a commit 29fc62f
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: C
# build between init and analyze ...
Expand All @@ -37,4 +37,4 @@ jobs:
cmake -DCMAKE_BUILD_TYPE=Debug ..
make install
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
5 changes: 3 additions & 2 deletions src/gsad.c
Original file line number Diff line number Diff line change
Expand Up @@ -1499,10 +1499,11 @@ exec_gmp_get (http_connection_t *con, gsad_connection_info_t *con_info,
ELSE (get_port_lists)
ELSE (get_report)
ELSE (get_reports)
ELSE (get_result)
ELSE (get_results)
ELSE (get_report_format)
ELSE (get_report_formats)
ELSE (get_resource_names)
ELSE (get_result)
ELSE (get_results)
ELSE (get_role)
ELSE (get_roles)
ELSE (get_scanner)
Expand Down
30 changes: 30 additions & 0 deletions src/gsad_gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -10714,6 +10714,36 @@ save_report_format_gmp (gvm_connection_t *connection,
return html;
}

/**
* @brief Get resource names, envelope the result.
*
* @param[in] connection Connection to manager.
* @param[in] credentials Username and password for authentication.
* @param[in] params Request parameters.
* @param[out] response_data Extra data return for the HTTP response.
*
* @return Enveloped XML object.
*/
char *
get_resource_names_gmp (gvm_connection_t *connection,
credentials_t *credentials, params_t *params,
cmd_response_data_t *response_data)
{
const gchar *type;
gmp_arguments_t *arguments;

type = params_value (params, "resource_type");

CHECK_VARIABLE_INVALID (type, "Get Resource Names");

arguments = gmp_arguments_new ();

gmp_arguments_add (arguments, "type", type);

return get_many (connection, "resource_names", credentials, params, arguments,
response_data);
}

/**
* @brief Run a wizard and envelope the result.
*
Expand Down
4 changes: 4 additions & 0 deletions src/gsad_gmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,10 @@ char *
save_report_format_gmp (gvm_connection_t *, credentials_t *, params_t *,
cmd_response_data_t *);

char *
get_resource_names_gmp (gvm_connection_t *, credentials_t *, params_t *,
cmd_response_data_t *);

char *
get_feeds_gmp (gvm_connection_t *, credentials_t *, params_t *,
cmd_response_data_t *);
Expand Down
2 changes: 2 additions & 0 deletions src/gsad_validator.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ init_validator ()
"|(get_reports)"
"|(get_report_format)"
"|(get_report_formats)"
"|(get_resource_names)"
"|(get_result)"
"|(get_results)"
"|(get_role)"
Expand Down Expand Up @@ -429,6 +430,7 @@ init_validator ()
"^(summary|results|hosts|ports"
"|closed_cves|os|apps|errors"
"|topology|ssl_certs|cves)$");
gvm_validator_add (validator, "resource_type", "(?s)^.*$");
gvm_validator_add (validator, "result_id", "^[a-z0-9\\-]+$");
gvm_validator_add (validator, "role", "^[[:alnum:] ]+$");
gvm_validator_add (validator, "permission", "^([_a-z]+|Super)$");
Expand Down

0 comments on commit 29fc62f

Please sign in to comment.