OpenVAS Manager
7.0.3~git
|
The OpenVAS Manager management library (SQLite implementation). More...
#include "manage_sql.h"
#include "manage_acl.h"
#include "lsc_user.h"
#include "sql.h"
#include "scanner.h"
#include "utils.h"
#include <arpa/inet.h>
#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <gcrypt.h>
#include <glib/gstdio.h>
#include <locale.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/time.h>
#include <grp.h>
#include <openvas/base/openvas_string.h>
#include <openvas/base/openvas_file.h>
#include <openvas/base/openvas_hosts.h>
#include <openvas/misc/openvas_auth.h>
#include <openvas/misc/ldap_connect_auth.h>
#include <openvas/misc/radius.h>
#include <openvas/misc/openvas_logging.h>
#include <openvas/misc/openvas_uuid.h>
#include <openvas/misc/openvas_server.h>
#include <openvas/misc/openvas_ssh.h>
#include <openvas/base/pwpolicy.h>
#include <openvas/omp/omp.h>
Go to the source code of this file.
Data Structures | |
struct | column_t |
Iterator column. More... | |
Functions | |
int | manage_create_sql_functions () |
Create functions. More... | |
void | create_tables () |
Create all tables. More... | |
void | check_db_sequences () |
Ensure sequences for automatic ids are in a consistent state. More... | |
void | manage_attach_databases () |
Attach external databases. More... | |
int | manage_cert_loaded () |
Check whether CERT is available. More... | |
int | manage_scap_loaded () |
Check whether SCAP is available. More... | |
const char * | threat_message_type (const char *) |
Get the message type of a threat. More... | |
const char * | message_type_threat (const char *) |
Get the threat of a message type. More... | |
int | delete_reports (task_t) |
Delete all the reports for a task. More... | |
int | delete_slave_task (const char *, int, const char *, const char *, const char *) |
int | set_certs (const char *, const char *, const char *) |
Initialise OpenVAS scanner variables, checking for defaults. More... | |
gchar * | predefined_report_format_dir (const gchar *) |
Get the directory of a report format. More... | |
int | stop_task_internal (task_t) |
Initiate stopping a task. More... | |
int | validate_username (const gchar *) |
Validates a username. More... | |
void | make_port_ranges_iana_tcp_2012 (port_list_t) |
Make port ranges for IANA TCP 2012. More... | |
void | make_port_ranges_iana_tcp_udp_2012 (port_list_t) |
Make port ranges for IANA TCP and UDP 2012. More... | |
void | make_port_ranges_all_tcp_nmap_5_51_top_100 (port_list_t) |
Make port ranges for IANA TCP 2012. More... | |
void | make_port_ranges_all_tcp_nmap_5_51_top_1000 (port_list_t) |
Make port ranges for IANA TCP 2012. More... | |
void | make_port_ranges_nmap_5_51_top_2000_top_100 (port_list_t) |
Make port ranges for Nmap top 2000 top 100. More... | |
void | make_config_discovery (char *const, const char *const) |
void | make_config_discovery_service_detection (char *const) |
Make Discovery Scan Config. More... | |
void | make_config_host_discovery (char *const, const char *const) |
void | make_config_system_discovery (char *const, const char *const) |
int | check_config_discovery (const char *) |
Ensure the Discovery config is up to date. More... | |
void | check_config_host_discovery (const char *) |
Ensure the Host Discovery config is up to date. More... | |
int | check_config_system_discovery (const char *) |
Ensure the Discovery config is up to date. More... | |
int | family_count () |
int | delete_task_lock (task_t, int) |
gchar * | clean_hosts (const char *, int *) |
int | create_port_list_unique (const char *, const char *, const char *, port_list_t *) |
int | valid_type (const char *type) |
Check whether a resource type name is valid. More... | |
gboolean | find_group (const char *, group_t *) |
gboolean | find_role (const char *, group_t *) |
gboolean | find_role_with_permission (const char *, role_t *, const char *) |
int | user_ensure_in_db (const gchar *name, const gchar *method) |
Ensure the user exists in the database. More... | |
void | cleanup_prognosis_iterator () |
int | set_password (const gchar *, const gchar *, const gchar *, gchar **) |
void | permissions_set_locations (const char *, resource_t, resource_t, int) |
void | permissions_set_orphans (const char *, resource_t, int) |
void | permissions_set_subjects (const char *, resource_t, resource_t, int) |
resource_t | permission_subject (permission_t) |
char * | permission_subject_type (permission_t) |
void | tags_set_locations (const char *, resource_t, resource_t, int) |
void | tags_set_orphans (const char *, resource_t, int) |
int | role_is_predefined (role_t) |
int | role_is_predefined_id (const char *) |
int | valid_omp_command (const char *name) |
Check whether a command name is valid. More... | |
gchar * | omp_command_type (const char *name) |
Get the type associated with an OMP command. More... | |
void | array_add_new_string (array_t *array, const gchar *string) |
Ensure a string is in an array. More... | |
int | parse_iso_time (const char *text_time) |
Convert an ISO time into seconds since epoch. More... | |
int | days_from_now (time_t *epoch_time) |
Calculate difference between now and epoch_time in days. More... | |
char * | iso_time (time_t *epoch_time) |
Create an ISO time from seconds since epoch. More... | |
char * | iso_time_tz (time_t *epoch_time, const char *timezone, const char **abbrev) |
Create an ISO time from seconds since epoch, given a timezone. More... | |
gchar * | tag_value (const gchar *tags, const gchar *tag) |
Extract a tag from an OTP tag list. More... | |
int | parse_time (const gchar *string, int *seconds) |
Try convert an OTP NVT tag time string into epoch time. More... | |
int | manage_option_setup (GSList *log_config, const gchar *database) |
Setup for an option process. More... | |
void | manage_option_cleanup () |
Cleanup for an option process. More... | |
void | column_array_print (column_t *columns) |
Print an array of columns. More... | |
column_t * | column_array_copy (column_t *columns) |
Copy an array of columns. More... | |
void | column_array_free (column_t *columns) |
Free an array of columns. More... | |
void | column_array_set (column_t *columns, const gchar *filter, gchar *select) |
Set the select clause of a column in an array of columns. More... | |
const char * | keyword_relation_symbol (keyword_relation_t relation) |
Get the symbol of a keyword relation. More... | |
void | filter_free (array_t *split) |
Free a split filter. More... | |
array_t * | split_filter (const gchar *given_filter) |
Split the filter term into parts. More... | |
void | manage_filter_controls (const gchar *filter, int *first, int *max, gchar **sort_field, int *sort_order) |
Get info from a filter. More... | |
int | filter_control_int (keyword_t **point, const char *column, int *val) |
Get an int column from a filter split. More... | |
int | filter_control_str (keyword_t **point, const char *column, gchar **string) |
Get a string column from a filter split. More... | |
void | manage_report_filter_controls (const gchar *filter, int *first, int *max, gchar **sort_field, int *sort_order, int *result_hosts_only, gchar **min_qod, gchar **levels, gchar **delta_states, gchar **search_phrase, int *search_phrase_exact, int *autofp, int *notes, int *overrides, int *apply_overrides, gchar **zone) |
Get info from a filter for report. More... | |
gchar * | manage_clean_filter_remove (const gchar *filter, const gchar *column) |
Clean a filter, removing a keyword in the process. More... | |
gchar * | manage_clean_filter (const gchar *filter) |
Clean a filter. More... | |
const char * | type_pretty_name (const char *type) |
Return pretty name of type. More... | |
const char * | type_db_name (const char *type) |
Return DB name of type. More... | |
int | type_named (const char *type) |
Check whether a type has a name and comment. More... | |
int | type_has_comment (const char *type) |
Check whether a type has a comment. More... | |
int | type_owned (const char *type) |
Check whether a resource type has an owner. More... | |
gboolean | find_resource (const char *type, const char *uuid, resource_t *resource) |
Find a resource given a UUID. More... | |
gboolean | find_resource_with_permission (const char *type, const char *uuid, resource_t *resource, const char *permission, int trash) |
Find a resource given a UUID and a permission. More... | |
gboolean | find_resource_by_name_with_permission (const char *type, const char *name, resource_t *resource, const char *permission) |
Find a resource given a UUID and a permission. More... | |
int | copy_resource (const char *type, const char *name, const char *comment, const char *resource_id, const char *columns, int make_name_unique, resource_t *new_resource) |
Create a resource from an existing resource. More... | |
int | resource_exists (const char *type, resource_t resource, int location) |
Get whether a resource exists. More... | |
int | resource_name (const char *type, const char *uuid, int location, char **name) |
Get the name of a resource. More... | |
int | manage_resource_name (const char *type, const char *uuid, char **name) |
Get the name of a resource. More... | |
int | manage_trash_resource_name (const char *type, const char *uuid, char **name) |
Get the name of a trashcan resource. More... | |
gchar * | resource_uuid (const gchar *type, resource_t resource) |
Get the UUID of a resource. More... | |
column_t * | type_select_columns (const char *type, int) |
column_t * | type_where_columns (const char *type, int) |
int | init_aggregate_iterator (iterator_t *iterator, const char *type, const get_data_t *get, int distinct, GArray *data_columns, const char *group_column, const char *subgroup_column, GArray *text_columns, GArray *sort_data, int first_group, int max_groups, const char *extra_tables, const char *extra_where) |
Initialise a GET_AGGREGATES iterator, including observed resources. More... | |
int | aggregate_iterator_count (iterator_t *iterator) |
Get the count from an aggregate iterator. More... | |
double | aggregate_iterator_min (iterator_t *iterator, int data_column_index) |
Get the minimum from an aggregate iterator. More... | |
double | aggregate_iterator_max (iterator_t *iterator, int data_column_index) |
Get the maximum from an aggregate iterator. More... | |
double | aggregate_iterator_mean (iterator_t *iterator, int data_column_index) |
Get the mean from an aggregate iterator. More... | |
double | aggregate_iterator_sum (iterator_t *iterator, int data_column_index) |
Get the sum from a statistics iterator. More... | |
const char * | aggregate_iterator_text (iterator_t *iterator, int text_column_index, int data_columns) |
Get the value of a text column from an aggregate iterator. More... | |
const char * | aggregate_iterator_value (iterator_t *iterator) |
Get the value of the group column from a statistics iterator. More... | |
const char * | aggregate_iterator_subgroup_value (iterator_t *iterator) |
Get the value of the subgroup column from an aggregate iterator. More... | |
int | info_name_count (const char *type, const char *name) |
Count number of info of a given subtype with a given name. More... | |
int | manage_db_supported_version () |
Return the database version supported by this manager. More... | |
int | manage_db_version () |
Return the database version of the actual database. More... | |
int | manage_scap_db_supported_version () |
Return the database version supported by this manager. More... | |
int | manage_scap_db_version () |
Return the database version of the actual database. More... | |
int | manage_cert_db_supported_version () |
Return the database version supported by this manager. More... | |
int | manage_cert_db_version () |
Return the database version of the actual database. More... | |
char * | manage_port_name (int number, const char *protocol) |
Returns associated name for a tcp/ip port. More... | |
gchar * | port_name_formatted (const char *field) |
Returns formatted port number, protocol and iana name from. More... | |
void | set_db_version (int version) |
Set the database version of the actual database. More... | |
int | manage_encrypt_all_credentials (GSList *log_config, const gchar *database) |
Encrypt or re-encrypt all credentials. More... | |
int | manage_decrypt_all_credentials (GSList *log_config, const gchar *database) |
Decrypt all credentials. More... | |
int | collate_message_type (void *data, int one_len, const void *arg_one, int two_len, const void *arg_two) |
Collate two message type strings. More... | |
int | collate_ip (void *data, int one_len, const void *arg_one, int two_len, const void *arg_two) |
Collate two IP addresses. More... | |
void | init_task_user_iterator (iterator_t *iterator, task_t task) |
Initialise a task user iterator. More... | |
void | init_task_group_iterator (iterator_t *iterator, task_t task) |
Initialise a task group iterator. More... | |
void | init_task_role_iterator (iterator_t *iterator, task_t task) |
Initialise a task role iterator. More... | |
int | manage_check_alerts (GSList *log_config, const gchar *database) |
Check if any SecInfo alerts are due. More... | |
gboolean | find_alert_with_permission (const char *uuid, alert_t *alert, const char *permission) |
Find a alert for a specific permission, given a UUID. More... | |
int | validate_scp_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the SCP method. More... | |
int | validate_send_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the Send method. More... | |
int | validate_smb_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the Send method. More... | |
int | validate_tippingpoint_data (alert_method_t method, const gchar *name, gchar **data) |
Validate method data for the TippingPoint method. More... | |
int | create_alert (const char *name, const char *comment, const char *filter_id, event_t event, GPtrArray *event_data, alert_condition_t condition, GPtrArray *condition_data, alert_method_t method, GPtrArray *method_data, alert_t *alert) |
Create an alert. More... | |
int | copy_alert (const char *name, const char *comment, const char *alert_id, alert_t *new_alert) |
Create an alert from an existing alert. More... | |
int | modify_alert (const char *alert_id, const char *name, const char *comment, const char *filter_id, event_t event, GPtrArray *event_data, alert_condition_t condition, GPtrArray *condition_data, alert_method_t method, GPtrArray *method_data) |
Modify an alert. More... | |
int | delete_alert (const char *alert_id, int ultimate) |
Delete an alert. More... | |
char * | alert_uuid (alert_t alert) |
Return the UUID of an alert. More... | |
char * | alert_name (alert_t alert) |
Return the name of an alert. More... | |
char * | alert_owner_uuid (alert_t alert) |
Return the UUID of the owner of an alert. More... | |
char * | alert_filter_id (alert_t alert) |
Return the UUID of the filter of an alert. More... | |
int | alert_count (const get_data_t *get) |
Count the number of alerts. More... | |
int | alert_in_use (alert_t alert) |
Return whether a alert is in use by a task. More... | |
int | trash_alert_in_use (alert_t alert) |
Return whether a trashcan alert is in use by a task. More... | |
int | alert_writable (alert_t alert) |
Return whether a alert is writable. More... | |
int | trash_alert_writable (alert_t alert) |
Return whether a trashcan alert is writable. More... | |
int | init_alert_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise an alert iterator, including observed alerts. More... | |
int | alert_iterator_event (iterator_t *iterator) |
Return the event from an alert iterator. More... | |
int | alert_iterator_condition (iterator_t *iterator) |
Return the condition from an alert iterator. More... | |
int | alert_iterator_method (iterator_t *iterator) |
Return the method from an alert iterator. More... | |
filter_t | alert_iterator_filter (iterator_t *iterator) |
Return the filter from an alert iterator. More... | |
char * | alert_iterator_filter_uuid (iterator_t *iterator) |
Return the filter UUID from an alert iterator. More... | |
char * | alert_iterator_filter_name (iterator_t *iterator) |
Return the filter name from an alert iterator. More... | |
int | alert_iterator_filter_trash (iterator_t *iterator) |
Return the location of an alert iterator filter. More... | |
int | alert_iterator_filter_readable (iterator_t *iterator) |
Return the filter readable state from an alert iterator. More... | |
void | init_alert_data_iterator (iterator_t *iterator, alert_t alert, int trash, const char *table) |
Initialise an alert data iterator. More... | |
const char * | alert_data_iterator_name (iterator_t *iterator) |
Return the name from an alert data iterator. More... | |
const char * | alert_data_iterator_data (iterator_t *iterator) |
Return the data from an alert data iterator. More... | |
char * | alert_data (alert_t alert, const char *type, const char *name) |
Return data associated with an alert. More... | |
void | init_task_alert_iterator (iterator_t *iterator, task_t task, event_t event) |
Initialise a task alert iterator. More... | |
alert_t | task_alert_iterator_alert (iterator_t *iterator) |
Get the alert from a task alert iterator. More... | |
int | email_secinfo (alert_t alert, task_t task, event_t event, const void *event_data, alert_method_t method, alert_condition_t condition, const gchar *to_address, const gchar *from_address) |
Build and send email for SecInfo alert. More... | |
int | manage_alert (const char *alert_id, const char *task_id, event_t event, const void *event_data, gchar **script_message) |
Escalate an alert with task and event data. More... | |
int | manage_test_alert (const char *alert_id, gchar **script_message) |
Test an alert. More... | |
void | init_alert_task_iterator (iterator_t *iterator, alert_t alert, int ascending) |
Initialise an alert task iterator. More... | |
const char * | alert_task_iterator_name (iterator_t *iterator) |
Return the name from an alert task iterator. More... | |
const char * | alert_task_iterator_uuid (iterator_t *iterator) |
Return the uuid from an alert task iterator. More... | |
int | alert_task_iterator_readable (iterator_t *iterator) |
Get the read permission status from a GET iterator. More... | |
int | init_task_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise a task iterator. More... | |
task_status_t | task_iterator_run_status (iterator_t *iterator) |
Get the run status from a task iterator. More... | |
int | task_iterator_total_reports (iterator_t *iterator) |
Get the number of reports of a task iterator. More... | |
const char * | task_iterator_first_report (iterator_t *iterator) |
Get the first report UUID from a task iterator. More... | |
const char * | task_iterator_run_status_name (iterator_t *iterator) |
Get the run status name from a task iterator. More... | |
const char * | task_iterator_last_report (iterator_t *iterator) |
Get the last report UUID from a task iterator. More... | |
int | task_iterator_finished_reports (iterator_t *iterator) |
Get the number of reports of a task iterator. More... | |
const char * | task_iterator_hosts_ordering (iterator_t *iterator) |
Get the hosts ordering value from a task iterator. More... | |
scanner_t | task_iterator_scanner (iterator_t *iterator) |
Get the UUID of task scanner from a task iterator. More... | |
int | task_in_use (task_t task) |
Return whether a task is in use by a task. More... | |
int | trash_task_in_use (task_t task) |
Return whether a trashcan task is referenced by a task. More... | |
int | task_alterable (task_t task) |
Return whether a task is an Alterable Task. More... | |
int | task_writable (task_t task) |
Return whether a task is writable. More... | |
int | trash_task_writable (task_t task) |
Return whether a trashcan task is writable. More... | |
int | task_average_scan_duration (task_t task) |
Get the average duration of all finished reports of a task. More... | |
void | init_manage_process (int update_nvt_cache, const gchar *database) |
Initialize the manage library for a process. More... | |
void | reinit_manage_process () |
Reinitialize the manage library for a process. More... | |
int | manage_update_nvti_cache () |
Update the memory cache of NVTs, if this has been requested. More... | |
void | add_role_permission (const gchar *role, const gchar *permission) |
Add permission to role. More... | |
void | refresh_nvt_cves () |
Refresh nvt_cves table. More... | |
int | check_db_versions (int nvt_cache_mode) |
Ensure that the databases are the right versions. More... | |
void | check_generate_scripts () |
Ensure the generate scripts are all executable. More... | |
void | stop_active_tasks () |
Stop any active tasks. More... | |
void | cleanup_tables () |
Clean up database tables. More... | |
int | init_manage (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(*update_progress)(), int(*fork_connection)(openvas_connection_t *, gchar *), int skip_db_check) |
Initialize the manage library. More... | |
int | init_manage_helper (GSList *log_config, const gchar *database, int max_ips_per_target, void(*update_progress)()) |
Initialize the manage library for a helper program. More... | |
void | cleanup_manage_process (gboolean cleanup) |
Cleanup the manage library. More... | |
void | manage_cleanup_process_error (int signal) |
Cleanup as immediately as possible. More... | |
void | manage_reset_currents () |
Cleanup as immediately as possible. More... | |
gchar * | manage_user_hash (const gchar *username) |
Get user hash. More... | |
gchar * | user_uuid_method (const gchar *username, auth_method_t method) |
Get user uuid. More... | |
gchar * | user_uuid_any_method (const gchar *name) |
Get user uuid, trying all authentication methods. More... | |
int | user_exists (const gchar *name) |
Check if user exists. More... | |
int | manage_scanner_set (const char *uuid) |
Set the address of scanner to connect to. More... | |
int | manage_scanner_set_default () |
Set the default scanner as the scanner to connect to. More... | |
int | authenticate_any_method (const gchar *username, const gchar *password, auth_method_t *auth_method) |
Authenticate, trying any method. More... | |
int | authenticate (credentials_t *credentials) |
Authenticate credentials. More... | |
int | resource_count (const char *type, const get_data_t *get) |
Return number of resources of a certain type for current user. More... | |
int | resource_id_exists (const char *type, const char *id) |
Test whether a resource of the given type and unique ID exists. More... | |
int | trash_id_exists (const char *type, const char *id) |
Test Whether a resource of the given type and ID exists in the trash. More... | |
unsigned int | task_count (const get_data_t *get) |
Return the number of tasks associated with the current user. More... | |
unsigned int | task_id (task_t task) |
Return the identifier of a task. More... | |
int | task_uuid (task_t task, char **id) |
Return the UUID of a task. More... | |
int | task_in_trash (task_t task) |
Return whether a task is in the trashcan. More... | |
char * | task_owner_name (task_t task) |
Return the name of the owner of a task. More... | |
char * | task_name (task_t task) |
Return the name of a task. More... | |
char * | task_comment (task_t task) |
Return the comment of a task. More... | |
char * | task_hosts_ordering (task_t task) |
Return the hosts ordering of a task. More... | |
char * | task_observers (task_t task) |
Return the observers of a task. More... | |
config_t | task_config (task_t task) |
Return the config of a task. More... | |
char * | task_config_uuid (task_t task) |
Return the UUID of the config of a task. More... | |
char * | task_config_name (task_t task) |
Return the name of the config of a task. More... | |
int | task_config_in_trash (task_t task) |
Return whether the config of a task is in the trashcan. More... | |
void | set_task_config (task_t task, config_t config) |
Set the config of a task. More... | |
target_t | task_target (task_t task) |
Return the target of a task. More... | |
void | set_task_target (task_t task, target_t target) |
Set the target of a task. More... | |
void | set_task_hosts_ordering (task_t task, const char *ordering) |
Set the hosts ordering of a task. More... | |
int | task_target_in_trash (task_t task) |
Return whether the target of a task is in the trashcan. More... | |
scanner_t | task_scanner (task_t task) |
Return the scanner of a task. More... | |
void | set_task_scanner (task_t task, scanner_t scanner) |
Set the scanner of a task. More... | |
int | task_scanner_in_trash (task_t task) |
Return whether the scanner of a task is in the trashcan. More... | |
task_status_t | task_run_status (task_t task) |
Return the run state of a task. More... | |
void | set_report_scheduled (report_t report) |
Set a report's scheduled flag. More... | |
void | set_task_run_status (task_t task, task_status_t status) |
Set the run state of a task. More... | |
int | set_task_requested (task_t task, task_status_t *status) |
Atomically set the run state of a task to requested. More... | |
int | task_result_count (task_t task, int min_qod) |
Return number of results in a task. More... | |
report_t | task_running_report (task_t task) |
Return the running report of a task. More... | |
report_t | task_iterator_current_report (iterator_t *iterator) |
Return the current report of a task. More... | |
int | task_upload_progress (task_t task) |
Return the upload progress of a task. More... | |
void | set_task_start_time (task_t task, char *time) |
Set the start time of a task. More... | |
void | set_task_start_time_epoch (task_t task, int time) |
Set the start time of a task. More... | |
void | set_task_start_time_otp (task_t task, char *time) |
Set the start time of a task. More... | |
int | task_last_report (task_t task, report_t *report) |
Get the report from the most recently completed invocation of task. More... | |
int | task_last_stopped_report (task_t task, report_t *report) |
Get the report from the most recently stopped invocation of task. More... | |
gchar * | task_second_last_report_id (task_t task) |
Get report ID from second most recently completed invocation of task. More... | |
void | add_task_alert (task_t task, alert_t alert) |
Add an alert to a task. More... | |
int | set_task_alerts (task_t task, array_t *alerts, gchar **alert_id_return) |
Set the alerts on a task, removing any previous alerts. More... | |
void | set_task_alterable (task_t task, int alterable) |
Set the alterable state of a task. More... | |
int | set_task_groups (task_t task, array_t *groups, gchar **group_id_return) |
Set observer groups on a task, removing any previous groups. More... | |
int | set_task_schedule (task_t task, schedule_t schedule, int periods) |
Set the schedule of a task. More... | |
int | set_task_schedule_uuid (const gchar *task_id, schedule_t schedule, int periods) |
Set the schedule of a task. More... | |
int | set_task_schedule_periods (const gchar *task_id, int periods) |
Set the schedule periods of a task, given a UUID. More... | |
int | set_task_schedule_periods_id (task_t task, int periods) |
Set the schedule periods of a task, given an ID. More... | |
schedule_t | task_schedule (task_t task) |
Return the schedule of a task. More... | |
schedule_t | task_schedule_uuid (const gchar *task_id) |
Return the schedule of a task. More... | |
int | task_schedule_in_trash (task_t task) |
Get whether the task schedule is in the trash. More... | |
int | task_schedule_periods (task_t task) |
Get the number of times the period schedule should run on the task. More... | |
int | task_schedule_periods_uuid (const gchar *task_id) |
Set the next time a scheduled task will be due. More... | |
int | task_schedule_next_time (task_t task) |
Get next time a scheduled task will run, following schedule timezone. More... | |
time_t | task_schedule_next_time_uuid (const gchar *task_id) |
Set the next time a scheduled task will be due. More... | |
void | set_task_schedule_next_time (task_t task, time_t time) |
Set the next time a scheduled task will be due. More... | |
void | set_task_schedule_next_time_uuid (const gchar *task_id, time_t time) |
Set the next time a scheduled task will be due. More... | |
char * | task_severity (task_t task, int overrides, int min_qod, int offset) |
Return the severity score of a task, taking overrides into account. More... | |
double | task_severity_double (task_t task, int overrides, int min_qod, int offset) |
Return the severity score of a task, taking overrides into account. More... | |
int | set_task_observers (task_t task, const gchar *observers) |
Set the observers of a task. More... | |
Variables | |
int | authenticate_allow_all |
Flag to force authentication to succeed. More... | |
int(* | manage_fork_connection )(openvas_connection_t *, gchar *) = NULL |
Function to fork a connection that will accept OMP requests. More... | |
void(* | progress )() = NULL |
Function to mark progress. More... | |
nvtis_t * | nvti_cache = NULL |
Memory cache of NVT information from the database. More... | |
gchar * | task_db_name = NULL |
Name of the database file. More... | |
command_t | omp_commands [] |
The OMP command list. More... | |
int | table_order_if_sort_not_specified = 0 |
Flag to control the default sorting produced by split filter. More... | |
The OpenVAS Manager management library (SQLite implementation).
This file defines the SQLite specific portions of the OpenVAS manager management library.
Definition in file manage_sql.c.
#define _GNU_SOURCE |
Definition at line 35 of file manage_sql.c.
#define AGENT_ITERATOR_COLUMNS |
#define AGENT_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "trust", NULL } |
#define AGENT_ITERATOR_TRASH_COLUMNS |
#define AGGREGATE_ITERATOR_N_STATS 4 |
Definition at line 5913 of file manage_sql.c.
#define AGGREGATE_ITERATOR_OFFSET 3 |
Definition at line 5912 of file manage_sql.c.
#define ALERT_ITERATOR_COLUMNS |
Alert iterator columns.
Definition at line 8456 of file manage_sql.c.
#define ALERT_ITERATOR_FILTER_COLUMNS |
Filter columns for alert iterator.
Definition at line 8449 of file manage_sql.c.
#define ALERT_ITERATOR_TRASH_COLUMNS |
Alert iterator columns for trash case.
Definition at line 8470 of file manage_sql.c.
#define ALL_INFO_ITERATOR_COLUMNS |
#define ALL_INFO_ITERATOR_COLUMNS_ARGS | ( | type, | |
extra, | |||
severity | |||
) |
#define ALL_INFO_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "type", "extra", "severity", NULL } |
#define ALL_INFO_UNION_COLUMNS |
#define ALL_INFO_UNION_COLUMNS_LIMIT |
#define ANON_GET_ITERATOR_FILTER_COLUMNS |
Filter columns for GET iterator.
Definition at line 4139 of file manage_sql.c.
#define CERT_BUND_ADV_INFO_ITERATOR_COLUMNS |
#define CERT_BUND_ADV_INFO_ITERATOR_FILTER_COLUMNS |
#define CHUNK_SIZE 100 |
#define CONFIG_ITERATOR_COLUMNS |
#define CONFIG_ITERATOR_FILTER_COLUMNS |
#define CONFIG_ITERATOR_TRASH_COLUMNS |
#define CPE_INFO_ITERATOR_COLUMNS |
#define CPE_INFO_ITERATOR_FILTER_COLUMNS |
#define CREATE_REPORT_CHUNK_SIZE 10 |
#define CREATE_REPORT_CHUNK_SLEEP 1000 |
#define CREDENTIAL_ITERATOR_COLUMNS |
#define CREDENTIAL_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "login", "type", "allow_insecure", NULL } |
#define CREDENTIAL_ITERATOR_TRASH_COLUMNS |
#define CVE_INFO_ITERATOR_COLUMNS |
#define CVE_INFO_ITERATOR_FILTER_COLUMNS |
#define CVSS_BASE_SQL "(SELECT cvss_base FROM nvts WHERE nvts.oid = results.nvt)" |
#define DFN_CERT_ADV_INFO_ITERATOR_COLUMNS |
#define DFN_CERT_ADV_INFO_ITERATOR_FILTER_COLUMNS |
#define FILTER_ITERATOR_COLUMNS |
#define FILTER_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "type", "term", NULL } |
#define FILTER_ITERATOR_TRASH_COLUMNS |
#define G_LOG_DOMAIN "md manage" |
GLib log domain.
Definition at line 81 of file manage_sql.c.
#define GET_ITERATOR_COLUMN_COUNT 10 |
Number of columns for GET iterator.
Definition at line 4191 of file manage_sql.c.
#define GET_ITERATOR_COLUMNS | ( | table | ) |
Columns for GET iterator.
[in] | table | Table. |
Definition at line 4178 of file manage_sql.c.
#define GET_ITERATOR_COLUMNS_PREFIX | ( | prefix | ) |
Columns for GET iterator.
[in] | prefix | Column prefix. |
Definition at line 4163 of file manage_sql.c.
#define GET_ITERATOR_COLUMNS_STRING |
Columns for GET iterator, as a single string.
[in] | prefix | Column prefix. |
Definition at line 4153 of file manage_sql.c.
#define GET_ITERATOR_FILTER_COLUMNS |
Filter columns for GET iterator.
Definition at line 4145 of file manage_sql.c.
#define GROUP_ITERATOR_COLUMNS |
#define GROUP_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, NULL } |
#define GROUP_ITERATOR_TRASH_COLUMNS |
#define HOST_ITERATOR_COLUMNS |
#define HOST_ITERATOR_FILTER_COLUMNS |
#define HOST_ITERATOR_WHERE_COLUMNS |
#define MANAGE_SEND_REPORT_CHUNK64_SIZE 262144 |
#define MANAGE_SEND_REPORT_CHUNK_SIZE (MANAGE_SEND_REPORT_CHUNK64_SIZE * 3 / 4) |
#define MAX_ATTACH_LENGTH 1048576 |
Default max number of bytes of reports attached to email alerts.
Definition at line 374 of file manage_sql.c.
#define MAX_CONTENT_LENGTH 20000 |
Default max number of bytes of reports included in email alerts.
Definition at line 362 of file manage_sql.c.
#define MAX_EMAIL_MESSAGE_LENGTH 2000 |
Default max number of bytes of user-defined message in email alerts.
Definition at line 386 of file manage_sql.c.
#define NEW_CERT_BUNDS_HEADER |
Header for "New CERT-Bund Advisories" alert message.
Definition at line 13051 of file manage_sql.c.
#define NEW_CPES_HEADER |
Header for "New CPEs" alert message.
Definition at line 13043 of file manage_sql.c.
#define NEW_CVES_HEADER |
Header for "New CVEs" alert message.
Definition at line 13035 of file manage_sql.c.
#define NEW_DFN_CERTS_HEADER |
Header for "New DFN-CERT Advisories" alert message.
Definition at line 13059 of file manage_sql.c.
#define NEW_NVTS_HEADER |
Header for "New NVTs" alert message.
Definition at line 13019 of file manage_sql.c.
#define NEW_NVTS_HEADER_OID |
Header for "New NVTs" alert message, when there's an OID.
Definition at line 13027 of file manage_sql.c.
#define NEW_OVAL_DEFS_HEADER |
Header for "New CERT-Bund Advisories" alert message.
Definition at line 13067 of file manage_sql.c.
#define NOTE_ITERATOR_COLUMNS |
#define NOTE_ITERATOR_FILTER_COLUMNS |
#define NOTE_ITERATOR_TRASH_COLUMNS |
#define NVT_INFO_ITERATOR_FILTER_COLUMNS |
#define NVT_ITERATOR_COLUMNS |
#define NVT_ITERATOR_COLUMNS_NVTS |
#define OPENVASSD_ADDRESS OPENVAS_RUN_DIR "/openvassd.sock" |
Scanner (openvassd) address.
Definition at line 86 of file manage_sql.c.
#define OS_ITERATOR_COLUMNS |
#define OS_ITERATOR_FILTER_COLUMNS |
#define OS_ITERATOR_WHERE_COLUMNS |
#define OVALDEF_INFO_ITERATOR_COLUMNS |
#define OVALDEF_INFO_ITERATOR_FILTER_COLUMNS |
#define OVERRIDE_ITERATOR_COLUMNS |
#define OVERRIDE_ITERATOR_FILTER_COLUMNS |
#define OVERRIDE_ITERATOR_TRASH_COLUMNS |
#define PASSWORD_LENGTH 10 |
#define PERMISSION_ITERATOR_COLUMNS |
#define PERMISSION_ITERATOR_FILTER_COLUMNS |
#define PERMISSION_ITERATOR_TRASH_COLUMNS |
#define PORT_LIST_ITERATOR_COLUMNS |
#define PORT_LIST_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "total", "tcp", "udp", NULL } |
#define PORT_LIST_ITERATOR_TRASH_COLUMNS |
#define PRINT | ( | stream, | |
format, | |||
args... | |||
) |
#define PRINT_REPORT_ERROR | ( | stream, | |
errors, | |||
asset_id | |||
) |
#define PRINT_XML | ( | stream, | |
xml | |||
) |
#define RANGE | ( | type, | |
start, | |||
end | |||
) |
Insert a port range.
Definition at line 14497 of file manage_sql.c.
#define REPORT_FORMAT_ITERATOR_COLUMNS |
#define REPORT_FORMAT_ITERATOR_FILTER_COLUMNS |
#define REPORT_FORMAT_ITERATOR_TRASH_COLUMNS |
#define REPORT_ITERATOR_COLUMNS |
#define REPORT_ITERATOR_FILTER_COLUMNS |
#define REPORT_ITERATOR_WHERE_COLUMNS |
#define RESULT_ITERATOR_COLUMNS |
#define RESULT_ITERATOR_COLUMNS_SEVERITY_FILTERABLE |
#define RESULT_ITERATOR_FILTER_COLUMNS |
#define ROLE_ITERATOR_COLUMNS |
#define ROLE_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, NULL } |
#define ROLE_ITERATOR_TRASH_COLUMNS |
#define SCANNER_ITERATOR_COLUMNS |
#define SCANNER_ITERATOR_FILTER_COLUMNS { GET_ITERATOR_FILTER_COLUMNS, "host", "port", "type", NULL } |
#define SCANNER_ITERATOR_TRASH_COLUMNS |
#define SCHEDULE_ITERATOR_COLUMNS |
#define SCHEDULE_ITERATOR_FILTER_COLUMNS |
#define SCHEDULE_ITERATOR_TRASH_COLUMNS |
#define SECINFO_SIMPLE_NOTICE_FORMAT |
Format string for simple notice alert email.
Definition at line 10702 of file manage_sql.c.
#define SETTING_ITERATOR_COLUMNS |
#define SETTING_ITERATOR_FILTER_COLUMNS { "name", "comment", "value", NULL } |
#define SIMPLE_NOTICE_FORMAT |
Format string for simple notice alert email.
Definition at line 10684 of file manage_sql.c.
#define TAG_ITERATOR_COLUMNS |
#define TAG_ITERATOR_FILTER_COLUMNS |
#define TAG_ITERATOR_TRASH_COLUMNS |
#define TAG_NAME_ITERATOR_COLUMNS |
#define TAG_NAME_ITERATOR_FILTER_COLUMNS { "name", "resource_type", NULL } |
#define TARGET_ITERATOR_COLUMNS |
#define TARGET_ITERATOR_FILTER_COLUMNS |
#define TARGET_ITERATOR_TRASH_COLUMNS |
#define TASK_ITERATOR_COLUMNS |
Task iterator columns.
Definition at line 13934 of file manage_sql.c.
#define TASK_ITERATOR_COLUMNS_INNER |
Task iterator columns.
Definition at line 13713 of file manage_sql.c.
#define TASK_ITERATOR_COLUMNS_MIN |
Task iterator minimal columns.
Definition at line 13944 of file manage_sql.c.
#define TASK_ITERATOR_FILTER_COLUMNS |
Filter columns for task iterator.
Definition at line 13703 of file manage_sql.c.
#define TASK_ITERATOR_WHERE_COLUMNS |
Task iterator WHERE columns.
Definition at line 13925 of file manage_sql.c.
#define TASK_ITERATOR_WHERE_COLUMNS_INNER |
Task iterator WHERE columns.
Definition at line 13751 of file manage_sql.c.
#define TASK_ITERATOR_WHERE_COLUMNS_MIN |
Task iterator minimal WHERE columns.
Definition at line 13953 of file manage_sql.c.
#define USER_ITERATOR_COLUMNS |
#define USER_ITERATOR_FILTER_COLUMNS |
#define USER_ITERATOR_TRASH_COLUMNS |
#define WHERE_OWNER |
void add_role_permission | ( | const gchar * | role, |
const gchar * | permission | ||
) |
Add permission to role.
Caller must ensure args are SQL escaped.
[in] | role | Role. |
[in] | permission | Permission. |
Definition at line 15524 of file manage_sql.c.
References LOCATION_TABLE, and sql().
Add an alert to a task.
[in] | task | Task. |
[in] | alert | Alert. |
Definition at line 18656 of file manage_sql.c.
References LOCATION_TABLE, and sql().
int aggregate_iterator_count | ( | iterator_t * | iterator | ) |
Get the count from an aggregate iterator.
[in] | iterator | Iterator. |
Definition at line 5923 of file manage_sql.c.
References sql_column_int(), and iterator::stmt.
Referenced by buffer_aggregate_xml().
double aggregate_iterator_max | ( | iterator_t * | iterator, |
int | data_column_index | ||
) |
Get the maximum from an aggregate iterator.
[in] | iterator | Iterator. |
[in] | data_column_index | Index of the data column to get max of. |
Definition at line 5953 of file manage_sql.c.
References AGGREGATE_ITERATOR_N_STATS, AGGREGATE_ITERATOR_OFFSET, sql_column_double(), and iterator::stmt.
Referenced by buffer_aggregate_xml().
double aggregate_iterator_mean | ( | iterator_t * | iterator, |
int | data_column_index | ||
) |
Get the mean from an aggregate iterator.
[in] | iterator | Iterator. |
[in] | data_column_index | Index of the data column to get mean of. |
Definition at line 5969 of file manage_sql.c.
References AGGREGATE_ITERATOR_N_STATS, AGGREGATE_ITERATOR_OFFSET, sql_column_double(), and iterator::stmt.
Referenced by buffer_aggregate_xml().
double aggregate_iterator_min | ( | iterator_t * | iterator, |
int | data_column_index | ||
) |
Get the minimum from an aggregate iterator.
[in] | iterator | Iterator. |
[in] | data_column_index | Index of the data column to get min of. |
Definition at line 5937 of file manage_sql.c.
References AGGREGATE_ITERATOR_N_STATS, AGGREGATE_ITERATOR_OFFSET, sql_column_double(), and iterator::stmt.
Referenced by buffer_aggregate_xml().
const char* aggregate_iterator_subgroup_value | ( | iterator_t * | iterator | ) |
Get the value of the subgroup column from an aggregate iterator.
[in] | iterator | Iterator. |
Definition at line 6042 of file manage_sql.c.
References iterator::done, sql_column_text(), and iterator::stmt.
Referenced by buffer_aggregate_xml().
double aggregate_iterator_sum | ( | iterator_t * | iterator, |
int | data_column_index | ||
) |
Get the sum from a statistics iterator.
[in] | iterator | Iterator. |
[in] | data_column_index | Index of the data column to get sum of. |
Definition at line 5985 of file manage_sql.c.
References AGGREGATE_ITERATOR_N_STATS, AGGREGATE_ITERATOR_OFFSET, sql_column_double(), and iterator::stmt.
Referenced by buffer_aggregate_xml().
const char* aggregate_iterator_text | ( | iterator_t * | iterator, |
int | text_column_index, | ||
int | data_columns | ||
) |
Get the value of a text column from an aggregate iterator.
[in] | iterator | Iterator. |
[in] | text_column_index | Index of the text column to get. |
[in] | data_columns | Number of data columns. |
Definition at line 6003 of file manage_sql.c.
References AGGREGATE_ITERATOR_N_STATS, AGGREGATE_ITERATOR_OFFSET, iterator::done, sql_column_text(), and iterator::stmt.
Referenced by buffer_aggregate_xml().
const char* aggregate_iterator_value | ( | iterator_t * | iterator | ) |
Get the value of the group column from a statistics iterator.
[in] | iterator | Iterator. |
Definition at line 6025 of file manage_sql.c.
References iterator::done, sql_column_text(), and iterator::stmt.
Referenced by buffer_aggregate_xml().
int alert_count | ( | const get_data_t * | get | ) |
Count the number of alerts.
[in] | get | GET params. |
Definition at line 8489 of file manage_sql.c.
References ALERT_ITERATOR_COLUMNS, ALERT_ITERATOR_FILTER_COLUMNS, and ALERT_ITERATOR_TRASH_COLUMNS.
char* alert_data | ( | alert_t | alert, |
const char * | type, | ||
const char * | name | ||
) |
Return data associated with an alert.
[in] | alert | Alert. |
[in] | type | Type of data: "condition", "event" or "method". |
[in] | name | Name of the data. |
Definition at line 8810 of file manage_sql.c.
References sql_quote(), and sql_string().
Referenced by alert_condition_description(), and migrate_165_to_166().
const char* alert_data_iterator_data | ( | iterator_t * | iterator | ) |
Return the data from an alert data iterator.
[in] | iterator | Iterator. |
Definition at line 8792 of file manage_sql.c.
References iterator::done, and iterator_string().
const char* alert_data_iterator_name | ( | iterator_t * | iterator | ) |
Return the name from an alert data iterator.
[in] | iterator | Iterator. |
Definition at line 8775 of file manage_sql.c.
References iterator::done, and iterator_string().
char* alert_filter_id | ( | alert_t | alert | ) |
Return the UUID of the filter of an alert.
[in] | alert | Alert. |
Definition at line 8390 of file manage_sql.c.
References sql_string().
int alert_in_use | ( | alert_t | alert | ) |
Return whether a alert is in use by a task.
[in] | alert | Alert. |
Definition at line 8506 of file manage_sql.c.
References sql_int().
int alert_iterator_condition | ( | iterator_t * | iterator | ) |
Return the condition from an alert iterator.
[in] | iterator | Iterator. |
Definition at line 8606 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_int().
int alert_iterator_event | ( | iterator_t * | iterator | ) |
Return the event from an alert iterator.
[in] | iterator | Iterator. |
Definition at line 8590 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_int().
filter_t alert_iterator_filter | ( | iterator_t * | iterator | ) |
Return the filter from an alert iterator.
[in] | iterator | Iterator. |
Definition at line 8638 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_int64().
Referenced by alert_iterator_filter_name(), alert_iterator_filter_readable(), alert_iterator_filter_trash(), and alert_iterator_filter_uuid().
char* alert_iterator_filter_name | ( | iterator_t * | iterator | ) |
Return the filter name from an alert iterator.
[in] | iterator | Iterator. |
Definition at line 8677 of file manage_sql.c.
References alert_iterator_filter(), iterator::done, filter_name(), GET_ITERATOR_COLUMN_COUNT, iterator_int(), LOCATION_TABLE, and trash_filter_name().
int alert_iterator_filter_readable | ( | iterator_t * | iterator | ) |
Return the filter readable state from an alert iterator.
[in] | iterator | Iterator. |
Definition at line 8720 of file manage_sql.c.
References acl_user_has_access_uuid(), alert_iterator_filter(), alert_iterator_filter_uuid(), iterator::done, GET_ITERATOR_COLUMN_COUNT, iterator_int(), and LOCATION_TRASH.
int alert_iterator_filter_trash | ( | iterator_t * | iterator | ) |
Return the location of an alert iterator filter.
[in] | iterator | Iterator. |
Definition at line 8702 of file manage_sql.c.
References alert_iterator_filter(), iterator::done, GET_ITERATOR_COLUMN_COUNT, iterator_int(), and LOCATION_TRASH.
char* alert_iterator_filter_uuid | ( | iterator_t * | iterator | ) |
Return the filter UUID from an alert iterator.
[in] | iterator | Iterator. |
Definition at line 8652 of file manage_sql.c.
References alert_iterator_filter(), iterator::done, filter_uuid(), GET_ITERATOR_COLUMN_COUNT, iterator_int(), LOCATION_TABLE, and trash_filter_uuid().
Referenced by alert_iterator_filter_readable().
int alert_iterator_method | ( | iterator_t * | iterator | ) |
Return the method from an alert iterator.
[in] | iterator | Iterator. |
Definition at line 8622 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_int().
char* alert_name | ( | alert_t | alert | ) |
Return the name of an alert.
[in] | alert | Alert. |
Definition at line 8362 of file manage_sql.c.
References sql_string().
char* alert_owner_uuid | ( | alert_t | alert | ) |
Return the UUID of the owner of an alert.
[in] | alert | Alert. |
Definition at line 8375 of file manage_sql.c.
References sql_string().
const char* alert_task_iterator_name | ( | iterator_t * | iterator | ) |
Return the name from an alert task iterator.
[in] | iterator | Iterator. |
Definition at line 13627 of file manage_sql.c.
References iterator::done, and iterator_string().
int alert_task_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a GET iterator.
[in] | iterator | Iterator. |
Definition at line 13659 of file manage_sql.c.
References iterator::done, and iterator_int().
const char* alert_task_iterator_uuid | ( | iterator_t * | iterator | ) |
Return the uuid from an alert task iterator.
[in] | iterator | Iterator. |
Definition at line 13643 of file manage_sql.c.
References iterator::done, and iterator_string().
char* alert_uuid | ( | alert_t | alert | ) |
Return the UUID of an alert.
[in] | alert | Alert. |
Definition at line 8348 of file manage_sql.c.
References sql_string().
int alert_writable | ( | alert_t | alert | ) |
Return whether a alert is writable.
[in] | alert | Alert. |
Definition at line 8536 of file manage_sql.c.
void array_add_new_string | ( | array_t * | array, |
const gchar * | string | ||
) |
Ensure a string is in an array.
[in] | array | Array. |
[in] | string | String. Copied into array. |
Definition at line 710 of file manage_sql.c.
int authenticate | ( | credentials_t * | credentials | ) |
Authenticate credentials.
[in] | credentials | Credentials. |
Definition at line 17631 of file manage_sql.c.
References authenticate_allow_all, and get_scheduled_user_uuid().
int authenticate_any_method | ( | const gchar * | username, |
const gchar * | password, | ||
auth_method_t * | auth_method | ||
) |
Authenticate, trying any method.
[in] | username | Username. |
[in] | password | Password. |
[out] | auth_method | Auth method return. |
Definition at line 17566 of file manage_sql.c.
int check_config_discovery | ( | const char * | uuid | ) |
Ensure the Discovery config is up to date.
[in] | uuid | UUID of config. |
Definition at line 971 of file manage_config_discovery.c.
References sql().
void check_config_host_discovery | ( | const char * | uuid | ) |
Ensure the Host Discovery config is up to date.
[in] | uuid | UUID of config. |
Definition at line 118 of file manage_config_host_discovery.c.
References NAME, NVT_SELECTOR_TYPE_NVT, sql(), sql_int(), and update_config_cache_init().
int check_config_system_discovery | ( | const char * | uuid | ) |
Ensure the Discovery config is up to date.
[in] | uuid | UUID of config. |
Definition at line 202 of file manage_config_system_discovery.c.
References NVT_SELECTOR_TYPE_NVT, sql(), sql_int(), and update_config_cache_init().
void check_db_sequences | ( | ) |
Ensure sequences for automatic ids are in a consistent state.
Caller must organise a transaction.
Definition at line 2584 of file manage_pg.c.
References cleanup_iterator(), init_iterator(), iterator_string(), next(), sql(), and sql_int64().
int check_db_versions | ( | int | nvt_cache_mode | ) |
Ensure that the databases are the right versions.
[in] | nvt_cache_mode | True when running in NVT caching mode. |
Definition at line 15595 of file manage_sql.c.
References sql_schema(), and sql_string().
void check_generate_scripts | ( | ) |
Ensure the generate scripts are all executable.
Used by a migrator.
Definition at line 16716 of file manage_sql.c.
References cleanup_iterator(), init_iterator(), iterator_int64(), iterator_string(), next(), report_format_uuid(), and user_uuid().
Referenced by migrate_147_to_148().
gchar* clean_hosts | ( | const char * | , |
int * | |||
) |
void cleanup_manage_process | ( | gboolean | cleanup | ) |
Cleanup the manage library.
Optionally put any running task in the stopped state and close the database.
[in] | cleanup | If TRUE perform all cleanup operations, else only those required at the start of a forked process. |
Definition at line 17128 of file manage_sql.c.
Referenced by manage_option_cleanup(), and reinit_manage_process().
void cleanup_prognosis_iterator | ( | ) |
void cleanup_tables | ( | ) |
Clean up database tables.
Remove superfluous entries from tables.
Definition at line 16835 of file manage_sql.c.
References LOCATION_TABLE, LOCATION_TRASH, and sql().
int collate_ip | ( | void * | data, |
int | one_len, | ||
const void * | arg_one, | ||
int | two_len, | ||
const void * | arg_two | ||
) |
Collate two IP addresses.
For example, 127.0.0.2 is less than 127.0.0.3 and 127.0.0.10.
Only works correctly for IPv4 addresses.
[in] | data | Dummy for callback. |
[in] | one_len | Length of first IP (a string). |
[in] | arg_one | First string. |
[in] | two_len | Length of second IP (a string). |
[in] | arg_two | Second string. |
Definition at line 6728 of file manage_sql.c.
int collate_message_type | ( | void * | data, |
int | one_len, | ||
const void * | arg_one, | ||
int | two_len, | ||
const void * | arg_two | ||
) |
Collate two message type strings.
A lower threat is considered less than a higher threat, so Medium is less than High.
[in] | data | Dummy for callback. |
[in] | one_len | Length of first string. |
[in] | arg_one | First string. |
[in] | two_len | Length of second string. |
[in] | arg_two | Second string. |
Definition at line 6638 of file manage_sql.c.
Copy an array of columns.
[in] | columns | Columns. |
Definition at line 1547 of file manage_sql.c.
void column_array_free | ( | column_t * | columns | ) |
Free an array of columns.
[in] | columns | Columns. |
Definition at line 1581 of file manage_sql.c.
References column_t::filter, and column_t::select.
void column_array_print | ( | column_t * | columns | ) |
Print an array of columns.
[in] | columns | Columns. |
Definition at line 1525 of file manage_sql.c.
References column_t::filter, column_t::select, and column_t::type.
void column_array_set | ( | column_t * | columns, |
const gchar * | filter, | ||
gchar * | select | ||
) |
Set the select clause of a column in an array of columns.
Frees the existing select clause.
[in] | columns | Columns. |
[in] | filter | Filter term name. |
[in] | select | Select clause. |
Definition at line 1602 of file manage_sql.c.
References column_t::filter, and column_t::select.
int copy_alert | ( | const char * | name, |
const char * | comment, | ||
const char * | alert_id, | ||
alert_t * | new_alert | ||
) |
Create an alert from an existing alert.
[in] | name | Name of new alert. NULL to copy from existing. |
[in] | comment | Comment on new alert. NULL to copy from existing. |
[in] | alert_id | UUID of existing alert. |
[out] | new_alert | New alert. |
Definition at line 7814 of file manage_sql.c.
References current_credentials, and sql_begin_immediate().
int copy_resource | ( | const char * | type, |
const char * | name, | ||
const char * | comment, | ||
const char * | resource_id, | ||
const char * | columns, | ||
int | make_name_unique, | ||
resource_t * | new_resource | ||
) |
Create a resource from an existing resource.
[in] | type | Type of resource. |
[in] | name | Name of new resource. NULL to copy from existing. |
[in] | comment | Comment on new resource. NULL to copy from existing. |
[in] | resource_id | UUID of existing resource. |
[in] | columns | Extra columns in resource. |
[in] | make_name_unique | When name NULL, whether to make existing name unique. |
[out] | new_resource | New resource. |
Definition at line 4795 of file manage_sql.c.
References current_credentials, and sql_begin_immediate().
int create_alert | ( | const char * | name, |
const char * | comment, | ||
const char * | filter_id, | ||
event_t | event, | ||
GPtrArray * | event_data, | ||
alert_condition_t | condition, | ||
GPtrArray * | condition_data, | ||
alert_method_t | method, | ||
GPtrArray * | method_data, | ||
alert_t * | alert | ||
) |
Create an alert.
[in] | name | Name of alert. |
[in] | comment | Comment on alert. |
[in] | filter_id | Filter. |
[in] | event | Type of event. |
[in] | event_data | Type-specific event data. |
[in] | condition | Event condition. |
[in] | condition_data | Condition-specific data. |
[in] | method | Escalation method. |
[in] | method_data | Data for escalation method. |
[out] | alert | Created alert on success. |
Definition at line 7545 of file manage_sql.c.
int create_port_list_unique | ( | const char * | , |
const char * | , | ||
const char * | , | ||
port_list_t * | |||
) |
void create_tables | ( | ) |
Create all tables.
Definition at line 1506 of file manage_pg.c.
References acl_where_owned_for_get(), LSC_FAMILY_LIST, manage_create_sql_functions(), SEVERITY_ERROR, SEVERITY_LOG, and sql().
int days_from_now | ( | time_t * | epoch_time | ) |
Calculate difference between now and epoch_time in days.
[in] | epoch_time | Time in seconds from epoch. |
Definition at line 1072 of file manage_sql.c.
Referenced by sql_days_from_now().
int delete_alert | ( | const char * | alert_id, |
int | ultimate | ||
) |
Delete an alert.
[in] | alert_id | UUID of alert. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
Definition at line 8195 of file manage_sql.c.
References acl_user_may(), find_alert_with_permission(), sql_begin_immediate(), and sql_rollback().
int delete_reports | ( | task_t | task | ) |
Delete all the reports for a task.
It's up to the caller to ensure that this runs in a contention safe context (for example within an SQL transaction).
[in] | task | A task descriptor. |
Definition at line 733 of file manage.c.
References cleanup_iterator(), delete_report_internal(), init_report_iterator_task(), and next_report().
int delete_slave_task | ( | const char * | , |
int | , | ||
const char * | , | ||
const char * | , | ||
const char * | |||
) |
int delete_task_lock | ( | task_t | , |
int | |||
) |
int email_secinfo | ( | alert_t | alert, |
task_t | task, | ||
event_t | event, | ||
const void * | event_data, | ||
alert_method_t | method, | ||
alert_condition_t | condition, | ||
const gchar * | to_address, | ||
const gchar * | from_address | ||
) |
Build and send email for SecInfo alert.
[in] | alert | Alert. |
[in] | task | Task. |
[in] | event | Event. |
[in] | event_data | Event data. |
[in] | method | Method from alert. |
[in] | condition | Condition from alert, which was met by event. |
[in] | to_address | To address. |
[in] | from_address | From address. |
Definition at line 11164 of file manage_sql.c.
int family_count | ( | ) |
int filter_control_int | ( | keyword_t ** | point, |
const char * | column, | ||
int * | val | ||
) |
Get an int column from a filter split.
[in] | point | Filter split. |
[in] | column | Name of column. |
[out] | val | Value of column. |
Definition at line 2395 of file manage_sql.c.
References keyword::column, and keyword::string.
Referenced by manage_report_filter_controls().
int filter_control_str | ( | keyword_t ** | point, |
const char * | column, | ||
gchar ** | string | ||
) |
Get a string column from a filter split.
[in] | point | Filter split. |
[in] | column | Name of column. |
[out] | string | Value of column, freshly allocated. |
Definition at line 2424 of file manage_sql.c.
References keyword::column, and keyword::string.
Referenced by manage_report_filter_controls().
void filter_free | ( | array_t * | split | ) |
Free a split filter.
[in] | split | Split filter. |
Definition at line 2018 of file manage_sql.c.
Referenced by manage_filter_controls(), and manage_report_filter_controls().
gboolean find_alert_with_permission | ( | const char * | uuid, |
alert_t * | alert, | ||
const char * | permission | ||
) |
Find a alert for a specific permission, given a UUID.
[in] | uuid | UUID of alert. |
[out] | alert | Alert return, 0 if succesfully failed to find alert. |
[in] | permission | Permission. |
Definition at line 6983 of file manage_sql.c.
References find_resource_with_permission().
Referenced by delete_alert(), manage_test_alert(), and set_task_alerts().
gboolean find_group | ( | const char * | , |
group_t * | |||
) |
gboolean find_resource | ( | const char * | type, |
const char * | uuid, | ||
resource_t * | resource | ||
) |
Find a resource given a UUID.
[in] | type | Type of resource. |
[in] | uuid | UUID of resource. |
[out] | resource | Resource return, 0 if succesfully failed to find resource. |
Definition at line 4411 of file manage_sql.c.
References acl_user_owns_uuid(), sql_int64(), and sql_quote().
gboolean find_resource_by_name_with_permission | ( | const char * | type, |
const char * | name, | ||
resource_t * | resource, | ||
const char * | permission | ||
) |
Find a resource given a UUID and a permission.
[in] | type | Type of resource. |
[in] | name | Name of resource. |
[out] | resource | Resource return, 0 if succesfully failed to find resource. |
[in] | permission | Permission. |
Definition at line 4554 of file manage_sql.c.
References acl_user_has_access_uuid(), sql_int64(), sql_quote(), and sql_string().
gboolean find_resource_with_permission | ( | const char * | type, |
const char * | uuid, | ||
resource_t * | resource, | ||
const char * | permission, | ||
int | trash | ||
) |
Find a resource given a UUID and a permission.
[in] | type | Type of resource. |
[in] | uuid | UUID of resource. |
[out] | resource | Resource return, 0 if succesfully failed to find resource. |
[in] | permission | Permission. |
[in] | trash | Whether resource is in trashcan. |
Definition at line 4459 of file manage_sql.c.
References acl_user_has_access_uuid(), sql_int64(), sql_quote(), and valid_type().
Referenced by find_alert_with_permission().
gboolean find_role | ( | const char * | , |
group_t * | |||
) |
gboolean find_role_with_permission | ( | const char * | , |
role_t * | , | ||
const char * | |||
) |
int info_name_count | ( | const char * | type, |
const char * | name | ||
) |
Count number of info of a given subtype with a given name.
[in] | type | GET_INFO subtype. |
[out] | name | Name of the info item. |
Definition at line 6182 of file manage_sql.c.
int init_aggregate_iterator | ( | iterator_t * | iterator, |
const char * | type, | ||
const get_data_t * | get, | ||
int | distinct, | ||
GArray * | data_columns, | ||
const char * | group_column, | ||
const char * | subgroup_column, | ||
GArray * | text_columns, | ||
GArray * | sort_data, | ||
int | first_group, | ||
int | max_groups, | ||
const char * | extra_tables, | ||
const char * | extra_where | ||
) |
Initialise a GET_AGGREGATES iterator, including observed resources.
[in] | iterator | Iterator. |
[in] | type | Type of resource. |
[in] | get | GET data. |
[in] | distinct | Whether the query should be distinct. Skipped for trash and single resource. |
[in] | data_columns | Columns to calculate statistics for. |
[in] | group_column | Column to group data by. |
[in] | subgroup_column | Column to further group data by. |
[in] | text_columns | Columns to get text from. |
[in] | sort_data | GArray of sorting data. |
[in] | first_group | Row number to start iterating from. |
[in] | max_groups | Maximum number of rows. |
[in] | extra_tables | Join tables. Skipped for trash and single resource. |
[in] | extra_where | Extra WHERE clauses. Skipped for single resource. |
Definition at line 5402 of file manage_sql.c.
References get_data_t::filt_id, get_data_t::filter, get_data_t::filter_replacement, filter_term(), filter_term_value(), get_data_t::id, init_iterator(), manage_cert_loaded(), manage_scap_loaded(), MIN_QOD_DEFAULT, sql_select_limit(), get_data_t::trash, type_columns(), type_filter_columns(), type_opts_table(), type_owned(), type_select_columns(), type_trash_columns(), and type_where_columns().
void init_alert_data_iterator | ( | iterator_t * | iterator, |
alert_t | alert, | ||
int | trash, | ||
const char * | table | ||
) |
Initialise an alert data iterator.
[in] | iterator | Iterator. |
[in] | alert | Alert. |
[in] | trash | Whether to iterate over trashcan alert data. |
[in] | table | Type of data: "condition", "event" or "method", corresponds to substring of the table to select from. |
Definition at line 8756 of file manage_sql.c.
References init_iterator().
int init_alert_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise an alert iterator, including observed alerts.
[in] | iterator | Iterator. |
[in] | get | GET data. |
Definition at line 8564 of file manage_sql.c.
References ALERT_ITERATOR_COLUMNS, ALERT_ITERATOR_FILTER_COLUMNS, and ALERT_ITERATOR_TRASH_COLUMNS.
void init_alert_task_iterator | ( | iterator_t * | iterator, |
alert_t | alert, | ||
int | ascending | ||
) |
Initialise an alert task iterator.
Iterate over all tasks that use the alert.
[in] | iterator | Iterator. |
[in] | alert | Alert. |
[in] | ascending | Whether to sort ascending or descending. |
Definition at line 13591 of file manage_sql.c.
References acl_where_owned(), init_iterator(), and get_data_t::trash.
int init_manage | ( | 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(*)() | update_progress, | ||
int(*)(openvas_connection_t *, gchar *) | fork_connection, | ||
int | skip_db_check | ||
) |
Initialize the manage library.
Check DB version, do startup database checks, load the NVT cache.
Ensure all tasks are in a clean initial state.
Beware that calling this function while tasks are running may lead to problems.
[in] | log_config | Log configuration. |
[in] | nvt_cache_mode | True when running in NVT caching mode. |
[in] | database | Location of 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] | update_progress | Function to update progress, or NULL. * |
[in] | fork_connection | Function to fork a connection that will accept OMP requests. Used to start tasks with OMP when an alert occurs. |
[in] | skip_db_check | Skip DB check. |
Definition at line 17065 of file manage_sql.c.
int init_manage_helper | ( | GSList * | log_config, |
const gchar * | database, | ||
int | max_ips_per_target, | ||
void(*)() | update_progress | ||
) |
Initialize the manage library for a helper program.
This should be called at the beginning of any program that accesses the database. Forked processes should call init_manage_process. The daemon itself calls init_manage, including in NVT cache mode (–rebuild/update).
[in] | log_config | Log configuration. |
[in] | database | Location of database. |
[in] | max_ips_per_target | Max number of IPs per target. |
[in] | update_progress | Function to update progress, or NULL. * |
Definition at line 17102 of file manage_sql.c.
void init_manage_process | ( | int | update_nvt_cache, |
const gchar * | database | ||
) |
Initialize the manage library for a process.
Open the SQL database, attach secondary databases, and define functions.
[in] | update_nvt_cache | 0 operate normally, -1 just update NVT cache, -2 just rebuild NVT cache. |
[in] | database | Location of manage database. |
Definition at line 14303 of file manage_sql.c.
Referenced by reinit_manage_process().
void init_task_alert_iterator | ( | iterator_t * | iterator, |
task_t | task, | ||
event_t | event | ||
) |
Initialise a task alert iterator.
[in] | iterator | Iterator. |
[in] | task | Task. |
[in] | event | Event. |
Definition at line 8837 of file manage_sql.c.
void init_task_group_iterator | ( | iterator_t * | iterator, |
task_t | task | ||
) |
Initialise a task group iterator.
[in] | iterator | Iterator. |
[in] | task | Task. |
Definition at line 6822 of file manage_sql.c.
References init_iterator(), and LOCATION_TABLE.
int init_task_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise a task iterator.
[in] | iterator | Task iterator. |
[in] | get | GET data. |
Definition at line 14024 of file manage_sql.c.
References get_data_t::filt_id, get_data_t::filter, filter_term(), filter_term_value(), MIN_QOD_DEFAULT, TASK_ITERATOR_COLUMNS, TASK_ITERATOR_COLUMNS_MIN, TASK_ITERATOR_FILTER_COLUMNS, TASK_ITERATOR_WHERE_COLUMNS, and TASK_ITERATOR_WHERE_COLUMNS_MIN.
Referenced by stop_active_tasks().
void init_task_role_iterator | ( | iterator_t * | iterator, |
task_t | task | ||
) |
Initialise a task role iterator.
[in] | iterator | Iterator. |
[in] | task | Task. |
Definition at line 6851 of file manage_sql.c.
References init_iterator(), and LOCATION_TABLE.
void init_task_user_iterator | ( | iterator_t * | iterator, |
task_t | task | ||
) |
Initialise a task user iterator.
[in] | iterator | Iterator. |
[in] | task | Task. |
Definition at line 6797 of file manage_sql.c.
References init_iterator(), and LOCATION_TABLE.
Referenced by task_observers().
char* iso_time | ( | time_t * | epoch_time | ) |
Create an ISO time from seconds since epoch.
[in] | epoch_time | Time in seconds from epoch. |
Definition at line 1138 of file manage_sql.c.
Referenced by buffer_aggregate_xml(), certificate_iso_time(), iso_time_tz(), and sql_iso_time().
char* iso_time_tz | ( | time_t * | epoch_time, |
const char * | timezone, | ||
const char ** | abbrev | ||
) |
Create an ISO time from seconds since epoch, given a timezone.
[in] | epoch_time | Time in seconds from epoch. |
[in] | timezone | Timezone. |
[out] | abbrev | Timezone abbreviation. |
Definition at line 1153 of file manage_sql.c.
References iso_time().
const char* keyword_relation_symbol | ( | keyword_relation_t | relation | ) |
Get the symbol of a keyword relation.
[in] | relation | Relation. |
Definition at line 1627 of file manage_sql.c.
References KEYWORD_RELATION_APPROX, KEYWORD_RELATION_COLUMN_ABOVE, KEYWORD_RELATION_COLUMN_APPROX, KEYWORD_RELATION_COLUMN_BELOW, KEYWORD_RELATION_COLUMN_EQUAL, and KEYWORD_RELATION_COLUMN_REGEXP.
void make_config_discovery | ( | char * const | , |
const char * const | |||
) |
void make_config_discovery_service_detection | ( | char *const | selector_name | ) |
Make Discovery Scan Config.
Caller must lock the db.
[in] | selector_name | Name of NVT selector to use. |
Definition at line 53 of file manage_config_discovery.c.
References NVT_SELECTOR.
Referenced by make_config_discovery().
void make_config_host_discovery | ( | char * const | , |
const char * const | |||
) |
void make_config_system_discovery | ( | char * const | , |
const char * const | |||
) |
void make_port_ranges_all_tcp_nmap_5_51_top_100 | ( | port_list_t | list | ) |
Make port ranges for IANA TCP 2012.
Caller must lock the db.
[in] | list | Port list. |
Definition at line 48 of file manage_ranges_all_tcp_nmap_5_51_top_100.c.
References RANGE.
void make_port_ranges_all_tcp_nmap_5_51_top_1000 | ( | port_list_t | list | ) |
Make port ranges for IANA TCP 2012.
Caller must lock the db.
[in] | list | Port list. |
Definition at line 48 of file manage_ranges_all_tcp_nmap_5_51_top_1000.c.
References RANGE.
void make_port_ranges_iana_tcp_2012 | ( | port_list_t | list | ) |
Make port ranges for IANA TCP 2012.
Caller must lock the db.
[in] | list | Port list. |
Definition at line 48 of file manage_ranges_iana_tcp_2012.c.
References RANGE.
void make_port_ranges_iana_tcp_udp_2012 | ( | port_list_t | list | ) |
Make port ranges for IANA TCP and UDP 2012.
Caller must lock the db.
[in] | list | Port list. |
Definition at line 48 of file manage_ranges_iana_tcp_udp_2012.c.
References RANGE.
void make_port_ranges_nmap_5_51_top_2000_top_100 | ( | port_list_t | list | ) |
Make port ranges for Nmap top 2000 top 100.
Caller must lock the db.
[in] | list | Port list. |
Definition at line 48 of file manage_ranges_nmap_5_51_top_2000_top_100.c.
References RANGE.
int manage_alert | ( | const char * | alert_id, |
const char * | task_id, | ||
event_t | event, | ||
const void * | event_data, | ||
gchar ** | script_message | ||
) |
Escalate an alert with task and event data.
[in] | alert_id | Alert UUID. |
[in] | task_id | Task UUID. |
[in] | event | Event. |
[in] | event_data | Event data. |
[out] | script_message | Custom error message from alert script. |
Definition at line 12984 of file manage_sql.c.
void manage_attach_databases | ( | ) |
Attach external databases.
Definition at line 2624 of file manage_pg.c.
References manage_cert_loaded(), manage_scap_loaded(), sql(), and sql_error().
int manage_cert_db_supported_version | ( | ) |
Return the database version supported by this manager.
Definition at line 6322 of file manage_sql.c.
int manage_cert_db_version | ( | ) |
Return the database version of the actual database.
Definition at line 6333 of file manage_sql.c.
References manage_cert_loaded(), and sql_string().
int manage_cert_loaded | ( | ) |
Check whether CERT is available.
Definition at line 2643 of file manage_pg.c.
References sql_database(), sql_error(), and sql_int().
Referenced by init_aggregate_iterator(), manage_attach_databases(), and manage_cert_db_version().
int manage_check_alerts | ( | GSList * | log_config, |
const gchar * | database | ||
) |
Check if any SecInfo alerts are due.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
Definition at line 6886 of file manage_sql.c.
gchar* manage_clean_filter | ( | const gchar * | filter | ) |
Clean a filter.
[in] | filter | Filter. |
Definition at line 2818 of file manage_sql.c.
References manage_clean_filter_remove().
gchar* manage_clean_filter_remove | ( | const gchar * | filter, |
const gchar * | column | ||
) |
Clean a filter, removing a keyword in the process.
[in] | filter | Filter. |
[in] | column | Keyword to remove, or NULL. |
Definition at line 2743 of file manage_sql.c.
References keyword::column, KEYWORD_RELATION_COLUMN_EQUAL, keyword::relation, and split_filter().
Referenced by init_get(), and manage_clean_filter().
void manage_cleanup_process_error | ( | int | signal | ) |
Cleanup as immediately as possible.
Put any running task in the error state and close the database.
Intended for handlers for signals like SIGSEGV and SIGABRT.
[in] | signal | Dummy argument for use as signal handler. |
Definition at line 17154 of file manage_sql.c.
References current_scanner_task, set_task_run_status(), sql_close(), sql_is_open(), and TASK_STATUS_INTERNAL_ERROR.
Referenced by handle_sigabrt(), and handle_sigsegv().
int manage_create_sql_functions | ( | ) |
Create functions.
Definition at line 113 of file manage_pg.c.
References LOCATION_TABLE, LOCATION_TRASH, manage_db_version(), manage_scap_loaded(), OVERRIDES_SQL, SEVERITY_DEBUG, SEVERITY_ERROR, SEVERITY_FP, SEVERITY_LOG, sql(), sql_clean_hosts(), sql_common_cve(), sql_cpe_title(), sql_credential_value(), sql_current_offset(), sql_database(), sql_days_from_now(), sql_hosts_contains(), sql_int(), sql_iso_time(), sql_make_uuid(), sql_max_hosts(), sql_next_time(), sql_now(), sql_order_inet(), sql_order_message_type(), sql_order_port(), sql_order_role(), sql_order_threat(), sql_parse_time(), sql_regexp(), sql_report_host_count(), sql_report_progress(), sql_report_result_host_count(), sql_report_severity(), sql_report_severity_count(), sql_resource_exists(), sql_resource_name(), sql_run_status_name(), sql_severity_in_level(), sql_severity_matches_ov(), sql_severity_to_level(), sql_severity_to_type(), sql_strpos(), sql_t(), sql_tag(), sql_target_credential(), sql_target_login_port(), sql_task_last_report(), sql_task_severity(), sql_task_threat_level(), sql_task_trend(), sql_trash_target_credential_location(), sql_uniquify(), sql_user_can_everything(), sql_user_owns(), task_db, TASK_STATUS_DELETE_REQUESTED, TASK_STATUS_DELETE_ULTIMATE_REQUESTED, TASK_STATUS_DELETE_ULTIMATE_WAITING, TASK_STATUS_DELETE_WAITING, TASK_STATUS_DONE, TASK_STATUS_NEW, TASK_STATUS_REQUESTED, TASK_STATUS_RUNNING, TASK_STATUS_STOP_REQUESTED, TASK_STATUS_STOP_REQUESTED_GIVEUP, TASK_STATUS_STOP_WAITING, and TASK_STATUS_STOPPED.
Referenced by create_tables().
int manage_db_supported_version | ( | ) |
Return the database version supported by this manager.
Definition at line 6250 of file manage_sql.c.
int manage_db_version | ( | ) |
Return the database version of the actual database.
Definition at line 6262 of file manage_sql.c.
References manage_db_empty(), sql_schema(), and sql_string().
Referenced by manage_create_sql_functions(), migrate_0_to_1(), migrate_100_to_101(), migrate_101_to_102(), migrate_102_to_103(), migrate_103_to_104(), migrate_104_to_105(), migrate_105_to_106(), migrate_106_to_107(), migrate_107_to_108(), migrate_108_to_109(), migrate_109_to_110(), migrate_10_to_11(), migrate_110_to_111(), migrate_111_to_112(), migrate_112_to_113(), migrate_113_to_114(), migrate_114_to_115(), migrate_115_to_116(), migrate_116_to_117(), migrate_117_to_118(), migrate_118_to_119(), migrate_119_to_120(), migrate_11_to_12(), migrate_120_to_121(), migrate_121_to_122(), migrate_122_to_123(), migrate_123_to_124(), migrate_124_to_125(), migrate_125_to_126(), migrate_126_to_127(), migrate_127_to_128(), migrate_128_to_129(), migrate_129_to_130(), migrate_12_to_13(), migrate_130_to_131(), migrate_131_to_132(), migrate_132_to_133(), migrate_133_to_134(), migrate_134_to_135(), migrate_135_to_136(), migrate_136_to_137(), migrate_137_to_138(), migrate_138_to_139(), migrate_139_to_140(), migrate_13_to_14(), migrate_140_to_141(), migrate_141_to_142(), migrate_142_to_143(), migrate_143_to_144(), migrate_144_to_145(), migrate_145_to_146(), migrate_146_to_147(), migrate_147_to_148(), migrate_148_to_149(), migrate_149_to_150(), migrate_14_to_15(), migrate_150_to_151(), migrate_151_to_152(), migrate_152_to_153(), migrate_153_to_154(), migrate_154_to_155(), migrate_155_to_156(), migrate_156_to_157(), migrate_157_to_158(), migrate_158_to_159(), migrate_159_to_160(), migrate_15_to_16(), migrate_160_to_161(), migrate_161_to_162(), migrate_162_to_163(), migrate_163_to_164(), migrate_164_to_165(), migrate_165_to_166(), migrate_166_to_167(), migrate_167_to_168(), migrate_168_to_169(), migrate_169_to_170(), migrate_16_to_17(), migrate_170_to_171(), migrate_171_to_172(), migrate_172_to_173(), migrate_173_to_174(), migrate_174_to_175(), migrate_175_to_176(), migrate_176_to_177(), migrate_177_to_178(), migrate_178_to_179(), migrate_179_to_180(), migrate_17_to_18(), migrate_180_to_181(), migrate_181_to_182(), migrate_182_to_183(), migrate_183_to_184(), migrate_18_to_19(), migrate_19_to_20(), migrate_1_to_2(), migrate_20_to_21(), migrate_21_to_22(), migrate_22_to_23(), migrate_23_to_24(), migrate_24_to_25(), migrate_25_to_26(), migrate_26_to_27(), migrate_27_to_28(), migrate_28_to_29(), migrate_29_to_30(), migrate_2_to_3(), migrate_30_to_31(), migrate_31_to_32(), migrate_32_to_33(), migrate_33_to_34(), migrate_34_to_35(), migrate_35_to_36(), migrate_36_to_37(), migrate_37_to_38(), migrate_38_to_39(), migrate_39_to_40(), migrate_3_to_4(), migrate_40_to_41(), migrate_41_to_42(), migrate_42_to_43(), migrate_43_to_44(), migrate_44_to_45(), migrate_45_to_46(), migrate_46_to_47(), migrate_47_to_48(), migrate_48_to_49(), migrate_49_to_50(), migrate_4_to_5(), migrate_50_to_51(), migrate_51_to_52(), migrate_52_to_53(), migrate_53_to_54(), migrate_54_to_55(), migrate_55_to_56(), migrate_56_to_57(), migrate_57_to_58(), migrate_58_to_59(), migrate_59_to_60(), migrate_5_to_6(), migrate_60_to_61(), migrate_61_to_62(), migrate_62_to_63(), migrate_63_to_64(), migrate_64_to_65(), migrate_65_to_66(), migrate_66_to_67(), migrate_67_to_68(), migrate_68_to_69(), migrate_69_to_70(), migrate_6_to_7(), migrate_70_to_71(), migrate_71_to_72(), migrate_72_to_73(), migrate_73_to_74(), migrate_74_to_75(), migrate_75_to_76(), migrate_76_to_77(), migrate_77_to_78(), migrate_78_to_79(), migrate_7_to_8(), migrate_80_to_81(), migrate_81_to_82(), migrate_82_to_83(), migrate_83_to_84(), migrate_84_to_85(), migrate_85_to_86(), migrate_86_to_87(), migrate_87_to_88(), migrate_88_to_89(), migrate_89_to_90(), migrate_8_to_9(), migrate_90_to_91(), migrate_91_to_92(), migrate_92_to_93(), migrate_93_to_94(), migrate_94_to_95(), migrate_95_to_96(), migrate_96_to_97(), migrate_97_to_98(), migrate_98_to_99(), migrate_99_to_100(), and migrate_9_to_10().
int manage_decrypt_all_credentials | ( | GSList * | log_config, |
const gchar * | database | ||
) |
Decrypt all credentials.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
Definition at line 6599 of file manage_sql.c.
int manage_encrypt_all_credentials | ( | GSList * | log_config, |
const gchar * | database | ||
) |
Encrypt or re-encrypt all credentials.
All plaintext credentials in the credentials table are encrypted, all already encrypted credentials are encrypted again using the latest key.
[in] | log_config | Log configuration. |
[in] | database | Location of manage database. |
Definition at line 6567 of file manage_sql.c.
void manage_filter_controls | ( | const gchar * | filter, |
int * | first, | ||
int * | max, | ||
gchar ** | sort_field, | ||
int * | sort_order | ||
) |
Get info from a filter.
It's up to the caller to ensure that max is adjusted for Max Rows Per Page (by calling manage_max_rows).
[in] | filter | Filter. |
[out] | first | Number of first item. |
[out] | max | Max number of rows. |
[out] | sort_field | Sort field. |
[out] | sort_order | Sort order. |
Definition at line 2289 of file manage_sql.c.
References keyword::column, filter_free(), SETTING_UUID_ROWS_PER_PAGE, setting_value_int(), split_filter(), and keyword::string.
Referenced by init_get().
void manage_option_cleanup | ( | ) |
Cleanup for an option process.
Definition at line 1504 of file manage_sql.c.
References cleanup_manage_process().
int manage_option_setup | ( | GSList * | log_config, |
const gchar * | database | ||
) |
Setup for an option process.
[in] | log_config | Log configuration. |
[in] | database | Database. |
Definition at line 1463 of file manage_sql.c.
char* manage_port_name | ( | int | number, |
const char * | protocol | ||
) |
Returns associated name for a tcp/ip port.
number | Port number to get name for. |
protocol | Protocol type of port. |
Definition at line 6359 of file manage_sql.c.
References sql_string().
Referenced by port_name_formatted().
void manage_report_filter_controls | ( | const gchar * | filter, |
int * | first, | ||
int * | max, | ||
gchar ** | sort_field, | ||
int * | sort_order, | ||
int * | result_hosts_only, | ||
gchar ** | min_qod, | ||
gchar ** | levels, | ||
gchar ** | delta_states, | ||
gchar ** | search_phrase, | ||
int * | search_phrase_exact, | ||
int * | autofp, | ||
int * | notes, | ||
int * | overrides, | ||
int * | apply_overrides, | ||
gchar ** | zone | ||
) |
Get info from a filter for report.
It's up to the caller to ensure that max is adjusted for Max Rows Per Page (by calling manage_max_rows).
[in] | filter | Filter. |
[out] | first | Number of first item. |
[out] | max | Max number of rows. |
[out] | sort_field | Sort field. |
[out] | sort_order | Sort order. |
[out] | result_hosts_only | Whether to show only hosts with results. |
[out] | min_qod | Minimum QoD base of included results. All results if NULL. |
[out] | levels | String describing threat levels (message types) to include in count (for example, "hmlgd" for High, Medium, Low, loG and Debug). All levels if NULL. |
[out] | delta_states | String describing delta states to include in count (for example, "sngc" Same, New, Gone and Changed). All levels if NULL. |
[out] | search_phrase | Phrase that results must include. All results if NULL or "". |
[out] | search_phrase_exact | Whether search phrase is exact. |
[out] | autofp | Whether to apply auto FP filter. |
[out] | notes | Whether to include notes. |
[out] | overrides | Whether to include overrides. |
[out] | apply_overrides | Whether to apply overrides. |
[out] | zone | Timezone. |
Definition at line 2474 of file manage_sql.c.
References keyword::column, keyword::equal, filter_control_int(), filter_control_str(), filter_free(), SETTING_UUID_ROWS_PER_PAGE, setting_value_int(), split_filter(), and keyword::string.
void manage_reset_currents | ( | ) |
Cleanup as immediately as possible.
Definition at line 17173 of file manage_sql.c.
References current_report, and current_scanner_task.
int manage_resource_name | ( | const char * | type, |
const char * | uuid, | ||
char ** | name | ||
) |
Get the name of a resource.
[in] | type | Type. |
[in] | uuid | UUID. |
[out] | name | Return for freshly allocated name. |
Definition at line 4942 of file manage_sql.c.
References LOCATION_TABLE, and resource_name().
int manage_scanner_set | ( | const char * | uuid | ) |
Set the address of scanner to connect to.
[in] | uuid | Scanner UUID. |
Definition at line 17377 of file manage_sql.c.
References current_credentials, find_scanner(), openvas_scanner_set_address(), openvas_scanner_set_unix(), scanner_ca_pub(), scanner_host(), scanner_key_priv(), scanner_key_pub(), scanner_port(), SCANNER_TYPE_OPENVAS, and set_certs().
Referenced by manage_scanner_set_default().
int manage_scanner_set_default | ( | ) |
Set the default scanner as the scanner to connect to.
Definition at line 17440 of file manage_sql.c.
References manage_scanner_set(), and SCANNER_UUID_DEFAULT.
int manage_scap_db_supported_version | ( | ) |
Return the database version supported by this manager.
Definition at line 6288 of file manage_sql.c.
int manage_scap_db_version | ( | ) |
Return the database version of the actual database.
Definition at line 6299 of file manage_sql.c.
References manage_scap_loaded(), and sql_string().
int manage_scap_loaded | ( | ) |
Check whether SCAP is available.
Definition at line 2659 of file manage_pg.c.
References sql_database(), sql_error(), and sql_int().
Referenced by init_aggregate_iterator(), manage_attach_databases(), manage_create_sql_functions(), manage_scap_db_version(), and sql_cpe_title().
int manage_test_alert | ( | const char * | alert_id, |
gchar ** | script_message | ||
) |
Test an alert.
[in] | alert_id | Alert UUID. |
[out] | script_message | Custom message from the alert script. |
Definition at line 13084 of file manage_sql.c.
References acl_user_may(), find_alert_with_permission(), and task_id().
int manage_trash_resource_name | ( | const char * | type, |
const char * | uuid, | ||
char ** | name | ||
) |
Get the name of a trashcan resource.
[in] | type | Type. |
[in] | uuid | UUID. |
[out] | name | Return for freshly allocated name. |
Definition at line 4957 of file manage_sql.c.
References LOCATION_TRASH, and resource_name().
int manage_update_nvti_cache | ( | ) |
Update the memory cache of NVTs, if this has been requested.
Definition at line 14475 of file manage_sql.c.
References sql_begin_immediate_giveup(), sql_int(), and sql_schema().
Referenced by manage_schedule().
gchar* manage_user_hash | ( | const gchar * | username | ) |
Get user hash.
This is for "file" users, now entirely stored in db.
[in] | username | User name. |
Definition at line 17189 of file manage_sql.c.
References sql_quote(), and sql_string().
const char* message_type_threat | ( | const char * | type | ) |
int modify_alert | ( | const char * | alert_id, |
const char * | name, | ||
const char * | comment, | ||
const char * | filter_id, | ||
event_t | event, | ||
GPtrArray * | event_data, | ||
alert_condition_t | condition, | ||
GPtrArray * | condition_data, | ||
alert_method_t | method, | ||
GPtrArray * | method_data | ||
) |
Modify an alert.
[in] | alert_id | UUID of alert. |
[in] | name | Name of alert. |
[in] | comment | Comment on alert. |
[in] | filter_id | Filter. |
[in] | event | Type of event. |
[in] | event_data | Type-specific event data. |
[in] | condition | Event condition. |
[in] | condition_data | Condition-specific data. |
[in] | method | Escalation method. |
[in] | method_data | Data for escalation method. |
Definition at line 7894 of file manage_sql.c.
gchar* omp_command_type | ( | const char * | name | ) |
Get the type associated with an OMP command.
[in] | name | Command name. |
Definition at line 565 of file manage_sql.c.
References valid_type().
int parse_iso_time | ( | const char * | text_time | ) |
Convert an ISO time into seconds since epoch.
For backward compatibility, if the conversion fails try parse in ctime format.
[in] | text_time | Time as text in ISO format: 2011-11-03T09:23:28+02:00. |
Definition at line 875 of file manage_sql.c.
Referenced by manage_system_report(), and set_task_start_time().
int parse_time | ( | const gchar * | string, |
int * | seconds | ||
) |
Try convert an OTP NVT tag time string into epoch time.
[in] | string | String. |
[out] | seconds | Time as seconds since the epoch. |
Definition at line 1308 of file manage_sql.c.
Referenced by sql_parse_time().
resource_t permission_subject | ( | permission_t | ) |
char* permission_subject_type | ( | permission_t | ) |
void permissions_set_locations | ( | const char * | , |
resource_t | , | ||
resource_t | , | ||
int | |||
) |
void permissions_set_orphans | ( | const char * | , |
resource_t | , | ||
int | |||
) |
void permissions_set_subjects | ( | const char * | , |
resource_t | , | ||
resource_t | , | ||
int | |||
) |
gchar* port_name_formatted | ( | const char * | field | ) |
Returns formatted port number, protocol and iana name from.
field in "number/proto" form.
field | Number/Protocol string. |
Definition at line 6378 of file manage_sql.c.
References manage_port_name().
gchar* predefined_report_format_dir | ( | const gchar * | uuid | ) |
Get the directory of a report format.
[in] | uuid | Report format UUID. NULL to get parent dir. |
Definition at line 7077 of file manage.c.
Referenced by init_report_format_file_iterator().
void refresh_nvt_cves | ( | ) |
Refresh nvt_cves table.
Caller must organise transaction.
Definition at line 15545 of file manage_sql.c.
References cleanup_iterator(), init_iterator(), iterator_int64(), iterator_string(), next(), sql(), sql_insert(), and sql_is_sqlite3().
void reinit_manage_process | ( | ) |
Reinitialize the manage library for a process.
This is mandatory after a fork, to not carry open databases around (refer to database documentation).
Definition at line 14347 of file manage_sql.c.
References cleanup_manage_process(), init_manage_process(), and task_db_name.
Referenced by manage_schedule().
int resource_count | ( | const char * | type, |
const get_data_t * | get | ||
) |
Return number of resources of a certain type for current user.
[in] | type | Type. |
[in] | get | GET params. |
Definition at line 17704 of file manage_sql.c.
References get_data_t::filter, SEVERITY_ERROR, get_data_t::trash, and type_owned().
int resource_exists | ( | const char * | type, |
resource_t | resource, | ||
int | location | ||
) |
Get whether a resource exists.
[in] | type | Type. |
[in] | resource | Resource. |
[in] | location | Location. |
Definition at line 4826 of file manage_sql.c.
References LOCATION_TABLE, sql_int(), and valid_db_resource_type().
Referenced by sql_resource_exists().
int resource_id_exists | ( | const char * | type, |
const char * | id | ||
) |
Test whether a resource of the given type and unique ID exists.
[in] | type | Type. |
[in] | id | Unique ID. |
Definition at line 17760 of file manage_sql.c.
References sql_int().
int resource_name | ( | const char * | type, |
const char * | uuid, | ||
int | location, | ||
char ** | name | ||
) |
Get the name of a resource.
[in] | type | Type. |
[in] | uuid | UUID. |
[in] | location | Location. |
[out] | name | Return for freshly allocated name. |
Definition at line 4852 of file manage_sql.c.
References LOCATION_TABLE, sql_string(), and valid_db_resource_type().
Referenced by manage_resource_name(), and manage_trash_resource_name().
gchar* resource_uuid | ( | const gchar * | type, |
resource_t | resource | ||
) |
Get the UUID of a resource.
[in] | type | Type. |
[in] | resource | Resource. |
Definition at line 4971 of file manage_sql.c.
References sql_string(), and valid_db_resource_type().
int role_is_predefined | ( | role_t | ) |
int role_is_predefined_id | ( | const char * | ) |
int set_certs | ( | const char * | ca_pub, |
const char * | key_pub, | ||
const char * | key_priv | ||
) |
Initialise OpenVAS scanner variables, checking for defaults.
[in] | ca_pub | CA Certificate. |
[in] | key_pub | Scanner Certificate. |
[in] | key_priv | Scanner private key. |
Definition at line 4312 of file manage.c.
References manage_default_ca_cert(), and openvas_scanner_set_certs().
Referenced by manage_scanner_set().
void set_db_version | ( | int | version | ) |
Set the database version of the actual database.
Caller must organise transaction.
version | New version number. |
Definition at line 6416 of file manage_sql.c.
References sql(), and sql_schema().
Referenced by migrate_0_to_1(), migrate_100_to_101(), migrate_101_to_102(), migrate_102_to_103(), migrate_103_to_104(), migrate_104_to_105(), migrate_105_to_106(), migrate_106_to_107(), migrate_107_to_108(), migrate_108_to_109(), migrate_109_to_110(), migrate_10_to_11(), migrate_110_to_111(), migrate_111_to_112(), migrate_112_to_113(), migrate_113_to_114(), migrate_114_to_115(), migrate_115_to_116(), migrate_116_to_117(), migrate_117_to_118(), migrate_118_to_119(), migrate_119_to_120(), migrate_11_to_12(), migrate_120_to_121(), migrate_121_to_122(), migrate_122_to_123(), migrate_123_to_124(), migrate_124_to_125(), migrate_125_to_126(), migrate_126_to_127(), migrate_127_to_128(), migrate_128_to_129(), migrate_129_to_130(), migrate_12_to_13(), migrate_130_to_131(), migrate_131_to_132(), migrate_132_to_133(), migrate_133_to_134(), migrate_134_to_135(), migrate_135_to_136(), migrate_136_to_137(), migrate_137_to_138(), migrate_138_to_139(), migrate_139_to_140(), migrate_13_to_14(), migrate_140_to_141(), migrate_141_to_142(), migrate_142_to_143(), migrate_143_to_144(), migrate_144_to_145(), migrate_145_to_146(), migrate_146_to_147(), migrate_147_to_148(), migrate_148_to_149(), migrate_149_to_150(), migrate_14_to_15(), migrate_150_to_151(), migrate_151_to_152(), migrate_152_to_153(), migrate_153_to_154(), migrate_154_to_155(), migrate_155_to_156(), migrate_156_to_157(), migrate_157_to_158(), migrate_158_to_159(), migrate_159_to_160(), migrate_15_to_16(), migrate_160_to_161(), migrate_161_to_162(), migrate_162_to_163(), migrate_163_to_164(), migrate_164_to_165(), migrate_165_to_166(), migrate_167_to_168(), migrate_16_to_17(), migrate_170_to_171(), migrate_171_to_172(), migrate_172_to_173(), migrate_173_to_174(), migrate_174_to_175(), migrate_175_to_176(), migrate_176_to_177(), migrate_177_to_178(), migrate_178_to_179(), migrate_179_to_180(), migrate_17_to_18(), migrate_180_to_181(), migrate_181_to_182(), migrate_182_to_183(), migrate_183_to_184(), migrate_18_to_19(), migrate_19_to_20(), migrate_1_to_2(), migrate_20_to_21(), migrate_21_to_22(), migrate_22_to_23(), migrate_23_to_24(), migrate_25_to_26(), migrate_26_to_27(), migrate_27_to_28(), migrate_28_to_29(), migrate_29_to_30(), migrate_2_to_3(), migrate_30_to_31(), migrate_31_to_32(), migrate_32_to_33(), migrate_33_to_34(), migrate_34_to_35(), migrate_35_to_36(), migrate_36_to_37(), migrate_37_to_38(), migrate_38_to_39(), migrate_39_to_40(), migrate_3_to_4(), migrate_40_to_41(), migrate_41_to_42(), migrate_42_to_43(), migrate_43_to_44(), migrate_44_to_45(), migrate_45_to_46(), migrate_46_to_47(), migrate_47_to_48(), migrate_48_to_49(), migrate_49_to_50(), migrate_50_to_51(), migrate_51_to_52(), migrate_52_to_53(), migrate_53_to_54(), migrate_54_to_55(), migrate_55_to_56(), migrate_56_to_57(), migrate_57_to_58(), migrate_58_to_59(), migrate_59_to_60(), migrate_60_to_61(), migrate_61_to_62(), migrate_62_to_63(), migrate_63_to_64(), migrate_64_to_65(), migrate_65_to_66(), migrate_66_to_67(), migrate_67_to_68(), migrate_68_to_69(), migrate_69_to_70(), migrate_6_to_7(), migrate_70_to_71(), migrate_71_to_72(), migrate_72_to_73(), migrate_73_to_74(), migrate_74_to_75(), migrate_75_to_76(), migrate_76_to_77(), migrate_77_to_78(), migrate_78_to_79(), migrate_7_to_8(), migrate_80_to_81(), migrate_81_to_82(), migrate_82_to_83(), migrate_83_to_84(), migrate_84_to_85(), migrate_85_to_86(), migrate_86_to_87(), migrate_87_to_88(), migrate_88_to_89(), migrate_89_to_90(), migrate_8_to_9(), migrate_90_to_91(), migrate_91_to_92(), migrate_92_to_93(), migrate_93_to_94(), migrate_94_to_95(), migrate_95_to_96(), migrate_96_to_97(), migrate_97_to_98(), migrate_98_to_99(), migrate_99_to_100(), and migrate_9_to_10().
int set_password | ( | const gchar * | , |
const gchar * | , | ||
const gchar * | , | ||
gchar ** | |||
) |
void set_report_scheduled | ( | report_t | report | ) |
Set a report's scheduled flag.
Set flag if task was scheduled, else clear flag.
[in] | report | Report. |
Definition at line 18252 of file manage_sql.c.
References authenticate_allow_all, and sql().
int set_task_alerts | ( | task_t | task, |
array_t * | alerts, | ||
gchar ** | alert_id_return | ||
) |
Set the alerts on a task, removing any previous alerts.
[in] | task | Task. |
[in] | alerts | Alerts. |
[out] | alert_id_return | ID of alert on "failed to find" error. |
Definition at line 18674 of file manage_sql.c.
References find_alert_with_permission(), LOCATION_TABLE, sql(), sql_begin_immediate(), sql_commit(), and sql_rollback().
void set_task_alterable | ( | task_t | task, |
int | alterable | ||
) |
Set the alterable state of a task.
[in] | task | Task. |
[in] | alterable | Whether task is alterable. |
Definition at line 18722 of file manage_sql.c.
References sql().
Set the config of a task.
[in] | task | Task. |
[in] | config | Config. |
Definition at line 18095 of file manage_sql.c.
References sql().
int set_task_groups | ( | task_t | task, |
array_t * | groups, | ||
gchar ** | group_id_return | ||
) |
Set observer groups on a task, removing any previous groups.
[in] | task | Task. |
[in] | groups | Groups. |
[out] | group_id_return | ID of group on "failed to find" error. |
Definition at line 18739 of file manage_sql.c.
References current_credentials, find_group(), LOCATION_TABLE, sql(), sql_begin_immediate(), sql_commit(), and sql_rollback().
void set_task_hosts_ordering | ( | task_t | task, |
const char * | ordering | ||
) |
Set the hosts ordering of a task.
[in] | task | Task. |
[in] | ordering | Hosts ordering. |
Definition at line 18152 of file manage_sql.c.
References sql(), and sql_quote().
int set_task_observers | ( | task_t | task, |
const gchar * | observers | ||
) |
Set the observers of a task.
[in] | task | Task. |
[in] | observers | Observers. |
Definition at line 19148 of file manage_sql.c.
References current_credentials, sql(), sql_begin_immediate(), sql_rollback(), and user_exists().
int set_task_requested | ( | task_t | task, |
task_status_t * | status | ||
) |
Atomically set the run state of a task to requested.
[in] | task | Task. |
[out] | status | Old run status of task. |
Definition at line 18336 of file manage_sql.c.
References set_task_run_status(), sql_begin_exclusive(), sql_commit(), task_run_status(), TASK_STATUS_DELETE_REQUESTED, TASK_STATUS_DELETE_ULTIMATE_REQUESTED, TASK_STATUS_DELETE_ULTIMATE_WAITING, TASK_STATUS_DELETE_WAITING, TASK_STATUS_REQUESTED, TASK_STATUS_RUNNING, TASK_STATUS_STOP_REQUESTED, TASK_STATUS_STOP_REQUESTED_GIVEUP, and TASK_STATUS_STOP_WAITING.
void set_task_run_status | ( | task_t | task, |
task_status_t | status | ||
) |
Set the run state of a task.
Logs and generates event.
[in] | task | Task. |
[in] | status | New run status. |
Definition at line 18307 of file manage_sql.c.
Referenced by manage_check_current_task(), manage_cleanup_process_error(), and set_task_requested().
Set the scanner of a task.
[in] | task | Task. |
[in] | scanner | Scanner. |
Definition at line 18208 of file manage_sql.c.
References SCANNER_TYPE_CVE, and sql().
Referenced by move_task().
int set_task_schedule | ( | task_t | task, |
schedule_t | schedule, | ||
int | periods | ||
) |
Set the schedule of a task.
[in] | task | Task. |
[in] | schedule | Schedule. |
[in] | periods | Number of schedule periods. |
Definition at line 18808 of file manage_sql.c.
References sql().
void set_task_schedule_next_time | ( | task_t | task, |
time_t | time | ||
) |
Set the next time a scheduled task will be due.
[in] | task | Task. |
[in] | time | New next time. |
Definition at line 19058 of file manage_sql.c.
References sql().
Referenced by manage_schedule().
void set_task_schedule_next_time_uuid | ( | const gchar * | task_id, |
time_t | time | ||
) |
Set the next time a scheduled task will be due.
[in] | task_id | Task UUID. |
[in] | time | New next time. |
Definition at line 19071 of file manage_sql.c.
References sql(), sql_quote(), and task_id().
Referenced by manage_schedule().
int set_task_schedule_periods | ( | const gchar * | task_id, |
int | periods | ||
) |
Set the schedule periods of a task, given a UUID.
The task modification time stays the same.
[in] | task_id | Task UUID. |
[in] | periods | Schedule periods. |
Definition at line 18869 of file manage_sql.c.
References sql(), sql_quote(), and task_id().
Referenced by manage_schedule().
int set_task_schedule_periods_id | ( | task_t | task, |
int | periods | ||
) |
Set the schedule periods of a task, given an ID.
The task modification time stays the same.
[in] | task | Task UUID. |
[in] | periods | Schedule periods. |
Definition at line 18894 of file manage_sql.c.
References sql().
int set_task_schedule_uuid | ( | const gchar * | task_id, |
schedule_t | schedule, | ||
int | periods | ||
) |
Set the schedule of a task.
[in] | task_id | Task UUID. |
[in] | schedule | Schedule. |
[in] | periods | Number of schedule periods. |
Definition at line 18836 of file manage_sql.c.
References sql(), sql_quote(), and task_id().
Referenced by manage_schedule().
void set_task_start_time | ( | task_t | task, |
char * | time | ||
) |
Set the start time of a task.
[in] | task | Task. |
[in] | time | New time. ISO format. Freed before return. |
Definition at line 18493 of file manage_sql.c.
References parse_iso_time(), and sql().
void set_task_start_time_epoch | ( | task_t | task, |
int | time | ||
) |
Set the start time of a task.
[in] | task | Task. |
[in] | time | New time. Seconds since epoch. |
Definition at line 18509 of file manage_sql.c.
References sql().
void set_task_start_time_otp | ( | task_t | task, |
char * | time | ||
) |
Set the start time of a task.
[in] | task | Task. |
[in] | time | New time. OTP format (ctime). Freed before return. |
Definition at line 18524 of file manage_sql.c.
References sql().
Set the target of a task.
[in] | task | Task. |
[in] | target | Target. |
Definition at line 18137 of file manage_sql.c.
References sql().
array_t* split_filter | ( | const gchar * | given_filter | ) |
Split the filter term into parts.
[in] | given_filter | Filter term. |
Definition at line 2043 of file manage_sql.c.
References keyword::column, keyword::equal, KEYWORD_RELATION_COLUMN_ABOVE, KEYWORD_RELATION_COLUMN_APPROX, KEYWORD_RELATION_COLUMN_BELOW, KEYWORD_RELATION_COLUMN_EQUAL, KEYWORD_RELATION_COLUMN_REGEXP, keyword::relation, and keyword::string.
Referenced by manage_clean_filter_remove(), manage_filter_controls(), and manage_report_filter_controls().
void stop_active_tasks | ( | ) |
Stop any active tasks.
Definition at line 16767 of file manage_sql.c.
References current_credentials, get_iterator_resource(), init_task_iterator(), next(), task_iterator_run_status(), TASK_STATUS_DELETE_REQUESTED, TASK_STATUS_DELETE_ULTIMATE_REQUESTED, TASK_STATUS_DELETE_ULTIMATE_WAITING, TASK_STATUS_DELETE_WAITING, TASK_STATUS_REQUESTED, TASK_STATUS_RUNNING, TASK_STATUS_STOP_REQUESTED, TASK_STATUS_STOP_REQUESTED_GIVEUP, and TASK_STATUS_STOP_WAITING.
int stop_task_internal | ( | task_t | task | ) |
Initiate stopping a task.
Use send_to_server to queue the task stop sequence in the scanner output buffer.
[in] | task | Task. |
Definition at line 5447 of file manage.c.
References current_scanner_task, task_run_status(), task_scanner(), TASK_STATUS_REQUESTED, and TASK_STATUS_RUNNING.
Referenced by move_task().
gchar* tag_value | ( | const gchar * | tags, |
const gchar * | tag | ||
) |
Extract a tag from an OTP tag list.
[in] | tags | Tag list. |
[out] | tag | Tag name. |
Definition at line 1269 of file manage_sql.c.
Referenced by migrate_138_to_139(), migrate_143_to_144(), and sql_tag().
void tags_set_locations | ( | const char * | , |
resource_t | , | ||
resource_t | , | ||
int | |||
) |
void tags_set_orphans | ( | const char * | , |
resource_t | , | ||
int | |||
) |
alert_t task_alert_iterator_alert | ( | iterator_t * | iterator | ) |
Get the alert from a task alert iterator.
[in] | iterator | Iterator. |
Definition at line 8894 of file manage_sql.c.
References iterator::done, and iterator_int64().
int task_alterable | ( | task_t | task | ) |
Return whether a task is an Alterable Task.
[in] | task | Task. |
Definition at line 14238 of file manage_sql.c.
References sql_int().
int task_average_scan_duration | ( | task_t | task | ) |
Get the average duration of all finished reports of a task.
[in] | task | Task. |
Definition at line 14283 of file manage_sql.c.
References sql_int(), and TASK_STATUS_DONE.
char* task_comment | ( | task_t | task | ) |
Return the comment of a task.
[in] | task | Task. |
Definition at line 17959 of file manage_sql.c.
References sql_string().
Return the config of a task.
[in] | task | Task. |
Definition at line 18016 of file manage_sql.c.
References sql_int64().
Referenced by stop_task().
int task_config_in_trash | ( | task_t | task | ) |
Return whether the config of a task is in the trashcan.
[in] | task | Task. |
Definition at line 18081 of file manage_sql.c.
References LOCATION_TRASH, and sql_int().
Referenced by task_config_name(), and task_config_uuid().
char* task_config_name | ( | task_t | task | ) |
Return the name of the config of a task.
[in] | task | Task. |
Definition at line 18062 of file manage_sql.c.
References sql_string(), and task_config_in_trash().
char* task_config_uuid | ( | task_t | task | ) |
Return the UUID of the config of a task.
[in] | task | Task. |
Definition at line 18043 of file manage_sql.c.
References sql_string(), and task_config_in_trash().
unsigned int task_count | ( | const get_data_t * | get | ) |
Return the number of tasks associated with the current user.
[in] | get | GET params. |
Definition at line 17814 of file manage_sql.c.
References get_data_t::filt_id, get_data_t::filter, filter_term(), filter_term_value(), MIN_QOD_DEFAULT, TASK_ITERATOR_COLUMNS, TASK_ITERATOR_FILTER_COLUMNS, and TASK_ITERATOR_WHERE_COLUMNS.
char* task_hosts_ordering | ( | task_t | task | ) |
Return the hosts ordering of a task.
[in] | task | Task. |
Definition at line 17973 of file manage_sql.c.
References sql_string().
unsigned int task_id | ( | task_t | task | ) |
Return the identifier of a task.
[in] | task | Task. |
Definition at line 17869 of file manage_sql.c.
Referenced by manage_test_alert(), move_task(), resume_task(), set_task_schedule_next_time_uuid(), set_task_schedule_periods(), set_task_schedule_uuid(), stop_task(), task_schedule_next_time_uuid(), task_schedule_periods_uuid(), and task_schedule_uuid().
int task_in_trash | ( | task_t | task | ) |
Return whether a task is in the trashcan.
[in] | task | Task. |
Definition at line 17900 of file manage_sql.c.
References sql_int().
int task_in_use | ( | task_t | task | ) |
Return whether a task is in use by a task.
[in] | task | Task. |
Definition at line 14202 of file manage_sql.c.
References task_run_status(), TASK_STATUS_DELETE_REQUESTED, TASK_STATUS_DELETE_ULTIMATE_REQUESTED, TASK_STATUS_DELETE_ULTIMATE_WAITING, TASK_STATUS_DELETE_WAITING, TASK_STATUS_REQUESTED, TASK_STATUS_RUNNING, TASK_STATUS_STOP_REQUESTED, TASK_STATUS_STOP_REQUESTED_GIVEUP, and TASK_STATUS_STOP_WAITING.
Referenced by trash_task_in_use().
report_t task_iterator_current_report | ( | iterator_t * | iterator | ) |
Return the current report of a task.
[in] | iterator | Iterator. |
Definition at line 18416 of file manage_sql.c.
References get_iterator_resource(), sql_int(), task_iterator_run_status(), TASK_STATUS_DELETE_REQUESTED, TASK_STATUS_DELETE_ULTIMATE_REQUESTED, TASK_STATUS_INTERNAL_ERROR, TASK_STATUS_REQUESTED, TASK_STATUS_RUNNING, TASK_STATUS_STOP_REQUESTED, TASK_STATUS_STOP_REQUESTED_GIVEUP, and TASK_STATUS_STOPPED.
int task_iterator_finished_reports | ( | iterator_t * | iterator | ) |
Get the number of reports of a task iterator.
[in] | iterator | Iterator. |
Definition at line 14160 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_int().
const char* task_iterator_first_report | ( | iterator_t * | iterator | ) |
Get the first report UUID from a task iterator.
[in] | iterator | Iterator. |
Definition at line 14118 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_string().
const char* task_iterator_hosts_ordering | ( | iterator_t * | iterator | ) |
Get the hosts ordering value from a task iterator.
[in] | iterator | Iterator. |
Definition at line 14174 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_string().
const char* task_iterator_last_report | ( | iterator_t * | iterator | ) |
Get the last report UUID from a task iterator.
[in] | iterator | Iterator. |
Definition at line 14146 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_string().
task_status_t task_iterator_run_status | ( | iterator_t * | iterator | ) |
Get the run status from a task iterator.
[in] | iterator | Iterator. |
Definition at line 14088 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, iterator_int(), and TASK_STATUS_INTERNAL_ERROR.
Referenced by stop_active_tasks(), and task_iterator_current_report().
const char* task_iterator_run_status_name | ( | iterator_t * | iterator | ) |
Get the run status name from a task iterator.
[in] | iterator | Iterator. |
Definition at line 14132 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_string().
scanner_t task_iterator_scanner | ( | iterator_t * | iterator | ) |
Get the UUID of task scanner from a task iterator.
[in] | iterator | Iterator. |
Definition at line 14188 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_int64().
int task_iterator_total_reports | ( | iterator_t * | iterator | ) |
Get the number of reports of a task iterator.
[in] | iterator | Iterator. |
Definition at line 14104 of file manage_sql.c.
References iterator::done, GET_ITERATOR_COLUMN_COUNT, and iterator_int().
Get the report from the most recently completed invocation of task.
[in] | task | The task. |
[out] | report | Report return, 0 if succesfully failed to select report. |
Definition at line 18542 of file manage_sql.c.
References sql_int64(), and TASK_STATUS_DONE.
Referenced by sql_task_last_report().
Get the report from the most recently stopped invocation of task.
[in] | task | The task. |
[out] | report | Report return, 0 if succesfully failed to select report. |
Definition at line 18608 of file manage_sql.c.
References sql_int64(), and TASK_STATUS_STOPPED.
char* task_name | ( | task_t | task | ) |
Return the name of a task.
[in] | task | Task. |
Definition at line 17945 of file manage_sql.c.
References sql_string().
char* task_observers | ( | task_t | task | ) |
Return the observers of a task.
[in] | task | Task. |
Definition at line 17987 of file manage_sql.c.
References cleanup_iterator(), init_task_user_iterator(), and next().
char* task_owner_name | ( | task_t | task | ) |
Return the name of the owner of a task.
[in] | task | Task. |
Definition at line 17915 of file manage_sql.c.
References sql_string().
int task_result_count | ( | task_t | task, |
int | min_qod | ||
) |
Return number of results in a task.
[in] | task | Task. |
[in] | min_qod | Minimum QOD. |
Definition at line 18375 of file manage_sql.c.
References SEVERITY_ERROR, and sql_int().
task_status_t task_run_status | ( | task_t | task | ) |
Return the run state of a task.
[in] | task | Task. |
Definition at line 18238 of file manage_sql.c.
References sql_int().
Referenced by manage_check_current_task(), move_task(), resume_task(), set_task_requested(), stop_task_internal(), task_in_use(), and task_running_report().
Return the running report of a task.
[in] | task | Task. |
Definition at line 18393 of file manage_sql.c.
References sql_int(), task_run_status(), TASK_STATUS_REQUESTED, and TASK_STATUS_RUNNING.
Referenced by task_upload_progress().
Return the scanner of a task.
[in] | task | Task. |
Definition at line 18183 of file manage_sql.c.
References sql_int64().
Referenced by move_task(), and stop_task_internal().
int task_scanner_in_trash | ( | task_t | task | ) |
Return whether the scanner of a task is in the trashcan.
[in] | task | Task. |
Definition at line 18224 of file manage_sql.c.
References LOCATION_TRASH, and sql_int().
schedule_t task_schedule | ( | task_t | task | ) |
Return the schedule of a task.
[in] | task | Task. |
Definition at line 18911 of file manage_sql.c.
References sql_int64().
int task_schedule_in_trash | ( | task_t | task | ) |
Get whether the task schedule is in the trash.
[in] | task | Task. |
Definition at line 18971 of file manage_sql.c.
References LOCATION_TRASH, and sql_int().
int task_schedule_next_time | ( | task_t | task | ) |
Get next time a scheduled task will run, following schedule timezone.
[in] | task | Task. |
Definition at line 19021 of file manage_sql.c.
References next_time(), and sql_int().
time_t task_schedule_next_time_uuid | ( | const gchar * | task_id | ) |
Set the next time a scheduled task will be due.
[in] | task_id | Task UUID. |
Definition at line 19038 of file manage_sql.c.
References sql_int(), sql_quote(), and task_id().
Referenced by manage_schedule().
int task_schedule_periods | ( | task_t | task | ) |
Get the number of times the period schedule should run on the task.
[in] | task | Task. |
Definition at line 18987 of file manage_sql.c.
References sql_int().
int task_schedule_periods_uuid | ( | const gchar * | task_id | ) |
Set the next time a scheduled task will be due.
[in] | task_id | Task UUID. |
Definition at line 19000 of file manage_sql.c.
References sql_int(), sql_quote(), and task_id().
Referenced by manage_schedule().
schedule_t task_schedule_uuid | ( | const gchar * | task_id | ) |
Return the schedule of a task.
[in] | task_id | ID of task. |
Definition at line 18938 of file manage_sql.c.
References sql_int64(), sql_quote(), and task_id().
Referenced by manage_schedule().
gchar* task_second_last_report_id | ( | task_t | task | ) |
Get report ID from second most recently completed invocation of task.
[in] | task | The task. |
Definition at line 18640 of file manage_sql.c.
References sql_string(), and TASK_STATUS_DONE.
char* task_severity | ( | task_t | task, |
int | overrides, | ||
int | min_qod, | ||
int | offset | ||
) |
Return the severity score of a task, taking overrides into account.
[in] | task | Task. |
[in] | overrides | Whether to apply overrides. |
[in] | min_qod | Minimum QoD of results to count. |
[in] | offset | Offset of report to get severity from: 0 = use last report, 1 = use next to last report |
Definition at line 19094 of file manage_sql.c.
References SEVERITY_MISSING, and task_severity_double().
double task_severity_double | ( | task_t | task, |
int | overrides, | ||
int | min_qod, | ||
int | offset | ||
) |
Return the severity score of a task, taking overrides into account.
[in] | task | Task. |
[in] | overrides | Whether to apply overrides. |
[in] | min_qod | Minimum QoD of results to count. |
[in] | offset | Offset of report to get severity from: 0 = use last report, 1 = use next to last report |
Definition at line 19119 of file manage_sql.c.
References current_credentials, report_severity(), SEVERITY_MISSING, sql_int64(), TASK_STATUS_DONE, and task_target().
Referenced by task_severity().
Return the target of a task.
[in] | task | Task. |
Definition at line 18111 of file manage_sql.c.
References sql_int64().
Referenced by run_osp_task(), and task_severity_double().
int task_target_in_trash | ( | task_t | task | ) |
Return whether the target of a task is in the trashcan.
[in] | task | Task. |
Definition at line 18168 of file manage_sql.c.
References LOCATION_TRASH, and sql_int().
int task_upload_progress | ( | task_t | task | ) |
Return the upload progress of a task.
[in] | task | Task. |
Definition at line 18460 of file manage_sql.c.
References task_running_report().
int task_uuid | ( | task_t | task, |
char ** | id | ||
) |
Return the UUID of a task.
[in] | task | Task. |
[out] | id | Pointer to a newly allocated string. |
Definition at line 17885 of file manage_sql.c.
References sql_string().
Referenced by acl_user_has_access_uuid(), and manage_schedule().
int task_writable | ( | task_t | task | ) |
Return whether a task is writable.
[in] | task | Task. |
Definition at line 14253 of file manage_sql.c.
References sql_int().
const char* threat_message_type | ( | const char * | threat | ) |
int trash_alert_in_use | ( | alert_t | alert | ) |
Return whether a trashcan alert is in use by a task.
[in] | alert | Alert. |
Definition at line 8520 of file manage_sql.c.
References LOCATION_TRASH, and sql_int().
int trash_alert_writable | ( | alert_t | alert | ) |
Return whether a trashcan alert is writable.
[in] | alert | Alert. |
Definition at line 8549 of file manage_sql.c.
int trash_id_exists | ( | const char * | type, |
const char * | id | ||
) |
Test Whether a resource of the given type and ID exists in the trash.
[in] | type | Type. |
[in] | id | Unique ID. |
Definition at line 17780 of file manage_sql.c.
References sql_int().
int trash_task_in_use | ( | task_t | task | ) |
Return whether a trashcan task is referenced by a task.
[in] | task | Task. |
Definition at line 14225 of file manage_sql.c.
References task_in_use().
int trash_task_writable | ( | task_t | task | ) |
Return whether a trashcan task is writable.
[in] | task | Task. |
Definition at line 14268 of file manage_sql.c.
References sql_int().
const char* type_db_name | ( | const char * | type | ) |
Return DB name of type.
[in] | type | Database or pretty name. |
Definition at line 4290 of file manage_sql.c.
References valid_type().
int type_has_comment | ( | const char * | type | ) |
Check whether a type has a comment.
[in] | type | Type of resource. |
Definition at line 4363 of file manage_sql.c.
int type_named | ( | const char * | type | ) |
Check whether a type has a name and comment.
[in] | type | Type of resource. |
Definition at line 4349 of file manage_sql.c.
int type_owned | ( | const char * | type | ) |
Check whether a resource type has an owner.
[in] | type | Type of resource. |
Definition at line 4376 of file manage_sql.c.
Referenced by init_aggregate_iterator(), and resource_count().
const char* type_pretty_name | ( | const char * | type | ) |
Return pretty name of type.
[in] | type | Database name. |
Definition at line 4237 of file manage_sql.c.
column_t* type_select_columns | ( | const char * | type, |
int | |||
) |
column_t* type_where_columns | ( | const char * | type, |
int | |||
) |
int user_ensure_in_db | ( | const gchar * | name, |
const gchar * | method | ||
) |
Ensure the user exists in the database.
[in] | name | User name. |
[in] | method | Auth method. |
Definition at line 17309 of file manage_sql.c.
References current_credentials, sql(), sql_int(), and sql_quote().
int user_exists | ( | const gchar * | name | ) |
Check if user exists.
[in] | name | User name. |
Definition at line 17358 of file manage_sql.c.
Referenced by set_task_observers().
gchar* user_uuid_any_method | ( | const gchar * | name | ) |
Get user uuid, trying all authentication methods.
[in] | name | User name. |
Definition at line 17287 of file manage_sql.c.
gchar* user_uuid_method | ( | const gchar * | username, |
auth_method_t | method | ||
) |
Get user uuid.
[in] | username | User name. |
[in] | method | Authentication method. |
Definition at line 17208 of file manage_sql.c.
References sql_quote(), and sql_string().
int valid_omp_command | ( | const char * | name | ) |
Check whether a command name is valid.
[in] | name | Command name. |
Definition at line 545 of file manage_sql.c.
References omp_commands.
Referenced by acl_user_has_access_uuid().
int valid_type | ( | const char * | type | ) |
Check whether a resource type name is valid.
[in] | type | Type of resource. |
Definition at line 4201 of file manage_sql.c.
Referenced by find_resource_with_permission(), omp_command_type(), and type_db_name().
int validate_scp_data | ( | alert_method_t | method, |
const gchar * | name, | ||
gchar ** | data | ||
) |
Validate method data for the SCP method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
Definition at line 7222 of file manage_sql.c.
References ALERT_METHOD_SCP, credential_value(), find_credential_with_permission(), and find_report_format_with_permission().
int validate_send_data | ( | alert_method_t | method, |
const gchar * | name, | ||
gchar ** | data | ||
) |
Validate method data for the Send method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
Definition at line 7304 of file manage_sql.c.
References ALERT_METHOD_SEND, and find_report_format_with_permission().
int validate_smb_data | ( | alert_method_t | method, |
const gchar * | name, | ||
gchar ** | data | ||
) |
Validate method data for the Send method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
Definition at line 7368 of file manage_sql.c.
References ALERT_METHOD_SMB, credential_value(), and find_credential_with_permission().
int validate_tippingpoint_data | ( | alert_method_t | method, |
const gchar * | name, | ||
gchar ** | data | ||
) |
Validate method data for the TippingPoint method.
[in] | method | Method that data corresponds to. |
[in] | name | Name of data. |
[in] | data | The data. |
Definition at line 7435 of file manage_sql.c.
References ALERT_METHOD_TIPPINGPOINT, credential_type(), and find_credential_with_permission().
int validate_username | ( | const gchar * | name | ) |
int authenticate_allow_all |
Flag to force authentication to succeed.
1 if set via scheduler, 2 if set via event, else 0.
Definition at line 120 of file manage_sql.c.
Referenced by authenticate(), and set_report_scheduled().
int(* manage_fork_connection) (openvas_connection_t *, gchar *) = NULL |
Function to fork a connection that will accept OMP requests.
Definition at line 347 of file manage_sql.c.
nvtis_t* nvti_cache = NULL |
Memory cache of NVT information from the database.
Definition at line 398 of file manage_sql.c.
command_t omp_commands[] |
The OMP command list.
Definition at line 422 of file manage_sql.c.
Referenced by valid_omp_command().
void(* progress) () = NULL |
Function to mark progress.
Definition at line 352 of file manage_sql.c.
int table_order_if_sort_not_specified = 0 |
Flag to control the default sorting produced by split filter.
If this is true, and the filter does not specify a sort field, then split_filter will not insert a default sort term, so that the random (and fast) table order in the database will be used.
Definition at line 2033 of file manage_sql.c.
gchar* task_db_name = NULL |
Name of the database file.
Definition at line 403 of file manage_sql.c.
Referenced by migrate_43_to_44(), and reinit_manage_process().