+ while((ent = readdir(dir))) {
+ if(!check_id(ent->d_name)) {
+ continue;
+ }
+
+ node_t *n = lookup_node(ent->d_name);
+
+ splay_tree_t config;
+ init_configuration(&config);
+ read_config_options(&config, ent->d_name);
+ read_host_config(&config, ent->d_name, true);
+
+ if(!n) {
+ n = new_node(ent->d_name);
+ node_add(n);
+ }
+
+ if(strictsubnets) {
+ for(config_t *cfg = lookup_config(&config, "Subnet"); cfg; cfg = lookup_config_next(&config, cfg)) {
+ subnet_t *s, *s2;
+
+ if(!get_config_subnet(cfg, &s)) {
+ continue;
+ }
+
+ if((s2 = lookup_subnet(n, s))) {
+ s2->expires = -1;
+ free(s);
+ } else {
+ subnet_add(n, s);
+ }
+ }
+ }
+
+ if(lookup_config(&config, "Address")) {
+ n->status.has_address = true;
+ }
+
+ splay_empty_tree(&config);
+ }
+
+ closedir(dir);
+}
+
+char *get_name(void) {
+ char *name = NULL;
+ char *returned_name;
+
+ get_config_string(lookup_config(&config_tree, "Name"), &name);
+
+ if(!name) {
+ return NULL;
+ }
+
+ returned_name = replace_name(name);
+ free(name);
+ return returned_name;
+}
+
+static void read_interpreter(void) {
+ char *interpreter = NULL;
+ get_config_string(lookup_config(&config_tree, "ScriptsInterpreter"), &interpreter);
+
+ if(!interpreter || (sandbox_can(START_PROCESSES, AFTER_SANDBOX) && sandbox_can(USE_NEW_PATHS, AFTER_SANDBOX))) {
+ free(scriptinterpreter);
+ scriptinterpreter = interpreter;
+ return;
+ }
+
+ if(!string_eq(interpreter, scriptinterpreter)) {
+ logger(DEBUG_ALWAYS, LOG_NOTICE, "Not changing ScriptsInterpreter because of sandbox.");
+ }
+
+ free(interpreter);
+}
+
+bool setup_myself_reloadable(void) {
+ read_interpreter();
+
+ free(scriptextension);
+
+ if(!get_config_string(lookup_config(&config_tree, "ScriptsExtension"), &scriptextension)) {
+ scriptextension = xstrdup("");
+ }
+
+ char *proxy = NULL;
+
+ get_config_string(lookup_config(&config_tree, "Proxy"), &proxy);
+
+ if(proxy) {
+ char *space;
+
+ if((space = strchr(proxy, ' '))) {
+ *space++ = 0;
+ }
+
+ if(!strcasecmp(proxy, "none")) {
+ proxytype = PROXY_NONE;
+ } else if(!strcasecmp(proxy, "socks4")) {
+ proxytype = PROXY_SOCKS4;
+ } else if(!strcasecmp(proxy, "socks4a")) {
+ proxytype = PROXY_SOCKS4A;
+ } else if(!strcasecmp(proxy, "socks5")) {
+ proxytype = PROXY_SOCKS5;
+ } else if(!strcasecmp(proxy, "http")) {
+ proxytype = PROXY_HTTP;
+ } else if(!strcasecmp(proxy, "exec")) {
+ if(sandbox_can(START_PROCESSES, AFTER_SANDBOX)) {
+ proxytype = PROXY_EXEC;
+ } else {
+ logger(DEBUG_ALWAYS, LOG_ERR, "Cannot use exec proxies with current sandbox level.");
+ return false;
+ }
+ } else {
+ logger(DEBUG_ALWAYS, LOG_ERR, "Unknown proxy type %s!", proxy);
+ free_string(proxy);