Skip to content

Commit

Permalink
Merge branch 'master' into drop_severity_debug
Browse files Browse the repository at this point in the history
  • Loading branch information
timopollmeier authored Oct 9, 2020
2 parents 059c51b + b174ef2 commit 4e09687
Show file tree
Hide file tree
Showing 26 changed files with 618 additions and 343 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Added ability to enter Subject Alternative Names (SAN) when generating a CSR [#1246](https://github.com/greenbone/gvmd/pull/1246)
- Add filter term 'predefined' [#1263](https://github.com/greenbone/gvmd/pull/1263)
- Add missing elements in get_nvts and get_preferences GMP doc [#1307](https://github.com/greenbone/gvmd/pull/1307)
- Add command line options db-host and db-port [#1308](https://github.com/greenbone/gvmd/pull/1308)

### Changed
- Extended the output of invalid / missing --feed parameter given to greenbone-feed-sync [#1255](https://github.com/greenbone/gvmd/pull/1255)
Expand All @@ -41,8 +43,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix delta sorting for unusual filter sort terms [#1249](https://github.com/greenbone/gvmd/pull/1249)
- Fix SCP alert authentication and logging [#1264](https://github.com/greenbone/gvmd/pull/1264)
- Set file mode creation mask for feed lock handling [#1265](https://github.com/greenbone/gvmd/pull/1265)
- Ignore min_qod when getting single results by UUID [#1276](http://github.com/greenbone/gvmd/pull/1276)
- Fix alternative options for radio type preferences when exporting a scan_config [#1278](http://github.com/greenbone/gvmd/pull/1278)
- Replace deprecated sys_siglist with strsignal [#1280](https://github.com/greenbone/gvmd/pull/1280)
- Copy instead of moving when migrating predefined report formats [#1286](https://github.com/greenbone/gvmd/pull/1286)
- Skip DB check in helpers when main process is running [#1291](https://github.com/greenbone/gvmd/pull/1291)
- Recreate vulns after sync [#1292](https://github.com/greenbone/gvmd/pull/1292)
- Add SecInfo case to alert check in MODIFY_FILTER [#1293](https://github.com/greenbone/gvmd/pull/1293)
- For radio prefs in GMP exclude value and include default [#1296](https://github.com/greenbone/gvmd/pull/1296)
- Add permission check on host in OS host count [#1301](https://github.com/greenbone/gvmd/pull/1301)
- Auto delete at the start of scheduling so it always runs [#1302](https://github.com/greenbone/gvmd/pull/1302)
- Fix create_credential for snmpv3. [#1305](https://github.com/greenbone/gvmd/pull/1305)
- Remove extra spaces when parsing report format param type [#1309](https://github.com/greenbone/gvmd/pull/1309)
- Correct arg to alert_uuid [#1313](https://github.com/greenbone/gvmd/pull/1313)
- Switch result filter column 'task' from task ID to name task name [#1317](https://github.com/greenbone/gvmd/pull/1317)
- Correct check of get_certificate_info return [#1318](https://github.com/greenbone/gvmd/pull/1318)

### Removed
- Remove DROP from vulns creation [#1281](http://github.com/greenbone/gvmd/pull/1281)

[20.8.1]: https://github.com/greenbone/gvmd/compare/v20.8.0...gvmd-20.08

Expand Down
12 changes: 9 additions & 3 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,16 @@ SELECT nspname || '.' || relname AS "relation",
These queries were taken from https://wiki.postgresql.org/wiki/Disk_Usage


## Migrating the Database
## Migrating the Database (e.g. during an upgrade of GVM)

If you have used Manager before, you might need to migrate the database to the
current data model. Use this command to run the migration:
If you have used Manager before (e.g. an older version which got upgraded to
a newer major release), you might get the following error in your `gvmd.log`
during startup:

gvmd: database is wrong version

If this is happening you need to migrate the database to the current data model.
Use this command to run the migration:

gvmd --migrate

Expand Down
12 changes: 12 additions & 0 deletions doc/gvmd.8.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<p>Use NAME as database for PostgreSQL.</p>
</optdesc>
</option>
<option>
<p><opt>--db-host=<arg>HOST</arg></opt></p>
<optdesc>
<p>Use HOST as database host or socket directory for PostgreSQL.</p>
</optdesc>
</option>
<option>
<p><opt>--db-port=<arg>PORT</arg></opt></p>
<optdesc>
<p>Use PORT as database port or socket extension for PostgreSQL.</p>
</optdesc>
</option>
<option>
<p><opt>--delete-scanner=<arg>SCANNER-UUID</arg></opt></p>
<optdesc>
Expand Down
40 changes: 30 additions & 10 deletions src/gmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -8672,13 +8672,6 @@ buffer_config_preference_xml (GString *buffer, iterator_t *prefs,
char *pos = strchr (value, ';');
if (pos) *pos = '\0';
buffer_xml_append_printf (buffer, "<value>%s</value>", value);
while (pos)
{
char *pos2 = strchr (++pos, ';');
if (pos2) *pos2 = '\0';
buffer_xml_append_printf (buffer, "<alt>%s</alt>", pos);
pos = pos2;
}
}
else if (value
&& type
Expand All @@ -8692,10 +8685,29 @@ buffer_config_preference_xml (GString *buffer, iterator_t *prefs,
&& type
&& (strcmp (type, "radio") == 0))
{
char *pos;
gchar *alts;

/* Handle the other possible values. */
char *pos = strchr (default_value, ';');

alts = g_strdup (default_value);

pos = strchr (default_value, ';');
if (pos) *pos = '\0';
buffer_xml_append_printf (buffer, "<default>%s</default>", default_value);

pos = alts;
while (1)
{
char *pos2 = strchr (pos, ';');
if (pos2) *pos2 = '\0';
if (value == NULL || strcmp (pos, value))
buffer_xml_append_printf (buffer, "<alt>%s</alt>", pos);
if (pos2 == NULL)
break;
pos = pos2 + 1;
}
g_free (alts);
}
else if (default_value
&& type
Expand Down Expand Up @@ -23523,6 +23535,14 @@ gmp_xml_handle_end_element (/* unused */ GMarkupParseContext* context,
log_event_fail ("filter", "Filter",
modify_filter_data->filter_id, "modified");
break;
case 6:
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("modify_filter",
"Filter is used by an alert so type must be"
" 'info' if specified"));
log_event_fail ("filter", "Filter",
modify_filter_data->filter_id, "modified");
break;
case 99:
SEND_TO_CLIENT_OR_FAIL
(XML_ERROR_SYNTAX ("modify_filter",
Expand Down Expand Up @@ -26952,7 +26972,7 @@ extern buffer_size_t from_client_end;
* -4 max_ips_per_target out of range.
*/
int
init_gmp (GSList *log_config, const gchar *database,
init_gmp (GSList *log_config, const db_conn_info_t *database,
int max_ips_per_target, int max_email_attachment_size,
int max_email_include_size, int max_email_message_size,
manage_connection_forker_t fork_connection, int skip_db_check)
Expand Down Expand Up @@ -26980,7 +27000,7 @@ init_gmp (GSList *log_config, const gchar *database,
* process_gmp_client_input.
*/
void
init_gmp_process (const gchar *database,
init_gmp_process (const db_conn_info_t *database,
int (*write_to_client) (const char*, void*),
void* write_to_client_data, gchar **disable)
{
Expand Down
6 changes: 3 additions & 3 deletions src/gmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@
#define TRUNCATE_TEXT_SUFFIX "[...]\n(text truncated)"

int
init_gmp (GSList *, const gchar *, int, int, int, int,
init_gmp (GSList *, const db_conn_info_t *, int, int, int, int,
manage_connection_forker_t, int);

void
init_gmp_process (const gchar *, int (*) (const char *, void *), void *,
gchar **);
init_gmp_process (const db_conn_info_t *, int (*) (const char *, void *),
void *, gchar **);

int
process_gmp_client_input ();
Expand Down
2 changes: 1 addition & 1 deletion src/gmp_report_formats.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ parse_report_format_entity (entity_t report_format,
type = entity_child (param_entity, "type");
if (type)
{
param->type = g_strdup (entity_text (type));
param->type = g_strstrip (g_strdup (entity_text (type)));
if (entity_child (type, "max"))
param->type_max = g_strdup (entity_text (entity_child (type,
"max")));
Expand Down
6 changes: 3 additions & 3 deletions src/gmpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ buffer_size_t from_client_end = 0;
* -4 max_ips_per_target out of range.
*/
int
init_gmpd (GSList *log_config, const gchar *database,
init_gmpd (GSList *log_config, const db_conn_info_t *database,
int max_ips_per_target, int max_email_attachment_size,
int max_email_include_size, int max_email_message_size,
manage_connection_forker_t fork_connection, int skip_db_check)
Expand All @@ -112,7 +112,7 @@ init_gmpd (GSList *log_config, const gchar *database,
* @param[in] disable Commands to disable.
*/
void
init_gmpd_process (const gchar *database, gchar **disable)
init_gmpd_process (const db_conn_info_t *database, gchar **disable)
{
from_client_start = 0;
from_client_end = 0;
Expand Down Expand Up @@ -452,7 +452,7 @@ get_nfds (int socket)
* @return 0 success, -1 error.
*/
int
serve_gmp (gvm_connection_t *client_connection, const gchar *database,
serve_gmp (gvm_connection_t *client_connection, const db_conn_info_t *database,
gchar **disable)
{
int nfds, rc = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/gmpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@
#define FROM_BUFFER_SIZE 1048576

int
init_gmpd (GSList *, const gchar *, int, int, int, int,
init_gmpd (GSList *, const db_conn_info_t *, int, int, int, int,
manage_connection_forker_t, int);

void
init_gmpd_process (const gchar *, gchar **);
init_gmpd_process (const db_conn_info_t *, gchar **);

int
serve_gmp (gvm_connection_t *, const gchar *, gchar **);
serve_gmp (gvm_connection_t *, const db_conn_info_t *, gchar **);

#endif /* not _GVMD_GMPD_H */
Loading

0 comments on commit 4e09687

Please sign in to comment.