OpenVAS Manager
7.0.3~git
|
The OpenVAS Manager OMP library. More...
#include "omp.h"
#include "manage.h"
#include "manage_acl.h"
#include "otp.h"
#include <arpa/inet.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <glib/gstdio.h>
#include <math.h>
#include <netinet/in.h>
#include <string.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <gnutls/x509.h>
#include <openvas/base/nvti.h>
#include <openvas/osp/osp.h>
#include <openvas/base/openvas_string.h>
#include <openvas/base/openvas_file.h>
#include <openvas/base/pwpolicy.h>
#include <openvas/misc/openvas_auth.h>
#include <openvas/misc/openvas_logging.h>
#include <openvas/misc/openvas_ssh.h>
#include <openvas/omp/xml.h>
Go to the source code of this file.
Data Structures | |
struct | auth_conf_setting_t |
A simple key/value-pair. More... | |
struct | omp_parser_t |
A handle on an OMP parser. More... | |
struct | create_agent_data_t |
Command data for the create_agent command. More... | |
struct | create_asset_data_t |
Command data for the create_asset command. More... | |
struct | import_config_data_t |
Command data for the import part of the create_config command. More... | |
struct | create_config_data_t |
Command data for the create_config command. More... | |
struct | create_alert_data_t |
Command data for the create_alert command. More... | |
struct | create_credential_data_t |
Command data for the create_credential command. More... | |
struct | create_filter_data_t |
Command data for the create_filter command. More... | |
struct | create_group_data_t |
Command data for the create_group command. More... | |
struct | create_note_data_t |
Command data for the create_note command. More... | |
struct | create_override_data_t |
Command data for the create_override command. More... | |
struct | create_permission_data_t |
Command data for the create_permission command. More... | |
struct | create_port_list_range |
A port range. More... | |
struct | create_port_list_data_t |
Command data for the create_port_list command. More... | |
struct | create_port_range_data_t |
Command data for the create_port_range command. More... | |
struct | create_report_data_t |
Command data for the create_report command. More... | |
struct | create_report_format_data_t |
Command data for the create_report_format command. More... | |
struct | create_role_data_t |
Command data for the create_role command. More... | |
struct | create_scanner_data_t |
Command data for the create_scanner command. More... | |
struct | create_schedule_data_t |
Command data for the create_schedule command. More... | |
struct | create_target_data_t |
Command data for the create_target command. More... | |
struct | create_tag_data_t |
Command data for the create_tag command. More... | |
struct | create_task_data_t |
Command data for the create_task command. More... | |
struct | create_user_data_t |
struct | delete_agent_data_t |
Command data for the delete_agent command. More... | |
struct | delete_asset_data_t |
Command data for the delete_asset command. More... | |
struct | delete_config_data_t |
Command data for the delete_config command. More... | |
struct | delete_alert_data_t |
Command data for the delete_alert command. More... | |
struct | delete_credential_data_t |
Command data for the delete_credential command. More... | |
struct | delete_filter_data_t |
Command data for the delete_filter command. More... | |
struct | delete_group_data_t |
Command data for the delete_group command. More... | |
struct | delete_note_data_t |
Command data for the delete_note command. More... | |
struct | delete_override_data_t |
Command data for the delete_override command. More... | |
struct | delete_permission_data_t |
Command data for the delete_permission command. More... | |
struct | delete_port_list_data_t |
Command data for the delete_port_list command. More... | |
struct | delete_port_range_data_t |
Command data for the delete_port_range command. More... | |
struct | delete_report_data_t |
Command data for the delete_report command. More... | |
struct | delete_report_format_data_t |
Command data for the delete_report_format command. More... | |
struct | delete_role_data_t |
Command data for the delete_role command. More... | |
struct | delete_schedule_data_t |
Command data for the delete_schedule command. More... | |
struct | delete_scanner_data_t |
Command data for the delete_scanner command. More... | |
struct | delete_tag_data_t |
Command data for the delete_tag command. More... | |
struct | delete_target_data_t |
Command data for the delete_target command. More... | |
struct | delete_task_data_t |
Command data for the delete_task command. More... | |
struct | delete_user_data_t |
Command data for the delete_user command. More... | |
struct | get_feeds_data_t |
Command data for the get_feeds command. More... | |
struct | get_agents_data_t |
Command data for the get_agents command. More... | |
struct | get_aggregates_data_t |
Command data for the get_aggregates command. More... | |
struct | get_assets_data_t |
Command data for the get_assets command. More... | |
struct | get_configs_data_t |
Command data for the get_configs command. More... | |
struct | get_alerts_data_t |
Command data for the get_alerts command. More... | |
struct | get_credentials_data_t |
Command data for the get_credentials command. More... | |
struct | get_filters_data_t |
Command data for the get_filters command. More... | |
struct | get_groups_data_t |
Command data for the get_groups command. More... | |
struct | get_info_data_t |
Command data for the get_info command. More... | |
struct | get_notes_data_t |
Command data for the get_notes command. More... | |
struct | get_nvts_data_t |
Command data for the get_nvts command. More... | |
struct | get_nvt_families_data_t |
Command data for the get_nvt_families command. More... | |
struct | get_overrides_data_t |
Command data for the get_overrides command. More... | |
struct | get_permissions_data_t |
Command data for the get_permissions command. More... | |
struct | get_port_lists_data_t |
Command data for the get_port_lists command. More... | |
struct | get_preferences_data_t |
Command data for the get_preferences command. More... | |
struct | get_reports_data_t |
Command data for the get_reports command. More... | |
struct | get_report_formats_data_t |
Command data for the get_report_formats command. More... | |
struct | get_results_data_t |
Command data for the get_results command. More... | |
struct | get_roles_data_t |
Command data for the get_roles command. More... | |
struct | get_schedules_data_t |
Command data for the get_schedules command. More... | |
struct | get_scanners_data_t |
Command data for the get_scanners command. More... | |
struct | get_settings_data_t |
Command data. More... | |
struct | get_system_reports_data_t |
Command data for the get_system_reports command. More... | |
struct | get_tags_data_t |
Command data for the get_tags command. More... | |
struct | get_targets_data_t |
Command data for the get_targets command. More... | |
struct | get_users_data_t |
Command data for the get_users command. More... | |
struct | modify_config_data_t |
Command data for the modify_config command. More... | |
struct | get_tasks_data_t |
Command data for the get_tasks command. More... | |
struct | help_data_t |
Command data for the help command. More... | |
struct | modify_agent_data_t |
Command data for the modify_agent command. More... | |
struct | modify_alert_data_t |
Command data for the modify_alert command. More... | |
struct | modify_asset_data_t |
Command data for the modify_asset command. More... | |
struct | auth_group_t |
Authentication method settings. More... | |
struct | modify_auth_data_t |
Command data for the modify_auth command. More... | |
struct | modify_credential_data_t |
Command data for the modify_credential command. More... | |
struct | modify_filter_data_t |
Command data for the modify_filter command. More... | |
struct | modify_group_data_t |
Command data for the modify_group command. More... | |
struct | modify_permission_data_t |
Command data for the modify_permission command. More... | |
struct | modify_port_list_data_t |
Command data for the modify_port_list command. More... | |
struct | modify_report_data_t |
Command data for the modify_report command. More... | |
struct | modify_report_format_data_t |
Command data for the modify_report_format command. More... | |
struct | modify_role_data_t |
Command data for the modify_role command. More... | |
struct | modify_scanner_data_t |
Command data for the modify_scanner command. More... | |
struct | modify_schedule_data_t |
Command data for the modify_schedule command. More... | |
struct | modify_tag_data_t |
Command data for the modify_tag command. More... | |
struct | modify_setting_data_t |
Command data for the modify_setting command. More... | |
struct | modify_target_data_t |
Command data for the modify_target command. More... | |
struct | modify_task_data_t |
Command data for the modify_task command. More... | |
struct | modify_note_data_t |
Command data for the modify_note command. More... | |
struct | modify_override_data_t |
Command data for the modify_override command. More... | |
struct | modify_user_data_t |
Command data for the modify_user command. More... | |
struct | move_task_data_t |
Command data for the move_task command. More... | |
struct | restore_data_t |
Command data for the restore command. More... | |
struct | resume_task_data_t |
Command data for the resume_task command. More... | |
struct | start_task_data_t |
Command data for the start_task command. More... | |
struct | stop_task_data_t |
Command data for the stop_task command. More... | |
struct | sync_config_data_t |
Command data for the modify_target command. More... | |
struct | test_alert_data_t |
Command data for the test_alert command. More... | |
struct | verify_agent_data_t |
Command data for the verify_agent command. More... | |
struct | verify_report_format_data_t |
Command data for the verify_report_format command. More... | |
struct | verify_scanner_data_t |
Command data for the verify_scanner command. More... | |
struct | run_wizard_data_t |
Command data for the wizard command. More... | |
union | command_data_t |
Command data, as passed between OMP parser callbacks. More... | |
struct | count_data_t |
Helper data structure for word counts. More... | |
struct | buffer_counts_data_t |
Helper data structure for buffering word counts. More... | |
Macros | |
#define | G_LOG_DOMAIN "md omp" |
GLib log domain. More... | |
#define | STATUS_ERROR_SYNTAX "400" |
Response code for a syntax error. More... | |
#define | STATUS_ERROR_MUST_AUTH "401" |
Response code when authorisation is required. More... | |
#define | STATUS_ERROR_MUST_AUTH_TEXT "Authenticate first" |
Response code when authorisation is required. More... | |
#define | STATUS_ERROR_ACCESS "403" |
Response code for forbidden access. More... | |
#define | STATUS_ERROR_ACCESS_TEXT "Access to resource forbidden" |
Response code text for forbidden access. More... | |
#define | STATUS_ERROR_MISSING "404" |
Response code for a missing resource. More... | |
#define | STATUS_ERROR_MISSING_TEXT "Resource missing" |
Response code text for a missing resource. More... | |
#define | STATUS_ERROR_BUSY "409" |
Response code for a busy resource. More... | |
#define | STATUS_ERROR_BUSY_TEXT "Resource busy" |
Response code text for a busy resource. More... | |
#define | STATUS_ERROR_AUTH_FAILED "400" |
Response code when authorisation failed. More... | |
#define | STATUS_ERROR_AUTH_FAILED_TEXT "Authentication failed" |
Response code text when authorisation failed. More... | |
#define | STATUS_OK "200" |
Response code on success. More... | |
#define | STATUS_OK_TEXT "OK" |
Response code text on success. More... | |
#define | STATUS_OK_CREATED "201" |
Response code on success, when a resource is created. More... | |
#define | STATUS_OK_CREATED_TEXT "OK, resource created" |
Response code on success, when a resource is created. More... | |
#define | STATUS_OK_REQUESTED "202" |
Response code on success, when the operation will finish later. More... | |
#define | STATUS_OK_REQUESTED_TEXT "OK, request submitted" |
Response code text on success, when the operation will finish later. More... | |
#define | STATUS_INTERNAL_ERROR "500" |
Response code for an internal error. More... | |
#define | STATUS_INTERNAL_ERROR_TEXT "Internal error" |
Response code text for an internal error. More... | |
#define | STATUS_SERVICE_UNAVAILABLE "503" |
Response code when a service is unavailable. More... | |
#define | STATUS_SERVICE_DOWN "503" |
Response code when a service is down. More... | |
#define | STATUS_SERVICE_DOWN_TEXT "Service temporarily down" |
Response code text when a service is down. More... | |
#define | XML_ERROR_SYNTAX(tag, text) |
Expand to XML for a STATUS_ERROR_SYNTAX response. More... | |
#define | XML_ERROR_ACCESS(tag) |
Expand to XML for a STATUS_ERROR_ACCESS response. More... | |
#define | XML_ERROR_UNAVAILABLE(tag, text) |
Expand to XML for a STATUS_SERVICE_UNAVAILABLE response. More... | |
#define | XML_ERROR_MISSING(tag) |
Expand to XML for a STATUS_ERROR_MISSING response. More... | |
#define | XML_ERROR_AUTH_FAILED(tag) |
Expand to XML for a STATUS_ERROR_AUTH_FAILED response. More... | |
#define | XML_ERROR_BUSY(tag) |
Expand to XML for a STATUS_ERROR_BUSY response. More... | |
#define | XML_OK(tag) |
Expand to XML for a STATUS_OK response. More... | |
#define | XML_OK_CREATED(tag) |
Expand to XML for a STATUS_OK_CREATED response. More... | |
#define | XML_OK_CREATED_ID(tag) |
Expand to XML for a STATUS_OK_CREATED response with s for ID. More... | |
#define | XML_OK_REQUESTED(tag) |
Expand to XML for a STATUS_OK_REQUESTED response. More... | |
#define | XML_INTERNAL_ERROR(tag) |
Expand to XML for a STATUS_INTERNAL_ERROR response. More... | |
#define | SEND_XML_SERVICE_DOWN(tag) |
Sends XML for a STATUS_SERVICE_DOWN response. More... | |
#define | ELSE_ERROR(op) |
Insert else clause for omp_xml_handle_start_element. More... | |
#define | ELSE_ERROR_CREATE_TASK() |
Insert else clause for omp_xml_handle_start_element in create_task. More... | |
#define | CLOSE(parent, element) |
Insert else clause for omp_xml_handle_start_element. More... | |
#define | CLOSE_READ_OVER(parent, element) |
Insert else clause for omp_xml_handle_start_element. More... | |
#define | CASE_DELETE(upper, type, capital) |
Insert DELETE case for omp_xml_handle_end_element. More... | |
#define | INIT_GET(type, capital) |
Call init_get for a GET end handler. More... | |
#define | APPEND(state, dest) |
Append text to a var for a case in omp_xml_hand_text. More... | |
Typedefs | |
typedef struct create_port_list_range | create_port_list_range_t |
Port range type. More... | |
Functions | |
void | buffer_results_xml (GString *buffer, iterator_t *results, task_t task, int include_notes, int include_notes_details, int include_overrides, int include_overrides_details, int include_tags, int include_tags_details, int include_details, const char *delta_state, iterator_t *delta_results, int changed) |
Buffer XML for some results. More... | |
int | find_attribute (const gchar **attribute_names, const gchar **attribute_values, const char *attribute_name, const gchar **attribute_value) |
Find an attribute in a parser callback list of attributes. More... | |
int | append_attribute (const gchar **attribute_names, const gchar **attribute_values, const char *attribute_name, gchar **string) |
Find an attribute in a parser callback list of attributes and append. More... | |
int | init_get (gchar *command, get_data_t *get, const gchar *setting_name, int *first) |
Init for a GET handler. More... | |
omp_parser_t * | omp_parser_new (int(*write_to_client)(const char *, void *), void *write_to_client_data, gchar **disable) |
Create an OMP parser. More... | |
void | omp_parser_free (omp_parser_t *omp_parser) |
Free an OMP parser. More... | |
void | get_data_reset (get_data_t *data) |
Reset command data. More... | |
void | modify_auth_data_reset (modify_auth_data_t *data) |
Reset command data. More... | |
void | buffer_config_preference_xml (GString *buffer, iterator_t *prefs, config_t config, int hide_passwords) |
Buffer XML for the NVT preference of a config. More... | |
gchar * | strdiff (const gchar *one, const gchar *two) |
Compare two string with the "diff" command. More... | |
void | init_aggregate_lists (const gchar *group_column, const gchar *subgroup_column, GList *data_column_list, GList *text_column_list, GList *sort_data_list, gchar **group_column_type, gchar **subgroup_column_type, GArray **data_column_types, GArray **data_columns, GArray **text_column_types, GArray **text_columns, GArray **sort_data, GArray **c_sums) |
Initialize lists for aggregates. More... | |
void | buffer_aggregate_wc_xml (GString *xml, iterator_t *aggregate, const gchar *type, const char *group_column, GArray *sort_data, int first_group, int max_groups) |
Count words of an aggregate and buffer as XML. More... | |
void | buffer_aggregate_xml (GString *xml, iterator_t *aggregate, const gchar *type, const char *group_column, const char *group_column_type, const char *subgroup_column, const char *subgroup_column_type, GArray *data_columns, GArray *data_column_types, GArray *text_columns, GArray *text_column_types, GArray *c_sums) |
Buffer XML for an aggregate. More... | |
char * | get_ovaldi_files () |
Get list of ovaldi definitions files using the values in ovaldefs table in scap.db. More... | |
int | init_omp (GSList *log_config, int nvt_cache_mode, const gchar *database, int max_ips_per_target, int max_email_attachment_size, int max_email_include_size, int max_email_message_size, void(*progress)(), int(*fork_connection)(openvas_connection_t *, gchar *), int skip_db_check) |
Initialise OMP library. More... | |
void | init_omp_process (int update_nvt_cache, const gchar *database, int(*write_to_client)(const char *, void *), void *write_to_client_data, gchar **disable) |
Initialise OMP library data for a process. More... | |
int | process_omp_client_input () |
Process any XML available in from_client. More... | |
int | process_omp_write (const char *msg, void *buffer) |
Buffer the response for process_omp. More... | |
int | process_omp_change () |
Deal with any changes caused by other processes. More... | |
The OpenVAS Manager OMP library.
This file defines an OpenVAS Management Protocol (OMP) library, for implementing OpenVAS managers such as the OpenVAS Manager daemon.
The library provides process_omp_client_input. This function parses a given string of OMP XML and tracks and manipulates tasks in reaction to the OMP commands in the string.
Definition in file omp.c.
#define APPEND | ( | state, | |
dest | |||
) |
#define CASE_DELETE | ( | upper, | |
type, | |||
capital | |||
) |
#define CLOSE | ( | parent, | |
element | |||
) |
#define CLOSE_READ_OVER | ( | parent, | |
element | |||
) |
Insert else clause for omp_xml_handle_start_element.
Stop the parser from reading over elements at the same time.
[in] | parent | Parent element. |
[in] | element | Element. |
#define ELSE_ERROR | ( | op | ) |
Insert else clause for omp_xml_handle_start_element.
[in] | op | Operation. |
#define ELSE_ERROR_CREATE_TASK | ( | ) |
Insert else clause for omp_xml_handle_start_element in create_task.
#define G_LOG_DOMAIN "md omp" |
#define INIT_GET | ( | type, | |
capital | |||
) |
Call init_get for a GET end handler.
[in] | type | Resource type. |
[in] | capital | Resource type, capitalised. |
#define SEND_XML_SERVICE_DOWN | ( | tag | ) |
Sends XML for a STATUS_SERVICE_DOWN response.
tag | Name of the command generating the response. |
#define STATUS_ERROR_ACCESS "403" |
#define STATUS_ERROR_ACCESS_TEXT "Access to resource forbidden" |
#define STATUS_ERROR_AUTH_FAILED "400" |
#define STATUS_ERROR_AUTH_FAILED_TEXT "Authentication failed" |
#define STATUS_ERROR_BUSY "409" |
#define STATUS_ERROR_BUSY_TEXT "Resource busy" |
#define STATUS_ERROR_MISSING "404" |
#define STATUS_ERROR_MISSING_TEXT "Resource missing" |
#define STATUS_ERROR_MUST_AUTH "401" |
#define STATUS_ERROR_MUST_AUTH_TEXT "Authenticate first" |
#define STATUS_ERROR_SYNTAX "400" |
#define STATUS_INTERNAL_ERROR "500" |
#define STATUS_INTERNAL_ERROR_TEXT "Internal error" |
#define STATUS_OK_CREATED "201" |
#define STATUS_OK_CREATED_TEXT "OK, resource created" |
#define STATUS_OK_REQUESTED "202" |
#define STATUS_OK_REQUESTED_TEXT "OK, request submitted" |
#define STATUS_SERVICE_DOWN "503" |
#define STATUS_SERVICE_DOWN_TEXT "Service temporarily down" |
#define STATUS_SERVICE_UNAVAILABLE "503" |
#define XML_ERROR_ACCESS | ( | tag | ) |
Expand to XML for a STATUS_ERROR_ACCESS response.
tag | Name of the command generating the response. |
#define XML_ERROR_AUTH_FAILED | ( | tag | ) |
Expand to XML for a STATUS_ERROR_AUTH_FAILED response.
tag | Name of the command generating the response. |
#define XML_ERROR_BUSY | ( | tag | ) |
Expand to XML for a STATUS_ERROR_BUSY response.
tag | Name of the command generating the response. |
#define XML_ERROR_MISSING | ( | tag | ) |
Expand to XML for a STATUS_ERROR_MISSING response.
tag | Name of the command generating the response. |
#define XML_ERROR_SYNTAX | ( | tag, | |
text | |||
) |
Expand to XML for a STATUS_ERROR_SYNTAX response.
tag | Name of the command generating the response. |
text | Text for the status_text attribute of the response. |
#define XML_ERROR_UNAVAILABLE | ( | tag, | |
text | |||
) |
Expand to XML for a STATUS_SERVICE_UNAVAILABLE response.
tag | Name of the command generating the response. |
text | Status text. |
#define XML_INTERNAL_ERROR | ( | tag | ) |
Expand to XML for a STATUS_INTERNAL_ERROR response.
tag | Name of the command generating the response. |
#define XML_OK | ( | tag | ) |
Expand to XML for a STATUS_OK response.
tag | Name of the command generating the response. |
#define XML_OK_CREATED | ( | tag | ) |
Expand to XML for a STATUS_OK_CREATED response.
tag | Name of the command generating the response. |
#define XML_OK_CREATED_ID | ( | tag | ) |
Expand to XML for a STATUS_OK_CREATED response with s for ID.
tag | Name of the command generating the response. |
#define XML_OK_REQUESTED | ( | tag | ) |
Expand to XML for a STATUS_OK_REQUESTED response.
tag | Name of the command generating the response. |
typedef struct create_port_list_range create_port_list_range_t |
enum client_state_t |
Possible states of the client.
Definition at line 5022 of file omp.c.
int append_attribute | ( | const gchar ** | attribute_names, |
const gchar ** | attribute_values, | ||
const char * | attribute_name, | ||
gchar ** | string | ||
) |
Find an attribute in a parser callback list of attributes and append.
it to a string using openvas_append_string.
[in] | attribute_names | List of names. |
[in] | attribute_values | List of values. |
[in] | attribute_name | Name of sought attribute. |
[out] | string | String to append attribute value to, if found. |
Definition at line 361 of file omp.c.
References find_attribute().
void buffer_aggregate_wc_xml | ( | GString * | xml, |
iterator_t * | aggregate, | ||
const gchar * | type, | ||
const char * | group_column, | ||
GArray * | sort_data, | ||
int | first_group, | ||
int | max_groups | ||
) |
Count words of an aggregate and buffer as XML.
[in] | xml | Buffer into which to buffer aggregate. |
[in] | aggregate | The aggregate iterator. |
[in] | type | The aggregated type. |
[in] | group_column | Column the data are grouped by. |
[in] | sort_data | Sort data. |
[in] | first_group | Index of the first word to output, starting at 0. |
[in] | max_groups | Maximum number of words to output or -1 for all. |
Definition at line 12125 of file omp.c.
References sort_data_t::order, and sort_data_t::stat.
void buffer_aggregate_xml | ( | GString * | xml, |
iterator_t * | aggregate, | ||
const gchar * | type, | ||
const char * | group_column, | ||
const char * | group_column_type, | ||
const char * | subgroup_column, | ||
const char * | subgroup_column_type, | ||
GArray * | data_columns, | ||
GArray * | data_column_types, | ||
GArray * | text_columns, | ||
GArray * | text_column_types, | ||
GArray * | c_sums | ||
) |
Buffer XML for an aggregate.
[in] | xml | Buffer into which to buffer aggregate. |
[in] | aggregate | The aggregate iterator. |
[in] | type | The aggregated type. |
[in] | group_column | Column the data are grouped by. |
[in] | group_column_type | Type of the group_column. |
[in] | subgroup_column | Column the data are further grouped by. |
[in] | subgroup_column_type | |
[in] | data_columns | Columns statistics are calculated for. |
[in] | data_column_types | Types of the data_columns. |
[in] | text_columns | Columns used for labels. |
[in] | text_column_types | Types of the text_columns. |
[in] | c_sums | Array for calculating cumulative sums. |
Definition at line 12341 of file omp.c.
References aggregate_iterator_count(), aggregate_iterator_max(), aggregate_iterator_mean(), aggregate_iterator_min(), aggregate_iterator_subgroup_value(), aggregate_iterator_sum(), aggregate_iterator_text(), aggregate_iterator_value(), column_is_timestamp(), iso_time(), and next().
void buffer_config_preference_xml | ( | GString * | buffer, |
iterator_t * | prefs, | ||
config_t | config, | ||
int | hide_passwords | ||
) |
Buffer XML for the NVT preference of a config.
[in] | buffer | Buffer. |
[in] | prefs | NVT preference iterator. |
[in] | config | Config. |
[in] | hide_passwords | Whether to hide passwords. |
Definition at line 11120 of file omp.c.
References nvt_oid(), nvt_preference_iterator_config_value(), nvt_preference_iterator_nvt(), nvt_preference_iterator_real_name(), nvt_preference_iterator_type(), nvt_preference_iterator_value(), and create_port_list_range::type.
void buffer_results_xml | ( | GString * | buffer, |
iterator_t * | results, | ||
task_t | task, | ||
int | include_notes, | ||
int | include_notes_details, | ||
int | include_overrides, | ||
int | include_overrides_details, | ||
int | include_tags, | ||
int | include_tags_details, | ||
int | include_details, | ||
const char * | delta_state, | ||
iterator_t * | delta_results, | ||
int | changed | ||
) |
Buffer XML for some results.
[in] | buffer | Buffer into which to buffer results. |
[in] | results | Result iterator. |
[in] | task | Task associated with results. Only needed with include_notes or include_overrides. |
[in] | include_notes | Whether to include notes. |
[in] | include_notes_details | Whether to include details of notes. |
[in] | include_overrides | Whether to include overrides. |
[in] | include_overrides_details | Whether to include details of overrides. |
[in] | include_tags | Whether to include user tag count. |
[in] | include_tags_details | Whether to include details of tags. |
[in] | include_details | Whether to include details of the result. |
[in] | delta_state | Delta state of result, or NULL. |
[in] | delta_results | Iterator for delta result to include, or NULL. |
[in] | changed | Whether the result is a "changed" delta. |
Definition at line 11579 of file omp.c.
References create_port_list_range::comment, result_iterator_descr(), result_iterator_qod(), result_iterator_qod_type(), and result_iterator_result().
int find_attribute | ( | const gchar ** | attribute_names, |
const gchar ** | attribute_values, | ||
const char * | attribute_name, | ||
const gchar ** | attribute_value | ||
) |
Find an attribute in a parser callback list of attributes.
[in] | attribute_names | List of names. |
[in] | attribute_values | List of values. |
[in] | attribute_name | Name of sought attribute. |
[out] | attribute_value | Attribute value return. |
Definition at line 332 of file omp.c.
Referenced by append_attribute().
void get_data_reset | ( | get_data_t * | data | ) |
Reset command data.
[in] | data | Command data. |
Definition at line 2322 of file omp.c.
References get_data_t::filt_id, get_data_t::filter, get_data_t::filter_replace, get_data_t::filter_replacement, get_data_t::id, get_data_t::subtype, and get_data_t::type.
char* get_ovaldi_files | ( | ) |
Get list of ovaldi definitions files using the values in ovaldefs table in scap.db.
Definition at line 13188 of file omp.c.
References cleanup_iterator(), init_ovaldi_file_iterator(), next(), and ovaldi_file_iterator_name().
void init_aggregate_lists | ( | const gchar * | group_column, |
const gchar * | subgroup_column, | ||
GList * | data_column_list, | ||
GList * | text_column_list, | ||
GList * | sort_data_list, | ||
gchar ** | group_column_type, | ||
gchar ** | subgroup_column_type, | ||
GArray ** | data_column_types, | ||
GArray ** | data_columns, | ||
GArray ** | text_column_types, | ||
GArray ** | text_columns, | ||
GArray ** | sort_data, | ||
GArray ** | c_sums | ||
) |
Initialize lists for aggregates.
[in] | group_column | Column the data are grouped by. |
[in] | subgroup_column | Second column the data grouped by. |
[in] | data_column_list | GList of columns statistics are calculated for. |
[in] | text_column_list | GList of columns used for labels. |
[in] | sort_data_list | GList of sort data. |
[out] | group_column_type | Type of the group_column. |
[out] | subgroup_column_type | Type of the group_column. |
[out] | data_column_types | Types of the data_column. |
[out] | data_columns | data_column_list copied to a GArray. |
[out] | text_column_types | Types of the text_columns. |
[out] | text_columns | text_column_list copied to a GArray. |
[out] | sort_data | sort_data_list copied to a GArray. |
[out] | c_sums | Array for calculating cumulative sums. |
Definition at line 11849 of file omp.c.
References sort_data_t::field, sort_data_t::order, and sort_data_t::stat.
int init_get | ( | gchar * | command, |
get_data_t * | get, | ||
const gchar * | setting_name, | ||
int * | first | ||
) |
Init for a GET handler.
[in] | command | OMP command name. |
[in] | get | GET data. |
[in] | setting_name | Type name for setting. |
[out] | first | First result, from filter. |
Definition at line 396 of file omp.c.
References acl_user_may(), filter_term(), filter_term_value(), manage_clean_filter_remove(), manage_filter_controls(), and setting_filter().
int init_omp | ( | GSList * | log_config, |
int | nvt_cache_mode, | ||
const gchar * | database, | ||
int | max_ips_per_target, | ||
int | max_email_attachment_size, | ||
int | max_email_include_size, | ||
int | max_email_message_size, | ||
void(*)() | progress, | ||
int(*)(openvas_connection_t *, gchar *) | fork_connection, | ||
int | skip_db_check | ||
) |
Initialise OMP library.
[in] | log_config | Logging configuration list. |
[in] | nvt_cache_mode | True when running in NVT caching mode. |
[in] | database | Location of manage database. |
[in] | max_ips_per_target | Max number of IPs per target. |
[in] | max_email_attachment_size | Max size of email attachments. |
[in] | max_email_include_size | Max size of email inclusions. |
[in] | max_email_message_size | Max size of email user message text. |
[in] | progress | Function to update progress, or NULL. |
[in] | fork_connection | Function to fork a connection to the OMP daemon layer, or NULL. |
[in] | skip_db_check | Skip DB check. |
Definition at line 30814 of file omp.c.
void init_omp_process | ( | int | update_nvt_cache, |
const gchar * | database, | ||
int(*)(const char *, void *) | write_to_client, | ||
void * | write_to_client_data, | ||
gchar ** | disable | ||
) |
Initialise OMP library data for a process.
[in] | update_nvt_cache | 0 operate normally, -1 just update NVT cache, -2 just rebuild NVT cache. |
[in] | database | Location of manage database. |
[in] | write_to_client | Function to write to client. |
[in] | write_to_client_data | Argument to write_to_client . |
[in] | disable | Commands to disable. |
This should run once per process, before the first call to process_omp_client_input.
Definition at line 30846 of file omp.c.
void modify_auth_data_reset | ( | modify_auth_data_t * | data | ) |
Reset command data.
[in] | data | Command data. |
Definition at line 3247 of file omp.c.
References modify_auth_data_t::curr_group_settings, auth_group_t::group_name, modify_auth_data_t::groups, auth_conf_setting_t::key, modify_auth_data_t::key, auth_group_t::settings, auth_conf_setting_t::value, and modify_auth_data_t::value.
void omp_parser_free | ( | omp_parser_t * | omp_parser | ) |
Free an OMP parser.
[in] | omp_parser | OMP parser. |
Definition at line 748 of file omp.c.
References omp_parser_t::disabled_commands.
omp_parser_t* omp_parser_new | ( | int(*)(const char *, void *) | write_to_client, |
void * | write_to_client_data, | ||
gchar ** | disable | ||
) |
Create an OMP parser.
[in] | write_to_client | Function to write to client. |
[in] | write_to_client_data | Argument to write_to_client . |
[in] | disable | Commands to disable. Copied, and freed by omp_parser_free. |
int process_omp_change | ( | ) |
Deal with any changes caused by other processes.
Definition at line 31098 of file omp.c.
References manage_check_current_task().
int process_omp_client_input | ( | ) |
Process any XML available in from_client.
Definition at line 30895 of file omp.c.
References manage_transaction_stop().
int process_omp_write | ( | const char * | msg, |
void * | buffer | ||
) |
gchar* strdiff | ( | const gchar * | one, |
const gchar * | two | ||
) |
char client_address[] |
The OMP client's address.
Definition at line 285 of file openvasmd.c.
command_data_t command_data |
create_agent_data_t* create_agent_data = (create_agent_data_t*) &(command_data.create_agent) |
create_alert_data_t* create_alert_data = (create_alert_data_t*) &(command_data.create_alert) |
create_asset_data_t* create_asset_data = (create_asset_data_t*) &(command_data.create_asset) |
create_config_data_t* create_config_data = (create_config_data_t*) &(command_data.create_config) |
create_credential_data_t* create_credential_data = (create_credential_data_t*) &(command_data.create_credential) |
create_filter_data_t* create_filter_data = (create_filter_data_t*) &(command_data.create_filter) |
create_group_data_t* create_group_data = (create_group_data_t*) &(command_data.create_group) |
create_note_data_t* create_note_data = (create_note_data_t*) &(command_data.create_note) |
create_override_data_t* create_override_data = (create_override_data_t*) &(command_data.create_override) |
create_permission_data_t* create_permission_data = (create_permission_data_t*) &(command_data.create_permission) |
create_port_list_data_t* create_port_list_data = (create_port_list_data_t*) &(command_data.create_port_list) |
create_port_range_data_t* create_port_range_data = (create_port_range_data_t*) &(command_data.create_port_range) |
create_report_data_t* create_report_data = (create_report_data_t*) &(command_data.create_report) |
create_report_format_data_t* create_report_format_data = (create_report_format_data_t*) &(command_data.create_report_format) |
create_role_data_t* create_role_data = (create_role_data_t*) &(command_data.create_role) |
create_scanner_data_t* create_scanner_data = (create_scanner_data_t*) &(command_data.create_scanner) |
create_schedule_data_t* create_schedule_data = (create_schedule_data_t*) &(command_data.create_schedule) |
create_tag_data_t* create_tag_data = (create_tag_data_t*) &(command_data.create_tag) |
create_target_data_t* create_target_data = (create_target_data_t*) &(command_data.create_target) |
create_task_data_t* create_task_data = (create_task_data_t*) &(command_data.create_task) |
create_user_data_t* create_user_data = &(command_data.create_user) |
int current_error |
delete_agent_data_t* delete_agent_data = (delete_agent_data_t*) &(command_data.delete_agent) |
delete_alert_data_t* delete_alert_data = (delete_alert_data_t*) &(command_data.delete_alert) |
delete_asset_data_t* delete_asset_data = (delete_asset_data_t*) &(command_data.delete_asset) |
delete_config_data_t* delete_config_data = (delete_config_data_t*) &(command_data.delete_config) |
delete_credential_data_t* delete_credential_data = (delete_credential_data_t*) &(command_data.delete_credential) |
delete_filter_data_t* delete_filter_data = (delete_filter_data_t*) &(command_data.delete_filter) |
delete_group_data_t* delete_group_data = (delete_group_data_t*) &(command_data.delete_group) |
delete_note_data_t* delete_note_data = (delete_note_data_t*) &(command_data.delete_note) |
delete_override_data_t* delete_override_data = (delete_override_data_t*) &(command_data.delete_override) |
delete_permission_data_t* delete_permission_data = (delete_permission_data_t*) &(command_data.delete_permission) |
delete_port_list_data_t* delete_port_list_data = (delete_port_list_data_t*) &(command_data.delete_port_list) |
delete_port_range_data_t* delete_port_range_data = (delete_port_range_data_t*) &(command_data.delete_port_range) |
delete_report_data_t* delete_report_data = (delete_report_data_t*) &(command_data.delete_report) |
delete_report_format_data_t* delete_report_format_data = (delete_report_format_data_t*) &(command_data.delete_report_format) |
delete_role_data_t* delete_role_data = (delete_role_data_t*) &(command_data.delete_role) |
delete_scanner_data_t* delete_scanner_data = (delete_scanner_data_t*) &(command_data.delete_scanner) |
delete_schedule_data_t* delete_schedule_data = (delete_schedule_data_t*) &(command_data.delete_schedule) |
delete_tag_data_t* delete_tag_data = (delete_tag_data_t*) &(command_data.delete_tag) |
delete_target_data_t* delete_target_data = (delete_target_data_t*) &(command_data.delete_target) |
delete_task_data_t* delete_task_data = (delete_task_data_t*) &(command_data.delete_task) |
delete_user_data_t* delete_user_data = (delete_user_data_t*) &(command_data.delete_user) |
char from_client[] |
Buffer of input from the client.
buffer_size_t from_client_end |
The end of the data in the from_client buffer.
buffer_size_t from_client_start |
The start of the data in the from_client buffer.
get_agents_data_t* get_agents_data = &(command_data.get_agents) |
get_aggregates_data_t* get_aggregates_data = &(command_data.get_aggregates) |
get_alerts_data_t* get_alerts_data = &(command_data.get_alerts) |
get_assets_data_t* get_assets_data = &(command_data.get_assets) |
get_configs_data_t* get_configs_data = &(command_data.get_configs) |
get_credentials_data_t* get_credentials_data = &(command_data.get_credentials) |
get_feeds_data_t* get_feeds_data = &(command_data.get_feeds) |
get_filters_data_t* get_filters_data = &(command_data.get_filters) |
get_groups_data_t* get_groups_data = &(command_data.get_groups) |
get_info_data_t* get_info_data = &(command_data.get_info) |
get_notes_data_t* get_notes_data = &(command_data.get_notes) |
get_nvt_families_data_t* get_nvt_families_data = &(command_data.get_nvt_families) |
get_nvts_data_t* get_nvts_data = &(command_data.get_nvts) |
get_overrides_data_t* get_overrides_data = &(command_data.get_overrides) |
get_permissions_data_t* get_permissions_data = &(command_data.get_permissions) |
get_port_lists_data_t* get_port_lists_data = &(command_data.get_port_lists) |
get_preferences_data_t* get_preferences_data = &(command_data.get_preferences) |
get_report_formats_data_t* get_report_formats_data = &(command_data.get_report_formats) |
get_reports_data_t* get_reports_data = &(command_data.get_reports) |
get_results_data_t* get_results_data = &(command_data.get_results) |
get_roles_data_t* get_roles_data = &(command_data.get_roles) |
get_scanners_data_t* get_scanners_data = &(command_data.get_scanners) |
get_schedules_data_t* get_schedules_data = &(command_data.get_schedules) |
get_settings_data_t* get_settings_data = &(command_data.get_settings) |
get_system_reports_data_t* get_system_reports_data = &(command_data.get_system_reports) |
get_tags_data_t* get_tags_data = &(command_data.get_tags) |
get_targets_data_t* get_targets_data = &(command_data.get_targets) |
get_tasks_data_t* get_tasks_data = &(command_data.get_tasks) |
get_users_data_t* get_users_data = &(command_data.get_users) |
help_data_t* help_data = &(command_data.help) |
import_config_data_t* import_config_data = (import_config_data_t*) &(command_data.create_config.import) |
modify_agent_data_t* modify_agent_data = &(command_data.modify_agent) |
modify_alert_data_t* modify_alert_data = &(command_data.modify_alert) |
modify_asset_data_t* modify_asset_data = &(command_data.modify_asset) |
modify_auth_data_t* modify_auth_data = &(command_data.modify_auth) |
modify_config_data_t* modify_config_data = &(command_data.modify_config) |
modify_credential_data_t* modify_credential_data = &(command_data.modify_credential) |
modify_filter_data_t* modify_filter_data = &(command_data.modify_filter) |
modify_group_data_t* modify_group_data = &(command_data.modify_group) |
modify_note_data_t* modify_note_data = (modify_note_data_t*) &(command_data.create_note) |
modify_override_data_t* modify_override_data = (modify_override_data_t*) &(command_data.create_override) |
modify_permission_data_t* modify_permission_data = &(command_data.modify_permission) |
modify_port_list_data_t* modify_port_list_data = &(command_data.modify_port_list) |
modify_report_data_t* modify_report_data = &(command_data.modify_report) |
modify_report_format_data_t* modify_report_format_data = &(command_data.modify_report_format) |
modify_role_data_t* modify_role_data = &(command_data.modify_role) |
modify_scanner_data_t* modify_scanner_data = &(command_data.modify_scanner) |
modify_schedule_data_t* modify_schedule_data = &(command_data.modify_schedule) |
modify_setting_data_t* modify_setting_data = &(command_data.modify_setting) |
modify_tag_data_t* modify_tag_data = (modify_tag_data_t*) &(command_data.modify_tag) |
modify_target_data_t* modify_target_data = &(command_data.modify_target) |
modify_task_data_t* modify_task_data = &(command_data.modify_task) |
modify_user_data_t* modify_user_data = &(command_data.modify_user) |
move_task_data_t* move_task_data = &(command_data.move_task) |
restore_data_t* restore_data = (restore_data_t*) &(command_data.restore) |
resume_task_data_t* resume_task_data = (resume_task_data_t*) &(command_data.resume_task) |
run_wizard_data_t* run_wizard_data = (run_wizard_data_t*) &(command_data.wizard) |
start_task_data_t* start_task_data = (start_task_data_t*) &(command_data.start_task) |
stop_task_data_t* stop_task_data = (stop_task_data_t*) &(command_data.stop_task) |
sync_config_data_t* sync_config_data = (sync_config_data_t*) &(command_data.delete_target) |
test_alert_data_t* test_alert_data = (test_alert_data_t*) &(command_data.test_alert) |
char to_client[TO_CLIENT_BUFFER_SIZE] |
Buffer of output to the client.
buffer_size_t to_client_end = 0 |
The end of the data in the to_client buffer.
Definition at line 4988 of file omp.c.
Referenced by ompd_send_to_client().
buffer_size_t to_client_start = 0 |
verify_agent_data_t* verify_agent_data = (verify_agent_data_t*) &(command_data.verify_agent) |
verify_report_format_data_t* verify_report_format_data = (verify_report_format_data_t*) &(command_data.verify_report_format) |
verify_scanner_data_t* verify_scanner_data = (verify_scanner_data_t*) &(command_data.verify_scanner) |