X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ffsck.c;h=b44b7759584aa4a4bba930b613ef0d2597453aed;hb=28be4baae016a5a771d0d9ec6e97ef38a4fc9e46;hp=3a64959de5a83bace6dc3163418013c6b0e40409;hpb=28b7a53b693f6b4e70218a926e68a36ece54cda1;p=tinc diff --git a/src/fsck.c b/src/fsck.c index 3a64959d..b44b7759 100644 --- a/src/fsck.c +++ b/src/fsck.c @@ -64,6 +64,7 @@ again: goto again; } +static void print_tinc_cmd(const char *format, ...) ATTR_FORMAT(printf, 1, 2); static void print_tinc_cmd(const char *format, ...) { if(confbasegiven) { fprintf(stderr, "%s -c %s ", exe_name, confbase); @@ -141,8 +142,14 @@ static void check_conffile(const char *nodename, bool server) { ++total_vars; } - int count[total_vars]; - memset(count, 0, sizeof(count)); + if(!total_vars) { + splay_empty_tree(&config); + return; + } + + const size_t countlen = total_vars * sizeof(int); + int *count = alloca(countlen); + memset(count, 0, countlen); for splay_each(config_t, conf, &config) { int var_type = 0; @@ -184,7 +191,7 @@ static void check_conffile(const char *nodename, bool server) { splay_empty_tree(&config); } -#ifdef HAVE_MINGW +#ifdef HAVE_WINDOWS typedef int uid_t; static uid_t getuid(void) { @@ -218,7 +225,7 @@ static void check_key_file_mode(const char *fname) { } } } -#endif // HAVE_MINGW +#endif // HAVE_WINDOWS static char *read_node_name(void) { if(access(tinc_conf, R_OK) == 0) { @@ -535,14 +542,11 @@ static bool check_public_keys(splay_tree_t *config, const char *name, rsa_t *rsa fprintf(stderr, "WARNING: cannot read %s\n", host_file); } - ecdsa_t *ec_pub = NULL; - read_ecdsa_public_key(&ec_pub, &config, name); + ecdsa_t *ec_pub = read_ecdsa_public_key(&config, name); bool success = true; #ifndef DISABLE_LEGACY - rsa_t *rsa_pub = NULL; - read_rsa_public_key(&rsa_pub, config, name); - + rsa_t *rsa_pub = read_rsa_public_key(config, name); success = check_rsa_pubkey(rsa_priv, rsa_pub, host_file); rsa_free(rsa_pub); #endif