X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ffsck.c;h=5c7762a8addff54d41e14eb4abe22a736ea52407;hb=0912276c6467aa3ee6f570b31245367319da572a;hp=7b18c19a8ea3e485b4523069eaa2a2cf1d6543ed;hpb=2a37712b0d3d5c441424cf1fac6c95f7c76cc709;p=tinc diff --git a/src/fsck.c b/src/fsck.c index 7b18c19a..5c7762a8 100644 --- a/src/fsck.c +++ b/src/fsck.c @@ -119,19 +119,19 @@ static int strtailcmp(const char *str, const char *tail) { } static void check_conffile(const char *nodename, bool server) { - splay_tree_t *config = NULL; + splay_tree_t config; init_configuration(&config); bool read; if(server) { - read = read_server_config(config); + read = read_server_config(&config); } else { - read = read_host_config(config, nodename, true); + read = read_host_config(&config, nodename, true); } if(!read) { - exit_configuration(&config); + splay_empty_tree(&config); return; } @@ -144,7 +144,7 @@ static void check_conffile(const char *nodename, bool server) { int count[total_vars]; memset(count, 0, sizeof(count)); - for splay_each(config_t, conf, config) { + for splay_each(config_t, conf, &config) { int var_type = 0; for(size_t i = 0; variables[i].name; ++i) { @@ -181,7 +181,7 @@ static void check_conffile(const char *nodename, bool server) { } } - exit_configuration(&config); + splay_empty_tree(&config); } #ifdef HAVE_MINGW @@ -329,7 +329,7 @@ static bool test_rsa_keypair(rsa_t *rsa_priv, rsa_t *rsa_pub, const char *host_f uint8_t *encrypted = xzalloc(len); uint8_t *decrypted = xzalloc(len); - randomize(plaintext, len); + prng_randomize(plaintext, len); plaintext[0] &= 0x7f; if(rsa_public_encrypt(rsa_pub, plaintext, len, encrypted)) { @@ -649,17 +649,17 @@ int fsck(const char *argv0) { // Avoid touching global configuration here. Read the config files into // a temporary configuration tree, then throw it away after fsck is done. - splay_tree_t *config = NULL; + splay_tree_t config; init_configuration(&config); // Read the server configuration file and append host configuration for our node. - bool success = read_server_config(config) && - read_host_config(config, name, true); + bool success = read_server_config(&config) && + read_host_config(&config, name, true); // Check both RSA and EC key pairs. // We need working configuration to run this check. if(success) { - success = check_keypairs(config, name); + success = check_keypairs(&config, name); } // Check that scripts are executable and check the config for invalid variables. @@ -667,7 +667,7 @@ int fsck(const char *argv0) { // This way, we can diagnose more issues on the first run. success = success & check_scripts_and_configs(); - exit_configuration(&config); + splay_empty_tree(&config); free(name); exe_name = NULL;