|
53 | 53 | #include "manage_sql_report_formats.h" |
54 | 54 | #include "manage_sql_resources.h" |
55 | 55 | #include "manage_sql_roles.h" |
| 56 | +#include "manage_sql_targets.h" |
56 | 57 | #include "manage_sql_tickets.h" |
57 | 58 | #include "manage_sql_tls_certificates.h" |
58 | 59 | #include "manage_sql_users.h" |
@@ -286,11 +287,6 @@ type_build_select (const char *, const char *, const get_data_t *, |
286 | 287 | */ |
287 | 288 | manage_connection_forker_t manage_fork_connection; |
288 | 289 |
|
289 | | -/** |
290 | | - * @brief Max number of hosts per target. |
291 | | - */ |
292 | | -static int max_hosts = MANAGE_MAX_HOSTS; |
293 | | - |
294 | 290 | /** |
295 | 291 | * @brief Memory cache of NVT information from the database. |
296 | 292 | */ |
@@ -4632,7 +4628,7 @@ init_manage_internal (GSList *log_config, |
4632 | 4628 | || (max_ips_per_target > MANAGE_ABSOLUTE_MAX_IPS_PER_TARGET)) |
4633 | 4629 | return -4; |
4634 | 4630 |
|
4635 | | - max_hosts = max_ips_per_target; |
| 4631 | + manage_set_max_hosts (max_ips_per_target); |
4636 | 4632 | if (max_email_attachment_size) |
4637 | 4633 | set_max_email_attachment_size (max_email_attachment_size); |
4638 | 4634 | if (max_email_include_size) |
@@ -4684,7 +4680,7 @@ init_manage_internal (GSList *log_config, |
4684 | 4680 | sql ("INSERT INTO meta (name, value)" |
4685 | 4681 | " VALUES ('max_hosts', %i)" |
4686 | 4682 | " ON CONFLICT (name) DO UPDATE SET value = EXCLUDED.value;", |
4687 | | - max_hosts); |
| 4683 | + manage_max_hosts ()); |
4688 | 4684 | } |
4689 | 4685 |
|
4690 | 4686 | if (stop_tasks) |
@@ -20382,28 +20378,6 @@ modify_task (const gchar *task_id, const gchar *name, |
20382 | 20378 |
|
20383 | 20379 | /* Targets. */ |
20384 | 20380 |
|
20385 | | -/** |
20386 | | - * @brief Get the maximum allowed number of hosts per target. |
20387 | | - * |
20388 | | - * @return Maximum. |
20389 | | - */ |
20390 | | -int |
20391 | | -manage_max_hosts () |
20392 | | -{ |
20393 | | - return max_hosts; |
20394 | | -} |
20395 | | - |
20396 | | -/** |
20397 | | - * @brief Set the maximum allowed number of hosts per target. |
20398 | | - * |
20399 | | - * @param[in] new_max New max_hosts value. |
20400 | | - */ |
20401 | | -void |
20402 | | -manage_set_max_hosts (int new_max) |
20403 | | -{ |
20404 | | - max_hosts = new_max; |
20405 | | -} |
20406 | | - |
20407 | 20381 | /** |
20408 | 20382 | * @brief Find a target for a specific permission, given a UUID. |
20409 | 20383 | * |
@@ -21050,7 +21024,7 @@ create_target (const char* name, const char* asset_hosts_filter, |
21050 | 21024 | sql_rollback (); |
21051 | 21025 | return 2; |
21052 | 21026 | } |
21053 | | - if (max > max_hosts) |
| 21027 | + if (max > manage_max_hosts ()) |
21054 | 21028 | { |
21055 | 21029 | g_free (clean); |
21056 | 21030 | g_free (clean_exclude); |
@@ -21977,7 +21951,7 @@ modify_target (const char *target_id, const char *name, const char *hosts, |
21977 | 21951 | return 2; |
21978 | 21952 | } |
21979 | 21953 |
|
21980 | | - if (max > max_hosts) |
| 21954 | + if (max > manage_max_hosts ()) |
21981 | 21955 | { |
21982 | 21956 | g_free (clean); |
21983 | 21957 | g_free (clean_exclude); |
|
0 commit comments