Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto sync predefined report formats from feed #970

Merged
merged 20 commits into from
Feb 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add setting "BPM Data" [#915](https://github.com/greenbone/gvmd/pull/915)
- Automatically load predefined configs from the feed [#931](https://github.com/greenbone/gvmd/pull/931) [#933](https://github.com/greenbone/gvmd/pull/933) [#934](https://github.com/greenbone/gvmd/pull/934)
- Automatically load predefined port lists from the feed [#950](https://github.com/greenbone/gvmd/pull/950) [#952](https://github.com/greenbone/gvmd/pull/952)
- Automatically load predefined report formats from the feed [#968](https://github.com/greenbone/gvmd/pull/968)
- Automatically load predefined report formats from the feed [#968](https://github.com/greenbone/gvmd/pull/968) [#970](https://github.com/greenbone/gvmd/pull/970)

### Changed
- Update SCAP and CERT feed info in sync scripts [#810](https://github.com/greenbone/gvmd/pull/810)
Expand Down
170 changes: 0 additions & 170 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,6 @@ add_subdirectory (doc)

## Install

install (CODE "file (MAKE_DIRECTORY \$ENV{DESTDIR}${GVMD_DATA_DIR}/report_formats)")

install (DIRECTORY DESTINATION ${GVMD_STATE_DIR})

install (FILES ${CMAKE_BINARY_DIR}/src/gvmd_log.conf
Expand All @@ -296,174 +294,6 @@ install (FILES ${CMAKE_BINARY_DIR}/src/gvmd_log.conf
install (FILES ${CMAKE_SOURCE_DIR}/src/pwpolicy.conf
DESTINATION ${GVM_SYSCONF_DIR})

# Report formats.

install (FILES src/report_formats/Anonymous_XML/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/5057e5cc-b825-11e4-9d0e-28d24461215b
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/Anonymous_XML/Anonymous_XML.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/5057e5cc-b825-11e4-9d0e-28d24461215b
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/Anonymous_XML/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/5057e5cc-b825-11e4-9d0e-28d24461215b
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/ARF/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/910200ca-dc05-11e1-954f-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/ARF/ARF.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/910200ca-dc05-11e1-954f-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/ARF/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/910200ca-dc05-11e1-954f-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/CPE/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/5ceff8ba-1f62-11e1-ab9f-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/CPE/CPE.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/5ceff8ba-1f62-11e1-ab9f-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/CPE/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/5ceff8ba-1f62-11e1-ab9f-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/CSV_Results/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/c1645568-627a-11e3-a660-406186ea4fc5
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/CSV_Results/CSV_Results.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/c1645568-627a-11e3-a660-406186ea4fc5
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/CSV_Results/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/c1645568-627a-11e3-a660-406186ea4fc5
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/CSV_Hosts/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/9087b18c-626c-11e3-8892-406186ea4fc5
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/CSV_Hosts/CSV_Hosts.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/9087b18c-626c-11e3-8892-406186ea4fc5
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/CSV_Hosts/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/9087b18c-626c-11e3-8892-406186ea4fc5
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/ITG/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/77bd6c4a-1f62-11e1-abf0-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/ITG/ITG.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/77bd6c4a-1f62-11e1-abf0-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/ITG/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/77bd6c4a-1f62-11e1-abf0-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/LaTeX/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/a684c02c-b531-11e1-bdc2-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/LaTeX/latex.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/a684c02c-b531-11e1-bdc2-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/LaTeX/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/a684c02c-b531-11e1-bdc2-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/NBE/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/9ca6fe72-1f62-11e1-9e7c-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/NBE/NBE.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/9ca6fe72-1f62-11e1-9e7c-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/NBE/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/9ca6fe72-1f62-11e1-9e7c-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/LaTeX/latex.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/c402cc3e-b531-11e1-9163-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/PDF/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/c402cc3e-b531-11e1-9163-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/PDF/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/c402cc3e-b531-11e1-9163-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/Topology/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/9e5e5deb-879e-4ecc-8be6-a71cd0875cdd/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/Topology/hostvisdot-summary.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/9e5e5deb-879e-4ecc-8be6-a71cd0875cdd/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/Topology/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/9e5e5deb-879e-4ecc-8be6-a71cd0875cdd/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/TXT/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/a3810a62-1f62-11e1-9219-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/TXT/TXT.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/a3810a62-1f62-11e1-9219-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/TXT/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/a3810a62-1f62-11e1-9219-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/XML/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/a994b278-1f62-11e1-96ac-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/XML/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/a994b278-1f62-11e1-96ac-406186ea4fc5/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/Verinice_ISM/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/c15ad349-bd8d-457a-880a-c7056532ee15/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/Verinice_ISM/Verinice_ISM.xsl
src/report_formats/Verinice_ISM/classification.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/c15ad349-bd8d-457a-880a-c7056532ee15/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/Verinice_ISM/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/c15ad349-bd8d-457a-880a-c7056532ee15/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

install (FILES src/report_formats/Verinice_ITG/report_format.xml
DESTINATION ${GVMD_DATA_DIR}/report_formats/50c9950a-f326-11e4-800c-28d24461215b/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/Verinice_ITG/Verinice_ITG.xsl
src/report_formats/Verinice_ITG/classification-helpers.xsl
DESTINATION ${GVMD_DATA_DIR}/report_formats/50c9950a-f326-11e4-800c-28d24461215b/
PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)

install (FILES src/report_formats/Verinice_ITG/generate
DESTINATION ${GVMD_DATA_DIR}/report_formats/50c9950a-f326-11e4-800c-28d24461215b/
PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

# Schema formats.

install (FILES src/schema_formats/RNC/rnc.xsl
Expand Down
36 changes: 23 additions & 13 deletions src/gmp_report_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,28 @@ child_or_null (entity_t entity, const gchar *name)
return NULL;
}

/**
* @brief Free a "params_options".
*
* @param[in] params_options Param options.
*/
void
params_options_free (array_t *params_options)
{
if (params_options)
{
guint index = params_options->len;
while (index--)
{
array_t *options;
options = (array_t*) g_ptr_array_index (params_options, index);
if (options)
array_free (options);
}
g_ptr_array_free (params_options, TRUE);
}
}

/**
* @brief Get creation data from a report_format entity.
*
Expand Down Expand Up @@ -381,7 +403,6 @@ create_report_format_run (gmp_parser_t *gmp_parser, GError **error)
extension,
summary,
description,
0, /* Global. */
files,
params,
params_options,
Expand Down Expand Up @@ -480,18 +501,7 @@ create_report_format_run (gmp_parser_t *gmp_parser, GError **error)
/* Cleanup. */

array_free (files);
if (params_options)
{
guint index = params_options->len;
while (index--)
{
array_t *options;
options = (array_t*) g_ptr_array_index (params_options, index);
if (options)
array_free (options);
}
g_ptr_array_free (params_options, TRUE);
}
params_options_free (params_options);
array_free (params);

create_report_format_reset ();
Expand Down
3 changes: 3 additions & 0 deletions src/gmp_report_formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ create_report_format_element_end (gmp_parser_t *, GError **error, const gchar *)
void
create_report_format_element_text (const gchar *, gsize);

void
params_options_free (array_t *);

void
parse_report_format_entity (entity_t, const char **, char **, char **,
char **, char **, char **, char **,
Expand Down
2 changes: 2 additions & 0 deletions src/manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include "manage_acl.h"
#include "manage_configs.h"
#include "manage_port_lists.h"
#include "manage_report_formats.h"
#include "manage_sql.h"
#include "manage_sql_secinfo.h"
#include "manage_sql_nvts.h"
Expand Down Expand Up @@ -7163,6 +7164,7 @@ manage_sync (sigset_t *sigmask_current,
manage_sync_cert (sigmask_current);
manage_sync_configs ();
manage_sync_port_lists ();
manage_sync_report_formats ();
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/manage_report_formats.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ typedef struct

int
create_report_format (const char *, const char *, const char *, const char *,
const char *, const char *, int, array_t *, array_t *,
const char *, const char *, array_t *, array_t *,
array_t *, const char *, report_format_t *);

int
Expand Down Expand Up @@ -226,4 +226,7 @@ init_param_option_iterator (iterator_t*, report_format_param_t, int,
const char*
param_option_iterator_value (iterator_t *);

void
manage_sync_report_formats ();

#endif /* not _GVMD_MANAGE_REPORT_FORMATS_H */
Loading