Greenbone Vulnerability Manager 22.5.2
|
GVM management layer: Report format SQL. More...
#include "debug_utils.h"
#include "manage_sql_report_formats.h"
#include "manage_acl.h"
#include "manage_report_formats.h"
#include "sql.h"
#include "utils.h"
#include <errno.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <grp.h>
#include <libgen.h>
#include <limits.h>
#include <locale.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <gvm/base/gvm_sentry.h>
#include <bsd/unistd.h>
#include <gvm/util/uuidutils.h>
#include <gvm/util/fileutils.h>
Macros | |
#define | G_LOG_DOMAIN "md manage" |
GLib log domain. | |
#define | REPORT_FORMAT_ITERATOR_FILTER_COLUMNS |
Filter columns for Report Format iterator. More... | |
#define | REPORT_FORMAT_ITERATOR_COLUMNS |
Report Format iterator columns. More... | |
#define | REPORT_FORMAT_ITERATOR_TRASH_COLUMNS |
Report Format iterator columns for trash case. More... | |
Enumerations | |
enum | report_format_flag_t { REPORT_FORMAT_FLAG_ACTIVE = 1 } |
Possible port types. | |
Functions | |
int | sync_report_formats_with_feed (gboolean) |
Sync all report formats with the feed. More... | |
static int | validate_param_value (report_format_t report_format, report_format_param_t param, const char *name, const char *value) |
Validate a value for a report format param. More... | |
static void | set_report_format_name (report_format_t report_format, const char *name) |
Set the name of the report format. More... | |
static void | set_report_format_summary (report_format_t report_format, const char *summary) |
Set the summary of the report format. More... | |
static void | set_report_format_active (report_format_t report_format, int active) |
Set the active flag of a report format. More... | |
static int | set_report_format_param (report_format_t report_format, const char *name, const char *value_64) |
Set the value of the report format param. More... | |
static const char * | get_sysconf_gpghome () |
Return the name of the sysconf GnuPG home directory. More... | |
static const char * | get_trustedkeys_name () |
Return the name of the trusted keys file name. More... | |
int | resource_predefined (const gchar *type, resource_t resource) |
Return whether a resource is predefined. More... | |
static int | verify_signature (const gchar *installer, gsize installer_size, const gchar *signature, gsize signature_size, int *trust) |
Execute gpg to verify an installer signature. More... | |
static int | find_signature (const gchar *location, const gchar *installer_filename, gchar **signature, gsize *signature_size, gchar **uuid) |
Find a signature in a feed. More... | |
static gchar * | report_format_trash_dir (const gchar *report_format_id) |
Get trash directory of a report format. More... | |
gboolean | lookup_report_format (const char *name, report_format_t *report_format) |
Find a report format given a name. More... | |
gboolean | find_report_format_no_acl (const char *uuid, report_format_t *report_format) |
Find a report format given a UUID. More... | |
gboolean | find_trash_report_format_no_acl (const char *uuid, report_format_t *report_format) |
Find a trash report format given a UUID. More... | |
static gint | compare_files (gconstpointer one, gconstpointer two) |
Compare files for create_report_format. More... | |
static int | save_report_format_files (const gchar *report_id, array_t *files, gchar **report_format_dir) |
Save files of a report format. More... | |
static int | add_report_format_params (report_format_t report_format, array_t *params, array_t *params_options) |
Add params to a report format. More... | |
static int | create_report_format_internal (int check_access, int may_exist, int active, int trusted, const char *uuid, const char *name, const char *content_type, const char *extension, const char *summary, const char *description, array_t *files, array_t *params, array_t *params_options, const char *signature, int predefined, report_format_t *report_format) |
Create a report format. More... | |
int | create_report_format (const char *uuid, const char *name, const char *content_type, const char *extension, const char *summary, const char *description, array_t *files, array_t *params, array_t *params_options, const char *signature, report_format_t *report_format) |
Create a report format. More... | |
int | create_report_format_no_acl (const char *uuid, const char *name, const char *content_type, const char *extension, const char *summary, const char *description, array_t *files, array_t *params, array_t *params_options, const char *signature, int predefined, report_format_t *report_format) |
Create a report format. More... | |
static int | copy_report_format_dir (const gchar *source_dir, const gchar *copy_parent, const gchar *copy_uuid) |
Create a report format dir. More... | |
int | copy_report_format (const char *name, const char *source_uuid, report_format_t *new_report_format) |
Create Report Format from an existing Report Format. More... | |
static int | report_format_predefined_uuid (const gchar *report_format_id) |
Return whether a report format is predefined. More... | |
int | modify_report_format (const char *report_format_id, const char *name, const char *summary, const char *active, const char *param_name, const char *param_value) |
Modify a report format. More... | |
static int | move_report_format_dir (const char *dir, const char *new_dir) |
Move a report format directory. More... | |
static void | delete_report_format_rows (report_format_t report_format) |
Delete a report format from the db. More... | |
int | delete_report_format (const char *report_format_id, int ultimate) |
Delete a report format. More... | |
int | restore_report_format (const char *report_format_id) |
Try restore a report format. More... | |
char * | report_format_uuid (report_format_t report_format) |
Return the UUID of a report format. More... | |
char * | report_format_owner_uuid (report_format_t report_format) |
Return the UUID of the owner of a report format. More... | |
char * | report_format_name (report_format_t report_format) |
Return the name of a report format. More... | |
char * | report_format_content_type (report_format_t report_format) |
Return the content type of a report format. More... | |
int | report_format_in_use (report_format_t report_format) |
Return whether a report format is referenced by an alert. More... | |
int | trash_report_format_in_use (report_format_t report_format) |
Return whether a report format in trash is referenced by an alert. More... | |
int | report_format_predefined (report_format_t report_format) |
Return whether a report format is predefined. More... | |
int | trash_report_format_predefined (report_format_t report_format) |
Return whether a trash report format is predefined. More... | |
char * | report_format_extension (report_format_t report_format) |
Return the extension of a report format. More... | |
int | report_format_active (report_format_t report_format) |
Return whether a report format is active. More... | |
static report_format_param_type_t | report_format_param_type (report_format_t report_format, const char *name) |
Return the type max of a report format param. More... | |
static long long int | report_format_param_type_max (report_format_t report_format, const char *name) |
Return the type max of a report format param. More... | |
static long long int | report_format_param_type_min (report_format_t report_format, const char *name) |
Return the type min of a report format param. More... | |
int | report_format_trust (report_format_t report_format) |
Return the trust of a report format. More... | |
const char ** | report_format_filter_columns () |
Get filter columns. More... | |
column_t * | report_format_select_columns () |
Get select columns. More... | |
int | report_format_count (const get_data_t *get) |
Count the number of Report Formats. More... | |
int | init_report_format_iterator (iterator_t *iterator, const get_data_t *get) |
Initialise a Report Format iterator, including observed Report Formats. More... | |
const char * | report_format_iterator_trust (iterator_t *iterator) |
Get the trust value from a report format iterator. More... | |
time_t | report_format_iterator_trust_time (iterator_t *iterator) |
Get the trust time from a report format iterator. More... | |
int | report_format_iterator_active (iterator_t *iterator) |
Get the active flag from a report format iterator. More... | |
void | init_report_format_alert_iterator (iterator_t *iterator, report_format_t report_format) |
Initialise a Report Format alert iterator. More... | |
int | report_format_alert_iterator_readable (iterator_t *iterator) |
Get the read permission status from a GET iterator. More... | |
void | init_report_format_param_iterator (iterator_t *iterator, report_format_t report_format, int trash, int ascending, const char *sort_field) |
Initialise a report format iterator. More... | |
report_format_param_t | report_format_param_iterator_param (iterator_t *iterator) |
Get the report format param from a report format param iterator. More... | |
const char * | report_format_param_iterator_type_name (iterator_t *iterator) |
Get the name of the type of a report format param iterator. More... | |
report_format_param_type_t | report_format_param_iterator_type (iterator_t *iterator) |
Get the type from a report format param iterator. More... | |
long long int | report_format_param_iterator_type_min (iterator_t *iterator) |
Get the type min from a report format param iterator. More... | |
long long int | report_format_param_iterator_type_max (iterator_t *iterator) |
Get the type max from a report format param iterator. More... | |
void | init_param_option_iterator (iterator_t *iterator, report_format_param_t report_format_param, int ascending, const char *sort_field) |
Initialise a report format param option iterator. More... | |
static int | verify_report_format_internal (report_format_t report_format) |
Verify a report format. More... | |
int | verify_report_format (const char *report_format_id) |
Verify a report format. More... | |
static int | run_report_format_script (gchar *report_format_id, gchar *xml_file, gchar *xml_dir, gchar *report_format_extra, gchar *output_file) |
Runs the script of a report format. More... | |
int | print_report_xml_end (gchar *xml_start, gchar *xml_full, report_format_t report_format) |
Completes a report by adding report format info. More... | |
gchar * | apply_report_format (gchar *report_format_id, gchar *xml_start, gchar *xml_file, gchar *xml_dir, GList **used_rfps) |
Applies a report format to an XML report. More... | |
int | empty_trashcan_report_formats () |
Empty trashcan. More... | |
void | inherit_report_format_dir (const gchar *report_format_id, const gchar *user_id, user_t inheritor) |
Change ownership of report formats, for user deletion. More... | |
gboolean | inherit_report_formats (user_t user, user_t inheritor, iterator_t *rows) |
Change ownership of report formats, for user deletion. More... | |
gboolean | delete_report_formats_user (user_t user, iterator_t *rows) |
Delete all report formats owned by a user. More... | |
void | delete_report_format_dirs_user (const gchar *user_id, iterator_t *rows) |
Delete all report formats owned by a user. More... | |
void | update_report_format (report_format_t report_format, const gchar *report_id, const gchar *name, const gchar *content_type, const gchar *extension, const gchar *summary, const gchar *description, const gchar *signature, array_t *files, array_t *params, array_t *params_options) |
Update a report format from an XML file. More... | |
int | report_format_updated_in_feed (report_format_t report_format, const gchar *path) |
Check if a report format has been updated in the feed. More... | |
int | migrate_predefined_report_formats () |
Migrate old ownerless report formats to the Feed Owner. More... | |
static int | make_report_format_uuids_unique () |
Ensure every report format has a unique UUID. More... | |
static int | check_db_trash_report_formats () |
Check that trash report formats are correct. More... | |
int | check_db_report_formats () |
Ensure the predefined report formats exist. More... | |
int | check_db_report_formats_trash () |
Ensure that the report formats trash directory matches the database. More... | |
GVM management layer: Report format SQL.
The report format SQL for the GVM management layer.
#define REPORT_FORMAT_ITERATOR_COLUMNS |
Report Format iterator columns.
#define REPORT_FORMAT_ITERATOR_FILTER_COLUMNS |
Filter columns for Report Format iterator.
#define REPORT_FORMAT_ITERATOR_TRASH_COLUMNS |
Report Format iterator columns for trash case.
|
static |
Add params to a report format.
[in] | report_format | Report format. |
[in] | params | Array of params. |
[in] | params_options | Array. Each item is an array corresponding to params. Each item of an inner array is a string, the text of an option in a selection. |
gchar * apply_report_format | ( | gchar * | report_format_id, |
gchar * | xml_start, | ||
gchar * | xml_file, | ||
gchar * | xml_dir, | ||
GList ** | used_rfps | ||
) |
Applies a report format to an XML report.
[in] | report_format_id | Report format to apply. |
[in] | xml_start | Path to the main part of the report XML. |
[in] | xml_file | Path to the report XML file. |
[in] | xml_dir | Path to the temporary dir. |
[in] | used_rfps | List of already applied report formats. |
int check_db_report_formats | ( | ) |
Ensure the predefined report formats exist.
int check_db_report_formats_trash | ( | ) |
Ensure that the report formats trash directory matches the database.
|
static |
Check that trash report formats are correct.
|
static |
Compare files for create_report_format.
[in] | one | First. |
[in] | two | Second. |
int copy_report_format | ( | const char * | name, |
const char * | source_uuid, | ||
report_format_t * | new_report_format | ||
) |
Create Report Format from an existing Report Format.
[in] | name | Name of new Report Format. NULL to copy from existing. |
[in] | source_uuid | UUID of existing Report Format. |
[out] | new_report_format | New Report Format. |
|
static |
Create a report format dir.
[in] | source_dir | Full path of source directory, including UUID. |
[in] | copy_parent | Path of destination directory, excluding UUID. |
[in] | copy_uuid | UUID (dirname) of destination directory. |
int create_report_format | ( | const char * | uuid, |
const char * | name, | ||
const char * | content_type, | ||
const char * | extension, | ||
const char * | summary, | ||
const char * | description, | ||
array_t * | files, | ||
array_t * | params, | ||
array_t * | params_options, | ||
const char * | signature, | ||
report_format_t * | report_format | ||
) |
Create a report format.
[in] | uuid | UUID of format. |
[in] | name | Name of format. |
[in] | content_type | Content type of format. |
[in] | extension | File extension of format. |
[in] | summary | Summary of format. |
[in] | description | Description of format. |
[in] | files | Array of memory. Each item is a file name string, a terminating NULL, the file contents in base64 and a terminating NULL. |
[in] | params | Array of params. |
[in] | params_options | Array. Each item is an array corresponding to params. Each item of an inner array is a string, the text of an option in a selection. |
[in] | signature | Signature. |
[out] | report_format | Created report format. |
|
static |
Create a report format.
[in] | check_access | Whether to check for permission. |
[in] | may_exist | Whether it is OK if there is already a report format with this UUID. |
[in] | active | Whether report format is active. |
[in] | trusted | Whether to assumed report format is trusted. |
[in] | uuid | UUID of format. |
[in] | name | Name of format. |
[in] | content_type | Content type of format. |
[in] | extension | File extension of format. |
[in] | summary | Summary of format. |
[in] | description | Description of format. |
[in] | files | Array of memory. Each item is a file name string, a terminating NULL, the file contents in base64 and a terminating NULL. |
[in] | params | Array of params. |
[in] | params_options | Array. Each item is an array corresponding to params. Each item of an inner array is a string, the text of an option in a selection. |
[in] | predefined | Whether report format is from the feed. |
[in] | signature | Signature. |
[out] | report_format | Created report format. |
int create_report_format_no_acl | ( | const char * | uuid, |
const char * | name, | ||
const char * | content_type, | ||
const char * | extension, | ||
const char * | summary, | ||
const char * | description, | ||
array_t * | files, | ||
array_t * | params, | ||
array_t * | params_options, | ||
const char * | signature, | ||
int | predefined, | ||
report_format_t * | report_format | ||
) |
Create a report format.
[in] | uuid | UUID of format. |
[in] | name | Name of format. |
[in] | content_type | Content type of format. |
[in] | extension | File extension of format. |
[in] | summary | Summary of format. |
[in] | description | Description of format. |
[in] | files | Array of memory. Each item is a file name string, a terminating NULL, the file contents in base64 and a terminating NULL. |
[in] | params | Array of params. |
[in] | params_options | Array. Each item is an array corresponding to params. Each item of an inner array is a string, the text of an option in a selection. |
[in] | signature | Signature. |
[in] | predefined | Whether report format is from the feed. |
[out] | report_format | Created report format. |
int delete_report_format | ( | const char * | report_format_id, |
int | ultimate | ||
) |
Delete a report format.
[in] | report_format_id | UUID of Report format. |
[in] | ultimate | Whether to remove entirely, or to trashcan. |
void delete_report_format_dirs_user | ( | const gchar * | user_id, |
iterator_t * | rows | ||
) |
Delete all report formats owned by a user.
[in] | user_id | UUID of user. |
[in] | rows | Trash report format ids if any, else NULL. Cleaned up before returning. |
|
static |
Delete a report format from the db.
[in] | report_format | Report format. |
gboolean delete_report_formats_user | ( | user_t | user, |
iterator_t * | rows | ||
) |
Delete all report formats owned by a user.
[in] | user | The user. |
[in] | rows | Trash report format ids. |
int empty_trashcan_report_formats | ( | ) |
Empty trashcan.
gboolean find_report_format_no_acl | ( | const char * | uuid, |
report_format_t * | report_format | ||
) |
Find a report format given a UUID.
This does not do any permission checks.
[in] | uuid | UUID of resource. |
[out] | report_format | Report Format return, 0 if no such report format. |
|
static |
Find a signature in a feed.
[in] | location | Feed directory to search for signature. |
[in] | installer_filename | Installer filename. |
[out] | signature | Freshly allocated installer signature. |
[out] | signature_size | Size of installer signature. |
[out] | uuid | Address for basename of linked signature when the signature was found in the private directory, if desired, else NULL. Private directory is only checked if this is given. |
gboolean find_trash_report_format_no_acl | ( | const char * | uuid, |
report_format_t * | report_format | ||
) |
Find a trash report format given a UUID.
This does not do any permission checks.
This considers the actual UUID of the report format, not the original_uuid.
[in] | uuid | UUID of resource. |
[out] | report_format | Report Format return, 0 if no such report format. |
|
static |
Return the name of the sysconf GnuPG home directory.
Returns the name of the GnuPG home directory to use when checking signatures. It is the directory openvas/gnupg under the sysconfdir that was set by configure (usually $prefix/etc).
|
static |
Return the name of the trusted keys file name.
We currently use the name pubring.gpg to be compatible with previous installations. That file should best be installed read-only so that it is not accidentally accessed while we are running a verification. All files in that keyring are assumed to be fully trustworthy.
void inherit_report_format_dir | ( | const gchar * | report_format_id, |
const gchar * | user_id, | ||
user_t | inheritor | ||
) |
Change ownership of report formats, for user deletion.
[in] | report_format_id | UUID of report format. |
[in] | user_id | UUID of current owner. |
[in] | inheritor | New owner. |
gboolean inherit_report_formats | ( | user_t | user, |
user_t | inheritor, | ||
iterator_t * | rows | ||
) |
Change ownership of report formats, for user deletion.
[in] | user | Current owner. |
[in] | inheritor | New owner. |
[in] | rows | Iterator for inherited report formats, with next already called. |
void init_param_option_iterator | ( | iterator_t * | iterator, |
report_format_param_t | report_format_param, | ||
int | ascending, | ||
const char * | sort_field | ||
) |
Initialise a report format param option iterator.
[in] | iterator | Iterator. |
[in] | report_format_param | Param whose options to iterate over. |
[in] | ascending | Whether to sort ascending or descending. |
[in] | sort_field | Field to sort on, or NULL for "id". |
void init_report_format_alert_iterator | ( | iterator_t * | iterator, |
report_format_t | report_format | ||
) |
Initialise a Report Format alert iterator.
Iterates over all alerts that use the Report Format.
[in] | iterator | Iterator. |
[in] | report_format | Report Format. |
int init_report_format_iterator | ( | iterator_t * | iterator, |
const get_data_t * | get | ||
) |
Initialise a Report Format iterator, including observed Report Formats.
[in] | iterator | Iterator. |
[in] | get | GET data. |
void init_report_format_param_iterator | ( | iterator_t * | iterator, |
report_format_t | report_format, | ||
int | trash, | ||
int | ascending, | ||
const char * | sort_field | ||
) |
Initialise a report format iterator.
[in] | iterator | Iterator. |
[in] | report_format | Single report_format to iterate over, or 0 for all. |
[in] | trash | Whether to iterate over trashcan report formats. |
[in] | ascending | Whether to sort ascending or descending. |
[in] | sort_field | Field to sort on, or NULL for "id". |
gboolean lookup_report_format | ( | const char * | name, |
report_format_t * | report_format | ||
) |
Find a report format given a name.
[in] | name | Name of report_format. |
[out] | report_format | Report format return, 0 if successfully failed to find report_format. |
|
static |
Ensure every report format has a unique UUID.
int migrate_predefined_report_formats | ( | ) |
Migrate old ownerless report formats to the Feed Owner.
int modify_report_format | ( | const char * | report_format_id, |
const char * | name, | ||
const char * | summary, | ||
const char * | active, | ||
const char * | param_name, | ||
const char * | param_value | ||
) |
Modify a report format.
[in] | report_format_id | UUID of report format. |
[in] | name | Name of report format. |
[in] | summary | Summary of report format. |
[in] | active | Active flag. |
[in] | param_name | Parameter to modify. |
[in] | param_value | Value of parameter. |
|
static |
Move a report format directory.
[in] | dir | Old dir. |
[in] | new_dir | New dir. |
int print_report_xml_end | ( | gchar * | xml_start, |
gchar * | xml_full, | ||
report_format_t | report_format | ||
) |
Completes a report by adding report format info.
[in] | xml_start | Path of file containing start of report. |
[in] | xml_full | Path to file to print full report to. |
[in] | report_format | Format of report that will be created from XML. |
int report_format_active | ( | report_format_t | report_format | ) |
Return whether a report format is active.
[in] | report_format | Report format. |
int report_format_alert_iterator_readable | ( | iterator_t * | iterator | ) |
Get the read permission status from a GET iterator.
[in] | iterator | Iterator. |
char * report_format_content_type | ( | report_format_t | report_format | ) |
Return the content type of a report format.
[in] | report_format | Report format. |
int report_format_count | ( | const get_data_t * | get | ) |
Count the number of Report Formats.
[in] | get | GET params. |
char * report_format_extension | ( | report_format_t | report_format | ) |
Return the extension of a report format.
[in] | report_format | Report format. |
const char ** report_format_filter_columns | ( | ) |
Get filter columns.
int report_format_in_use | ( | report_format_t | report_format | ) |
Return whether a report format is referenced by an alert.
[in] | report_format | Report Format. |
int report_format_iterator_active | ( | iterator_t * | iterator | ) |
Get the active flag from a report format iterator.
[in] | iterator | Iterator. |
const char * report_format_iterator_trust | ( | iterator_t * | iterator | ) |
Get the trust value from a report format iterator.
[in] | iterator | Iterator. |
time_t report_format_iterator_trust_time | ( | iterator_t * | iterator | ) |
Get the trust time from a report format iterator.
[in] | iterator | Iterator. |
char * report_format_name | ( | report_format_t | report_format | ) |
Return the name of a report format.
[in] | report_format | Report format. |
char * report_format_owner_uuid | ( | report_format_t | report_format | ) |
Return the UUID of the owner of a report format.
[in] | report_format | Report format. |
report_format_param_t report_format_param_iterator_param | ( | iterator_t * | iterator | ) |
Get the report format param from a report format param iterator.
[in] | iterator | Iterator. |
report_format_param_type_t report_format_param_iterator_type | ( | iterator_t * | iterator | ) |
Get the type from a report format param iterator.
[in] | iterator | Iterator. |
long long int report_format_param_iterator_type_max | ( | iterator_t * | iterator | ) |
Get the type max from a report format param iterator.
[in] | iterator | Iterator. |
long long int report_format_param_iterator_type_min | ( | iterator_t * | iterator | ) |
Get the type min from a report format param iterator.
[in] | iterator | Iterator. |
const char * report_format_param_iterator_type_name | ( | iterator_t * | iterator | ) |
Get the name of the type of a report format param iterator.
[in] | iterator | Iterator. |
|
static |
Return the type max of a report format param.
[in] | report_format | Report format. |
[in] | name | Name of param. |
|
static |
Return the type max of a report format param.
[in] | report_format | Report format. |
[in] | name | Name of param. |
|
static |
Return the type min of a report format param.
[in] | report_format | Report format. |
[in] | name | Name of param. |
int report_format_predefined | ( | report_format_t | report_format | ) |
Return whether a report format is predefined.
[in] | report_format | Report format. |
|
static |
Return whether a report format is predefined.
[in] | report_format_id | UUID of report format. |
column_t * report_format_select_columns | ( | ) |
Get select columns.
|
static |
Get trash directory of a report format.
[in] | report_format_id | UUID of report format. NULL for the base dir that holds the report format trash. |
int report_format_trust | ( | report_format_t | report_format | ) |
Return the trust of a report format.
[in] | report_format | Report format. |
int report_format_updated_in_feed | ( | report_format_t | report_format, |
const gchar * | path | ||
) |
Check if a report format has been updated in the feed.
[in] | path | Full path to report format XML in feed. |
[in] | report_format | Report Format. |
char * report_format_uuid | ( | report_format_t | report_format | ) |
Return the UUID of a report format.
[in] | report_format | Report format. |
int resource_predefined | ( | const gchar * | type, |
resource_t | resource | ||
) |
Return whether a resource is predefined.
[in] | type | Type of resource. |
[in] | resource | Resource. |
int restore_report_format | ( | const char * | report_format_id | ) |
Try restore a report format.
If success, ends transaction for caller before exiting.
[in] | report_format_id | UUID of resource. |
|
static |
Runs the script of a report format.
[in] | report_format_id | UUID of the report format. |
[in] | xml_file | Path to main part of the report XML. |
[in] | xml_dir | Path of the dir with XML and subreports. |
[in] | report_format_extra | Extra data for report format. |
[in] | output_file | Path to write report to. |
|
static |
Save files of a report format.
[in] | report_id | UUID of format. |
[in] | files | Array of memory. Each item is a file name string, a terminating NULL, the file contents in base64 and a terminating NULL. |
[out] | report_format_dir | Address for dir, or NULL. |
|
static |
Set the active flag of a report format.
[in] | report_format | The report format. |
[in] | active | Active flag. |
|
static |
Set the name of the report format.
[in] | report_format | The report format. |
[in] | name | Name. |
|
static |
Set the value of the report format param.
[in] | report_format | The report format. |
[in] | name | Param name. |
[in] | value_64 | Param value in base64. |
|
static |
Set the summary of the report format.
[in] | report_format | The report format. |
[in] | summary | Summary. |
int sync_report_formats_with_feed | ( | gboolean | rebuild | ) |
Sync all report formats with the feed.
Create report formats that exists in the feed but not in the db. Update report formats in the db that have changed on the feed. Do nothing to report formats in db that have been removed from the feed.
[in] | rebuild | Whether ignore timestamps to force a rebuild. |
int trash_report_format_in_use | ( | report_format_t | report_format | ) |
Return whether a report format in trash is referenced by an alert.
[in] | report_format | Report Format. |
int trash_report_format_predefined | ( | report_format_t | report_format | ) |
Return whether a trash report format is predefined.
[in] | report_format | Report format. |
void update_report_format | ( | report_format_t | report_format, |
const gchar * | report_id, | ||
const gchar * | name, | ||
const gchar * | content_type, | ||
const gchar * | extension, | ||
const gchar * | summary, | ||
const gchar * | description, | ||
const gchar * | signature, | ||
array_t * | files, | ||
array_t * | params, | ||
array_t * | params_options | ||
) |
Update a report format from an XML file.
[in] | report_format | Existing report format. |
[in] | report_id | UUID of report format. |
[in] | name | New name. |
[in] | content_type | New content type. |
[in] | extension | New extension. |
[in] | summary | New summary. |
[in] | description | New description. |
[in] | signature | New signature. |
[in] | files | New files. |
[in] | params | New params. |
[in] | params_options | Options for new params. |
|
static |
Validate a value for a report format param.
[in] | report_format | Report format. |
[in] | param | Param. |
[in] | name | Name of param. |
[in] | value | Potential value of param. |
int verify_report_format | ( | const char * | report_format_id | ) |
Verify a report format.
[in] | report_format_id | Report format UUID. |
|
static |
Verify a report format.
[in] | report_format | Report format. |
|
static |
Execute gpg to verify an installer signature.
[in] | installer | Installer. |
[in] | installer_size | Size of installer. |
[in] | signature | Installer signature. |
[in] | signature_size | Size of installer signature. |
[out] | trust | Trust value. |