15#include "../misc/plugutils.h"
16#include "../misc/scanneraux.h"
19#include <gvm/base/prefs.h>
20#include <gvm/boreas/cli.h>
33#define G_LOG_DOMAIN "sd main"
55 trans = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
59 g_hash_table_insert (trans, g_strdup (file_hash), contents);
79 gchar *filesize_str = g_strdup_printf (
"%ld", filesize);
84 trans = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
88 g_hash_table_insert (trans, g_strdup (file_hash), g_strdup (filesize_str));
102 const char *file_hash)
105 gchar *contents = NULL;
109 if (!file_hash || *file_hash ==
'\0')
112 origname = g_strdup (file_hash);
114 contents = (gchar *) g_base64_decode (file, &bytes);
116 if (contents == NULL)
118 g_debug (
"store_file: Failed to allocate memory for uploaded file.");
137 if (prefs_get (
"max_hosts"))
139 max_hosts = atoi (prefs_get (
"max_hosts"));
142 g_debug (
"Error ! max_hosts = %d -- check %s", max_hosts,
143 (
char *) prefs_get (
"config_file"));
148 g_debug (
"Client tried to raise the maximum hosts number - %d."
149 " Using %d. Change 'max_hosts' in openvas.conf if you"
150 " believe this is incorrect",
168 if (prefs_get (
"max_checks"))
170 max_checks = atoi (prefs_get (
"max_checks"));
173 g_debug (
"Error ! max_hosts = %d -- check %s", max_checks,
174 (
char *) prefs_get (
"config_file"));
179 g_debug (
"Client tried to raise the maximum checks number - %d."
180 " Using %d. Change 'max_checks' in openvas.conf if you"
181 " believe this is incorrect",
201 for (i = 0, ret = 1; (i < 10) && (ret > 0); i++)
202 ret = waitpid (
pid, NULL, WNOHANG);
204 return kill (
pid, 0) == 0;
211 ioctl (soc, FIONREAD, &data);
222 e = waitpid (-1, NULL, WNOHANG);
225 while ((e > 0 || errno == EINTR) && n < 20);
239 if (!strcmp (pref,
"config_file") || !strcmp (pref,
"plugins_folder")
243 || !strcmp (pref,
"db_address") || !strcmp (pref,
"negot_timeout")
244 || !strcmp (pref,
"force_pubkey_auth")
245 || !strcmp (pref,
"log_whole_attack")
246 || !strcmp (pref,
"log_plugins_name_at_load")
247 || !strcmp (pref,
"nasl_no_signature_check")
248 || !strcmp (pref,
"vendor_version") || !strcmp (pref,
"drop_privileges")
249 || !strcmp (pref,
"nasl_drop_privileges_user")
250 || !strcmp (pref,
"debug_tls") || !strcmp (pref,
"min_free_mem")
251 || !strcmp (pref,
"max_sysload")
253 || !strncmp (pref,
"sys_", 4))
GHashTable * files_size_translation
GHashTable * files_translation
int is_scanner_only_pref(const char *pref)
static void files_add_size_translation(struct scan_globals *globals, const char *file_hash, const long filesize)
Adds a 'content size' entry for a file sent by the client.
int store_file(struct scan_globals *globals, const char *file, const char *file_hash)
Stores a file type preference in a hash table.
int get_max_hosts_number(void)
int get_max_checks_number(void)
static void files_add_translation(struct scan_globals *globals, const char *file_hash, char *contents)
Adds a 'translation' entry for a file sent by the client.
void wait_for_children1(void)
int process_alive(pid_t pid)