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

Docs: Add missing code docs #2094

Merged
merged 3 commits into from
Oct 13, 2023
Merged
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
2 changes: 1 addition & 1 deletion src/debug_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

/**
* @brief Initialize Sentry using the current gvmd version and DSN.
*
*
* The DSN is set via the environment variable SENTRY_DSN_GVMD.
*
* @return 1 if sentry support was enabled, 0 if not.
Expand Down
30 changes: 15 additions & 15 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -4136,7 +4136,7 @@ typedef enum
CLIENT_CREATE_REPORT_RR_RESULTS_RESULT_COMMENT,
CLIENT_CREATE_REPORT_RR_RESULTS_RESULT_CREATION_TIME,
CLIENT_CREATE_REPORT_RR_RESULTS_RESULT_DESCRIPTION,

CLIENT_CREATE_REPORT_RR_RESULTS_RESULT_DETECTION,
CLIENT_CREATE_REPORT_RR_RESULTS_RESULT_DETECTION_RESULT,
CLIENT_CREATE_REPORT_RR_RESULTS_RESULT_DETECTION_RESULT_DETAILS,
Expand Down Expand Up @@ -7276,7 +7276,7 @@ gmp_xml_handle_start_element (/* unused */ GMarkupParseContext* context,
set_client_state (
CLIENT_CREATE_REPORT_RR_RESULTS_RESULT_DETECTION_RESULT);
}
ELSE_READ_OVER;
ELSE_READ_OVER;
case CLIENT_CREATE_REPORT_RR_RESULTS_RESULT_DETECTION_RESULT:
if (strcasecmp ("DETAILS", element_name) == 0)
{
Expand Down Expand Up @@ -7714,7 +7714,7 @@ gmp_xml_handle_start_element (/* unused */ GMarkupParseContext* context,
case CLIENT_LOGOUT:
logout_element_start (gmp_parser, element_name,
attribute_names, attribute_values);
break;
break;
case CLIENT_MODIFY_LICENSE:
modify_license_element_start (gmp_parser, element_name,
attribute_names, attribute_values);
Expand Down Expand Up @@ -8201,7 +8201,7 @@ buffer_notes_xml (GString *buffer, iterator_t *notes, int include_notes_details,

while (next (&tags))
{
buffer_xml_append_printf
buffer_xml_append_printf
(buffer,
"<tag id=\"%s\">"
"<name>%s</name>"
Expand Down Expand Up @@ -8485,7 +8485,7 @@ buffer_overrides_xml (GString *buffer, iterator_t *overrides,

while (next (&tags))
{
buffer_xml_append_printf
buffer_xml_append_printf
(buffer,
"<tag id=\"%s\">"
"<name>%s</name>"
Expand Down Expand Up @@ -9278,7 +9278,7 @@ buffer_results_xml (GString *buffer, iterator_t *results, task_t task,

while (next (&tags))
{
buffer_xml_append_printf
buffer_xml_append_printf
(buffer,
"<tag id=\"%s\">"
"<name>%s</name>"
Expand Down Expand Up @@ -15812,7 +15812,7 @@ handle_create_schedule (gmp_parser_t *gmp_parser, GError **error)
SEND_TO_CLIENT_OR_FAIL
("</status_details>");
}
SEND_TO_CLIENT_OR_FAIL
SEND_TO_CLIENT_OR_FAIL
("</create_schedule_response>");
log_event ("schedule", "Schedule", uuid, "created");
free (uuid);
Expand Down Expand Up @@ -21311,7 +21311,7 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context,
log_event_fail ("tag", "Tag", NULL, "created");
break;
case 2:
SEND_TO_CLIENT_OR_FAIL
SEND_TO_CLIENT_OR_FAIL
("<create_tag_response"
" status=\"" STATUS_ERROR_MISSING "\""
" status_text=\"No resources found for filter\"/>");
Expand Down Expand Up @@ -21545,7 +21545,7 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context,
create_target_data->port_list_id,
create_target_data->port_range,
ssh_credential,
ssh_elevate_credential,
ssh_elevate_credential,
create_target_data->ssh_credential_id
? create_target_data->ssh_port
: create_target_data->ssh_lsc_port,
Expand Down Expand Up @@ -22867,7 +22867,7 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context,
ldap_cacert = g_strdup (kvp->value);
else if (strcmp (kvp->key, "ldaps-only") == 0)
ldap_ldaps_only = (strcmp (kvp->value, "true") == 0);

setting = g_slist_next (setting);
}

Expand Down Expand Up @@ -24080,7 +24080,7 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context,
log_event_fail ("tag", "Tag", NULL, "modified");
break;
case 5:
SEND_TO_CLIENT_OR_FAIL
SEND_TO_CLIENT_OR_FAIL
("<modify_tag_response"
" status=\"" STATUS_ERROR_MISSING "\""
" status_text=\"No resources found for filter\"/>");
Expand Down Expand Up @@ -26160,7 +26160,7 @@ gmp_xml_handle_text (/* unused */ GMarkupParseContext* context,
create_report_data->result_detection_source_name)
{

detection_detail_t *detail =
detection_detail_t *detail =
(detection_detail_t*) g_malloc (sizeof (detection_detail_t));
if (detail)
{
Expand All @@ -26170,17 +26170,17 @@ gmp_xml_handle_text (/* unused */ GMarkupParseContext* context,
create_report_data->result_detection_location = NULL;
detail->source_oid = create_report_data->result_detection_source_oid;
create_report_data->result_detection_source_oid = NULL;
detail->source_name = create_report_data->result_detection_source_name;
detail->source_name = create_report_data->result_detection_source_name;
create_report_data->result_detection_source_name = NULL;
array_add(create_report_data->result_detection, detail);
}
}



}
break;

APPEND (CLIENT_CREATE_REPORT_RR_H_DETAIL_NAME,
&create_report_data->detail_name);

Expand Down
22 changes: 11 additions & 11 deletions src/gmp_configs.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,13 +691,13 @@ modify_config_element_start (gmp_parser_t *gmp_parser, const gchar *name,

/**
* @brief Handle basic, single-value fields of modify_config.
*
*
* @param[in] config The config to modify.
* @param[in] name The name to set or NULL to keep old value.
* @param[in] comment The comment to set or NULL to keep old value.
* @param[in] gmp_parser GMP parser.
* @param[out] error GError output.
*
*
* @return 0 on success, -1 on error.
*/
static int
Expand Down Expand Up @@ -736,7 +736,7 @@ modify_config_handle_basic_fields (config_t config,
* @param[out] families_growing_all Array of growing families with all VTs.
* @param[out] families_growing_empty Array of growing, empty families.
* @param[out] families_static_all Array of static families with all VTs.
*
*
* @return 0 on success, -1 on error.
*/
static int
Expand Down Expand Up @@ -788,15 +788,15 @@ modify_config_collect_selection_families (entities_t entities,

/**
* @brief Handles a family selection inside a modify_config command.
*
*
* @param[in] config The config to modify.
* @param[in] families_growing_all Array of growing families with all VTs.
* @param[in] families_growing_empty Array of growing, empty families.
* @param[in] families_static_all Array of static families with all VTs.
* @param[in] family_selection_growing 1 if families should grow, else 0.
* @param[in] gmp_parser The GMP parser.
* @param[out] error GError output.
*
*
* @return 0 on success, -1 on error.
*/
static int
Expand Down Expand Up @@ -939,7 +939,7 @@ modify_config_handle_nvt_selection (config_t config,
* @param[in] value Value to set for the preference.
* @param[in] gmp_parser The GMP parser.
* @param[out] error GError output.
*
*
* @return 0 on success, -1 on error.
*/
static int
Expand All @@ -962,7 +962,7 @@ modify_config_handle_preference (config_t config,
if (nvt_oid)
{
SENDF_TO_CLIENT_OR_FAIL_WITH_RETURN
(-1,
(-1,
XML_ERROR_SYNTAX ("modify_config",
"Empty radio value for preference %s"
" of NVT %s"),
Expand All @@ -972,18 +972,18 @@ modify_config_handle_preference (config_t config,
else
{
SENDF_TO_CLIENT_OR_FAIL_WITH_RETURN
(-1,
(-1,
XML_ERROR_SYNTAX ("modify_config",
"Empty radio value for preference %s"),
nvt_oid);
}
return -1;
case -1:
SENDF_TO_CLIENT_OR_FAIL_WITH_RETURN
SENDF_TO_CLIENT_OR_FAIL_WITH_RETURN
(-1, XML_INTERNAL_ERROR ("modify_config"));
return -1;
default:
SENDF_TO_CLIENT_OR_FAIL_WITH_RETURN
SENDF_TO_CLIENT_OR_FAIL_WITH_RETURN
(-1, XML_INTERNAL_ERROR ("modify_config"));
return -1;
}
Expand Down Expand Up @@ -1024,7 +1024,7 @@ modify_config_run (gmp_parser_t *gmp_parser, GError **error)
"Permission denied"));

// Find the config
switch (manage_modify_config_start (config_id, &config))
switch (manage_modify_config_start (config_id, &config))
{
case 0:
break;
Expand Down
8 changes: 4 additions & 4 deletions src/gmp_license.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ modify_license_element_start (gmp_parser_t *gmp_parser,
* @param[in] allow_empty Whether to allow an empty file.
* @param[out] error_msg The error message of the license update
* if any
*
*
* @return 0 success, 1 service unavailable, 2 empty file not allowed,
* 99 permission denied.
* 99 permission denied.
*/
static int
modify_license (gchar *file_content, gboolean allow_empty, char **error_msg)
Expand Down Expand Up @@ -440,11 +440,11 @@ modify_license_run (gmp_parser_t *gmp_parser,
if (error_msg)
{
SENDF_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("modify_license",
(XML_ERROR_SYNTAX ("modify_license",
"%s"), error_msg);
g_free (error_msg);
}
else
else
{
SENDF_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("modify_license",
Expand Down
10 changes: 9 additions & 1 deletion src/gmp_logout.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@
#include "gmp_logout.h"
#include "manage.h"

/**
* @brief The logout command.
*/
typedef struct
{
context_data_t *context; ///< XML parser context.
} logout_t;

/**
* @brief Parser callback data.
*
* This is initially 0 because it's a global variable.
*/
static logout_t logout_data;

/*
/**
* @brief Reset command data.
*/
static void
Expand Down
2 changes: 1 addition & 1 deletion src/gmp_tls_certificates.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ get_tls_certificates_run (gmp_parser_t *gmp_parser, GError **error)

gchar *extra_xml;

SENDF_TO_CLIENT_OR_FAIL
SENDF_TO_CLIENT_OR_FAIL
("<origin id=\"%s\">"
"<origin_type>%s</origin_type>"
"<origin_id>%s</origin_id>"
Expand Down
21 changes: 11 additions & 10 deletions src/gvmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ fork_feed_sync ()
int pid;
sigset_t sigmask_all, sigmask_current;
gboolean gvmd_data_feed_dirs_exist;

static gboolean disable_gvmd_data_feed_warning = FALSE;

if (feed_version_check_in_progress)
Expand Down Expand Up @@ -1756,13 +1756,13 @@ manager_listen (const char *address_str_unix, const char *address_str_tls,
}

/**
* @brief parse_authentication_goption_arg is used to parse authentication
* @brief parse_authentication_goption_arg is used to parse authentication
* parameter.
*
* @param[in] opt the parameter (e.g. --pepper).
* @param[in] arg the value of the parameter.
* @param[in] data the pointer of the data to set (unused).
* @param[in] err used to set error string on failure.
* @param[in] err used to set error string on failure.
*
* @return TRUE success, FALSE on failure.
**/
Expand Down Expand Up @@ -1814,6 +1814,7 @@ parse_authentication_goption_arg (const gchar *opt, const gchar *arg,
*
* @param[in] argc The number of arguments in argv.
* @param[in] argv The list of arguments to the program.
* @param[in] env The program's environment arguments.
*
* @return EXIT_SUCCESS on success, EXIT_FAILURE on failure.
*/
Expand Down Expand Up @@ -2321,7 +2322,7 @@ gvmd (int argc, char** argv, char *env[])

/* Set feed lock path */
set_feed_lock_path (feed_lock_path);

/* Set feed lock timeout */
set_feed_lock_timeout (feed_lock_timeout);

Expand Down Expand Up @@ -2689,12 +2690,12 @@ gvmd (int argc, char** argv, char *env[])
}
return EXIT_SUCCESS;
}

if (rebuild_gvmd_data)
{
int ret;
gchar *error_msg;

error_msg = NULL;

setproctitle ("--rebuild-gvmd-data");
Expand Down Expand Up @@ -2736,13 +2737,13 @@ gvmd (int argc, char** argv, char *env[])
}
return EXIT_SUCCESS;
}

if (dump_vt_verification)
{
int ret;

setproctitle ("--dump-vt-verification");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;

Expand Down Expand Up @@ -2876,7 +2877,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;
setproctitle ("Creating encryption key");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;

Expand All @@ -2891,7 +2892,7 @@ gvmd (int argc, char** argv, char *env[])
{
int ret;
setproctitle ("Setting encryption key");

if (option_lock (&lockfile_checking))
return EXIT_FAILURE;

Expand Down
Loading