X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnet_setup.c;h=bf5ba04c1e7e1005b22f48ffd164b32584a34510;hp=c4f01b56fde078cedfc4aec1d26a2aec9d742868;hb=3e61c7233b087b8400c29ca7a8d079aad8b706d8;hpb=95921696a49d1eff058880c90a80efd208de959d diff --git a/src/net_setup.c b/src/net_setup.c index c4f01b56..bf5ba04c 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -1,7 +1,7 @@ /* net_setup.c -- Setup. Copyright (C) 1998-2005 Ivo Timmermans, - 2000-2014 Guus Sliepen + 2000-2015 Guus Sliepen 2006 Scott Lamb 2010 Brandon Black @@ -148,9 +148,6 @@ bool read_ecdsa_public_key(connection_t *c) { #ifndef DISABLE_LEGACY bool read_rsa_public_key(connection_t *c) { - if(ecdsa_active(c->ecdsa)) - return true; - FILE *fp; char *fname; char *n; @@ -229,14 +226,14 @@ static bool read_ecdsa_private_key(void) { static bool read_invitation_key(void) { FILE *fp; - char *fname; + char fname[PATH_MAX]; if(invitation_key) { ecdsa_free(invitation_key); invitation_key = NULL; } - xasprintf(&fname, "%s" SLASH "invitations" SLASH "ed25519_key.priv", confbase); + snprintf(fname, sizeof fname, "%s" SLASH "invitations" SLASH "ed25519_key.priv", confbase); fp = fopen(fname, "r"); @@ -247,7 +244,6 @@ static bool read_invitation_key(void) { logger(DEBUG_ALWAYS, LOG_ERR, "Reading Ed25519 private key file `%s' failed", fname); } - free(fname); return invitation_key; } @@ -330,13 +326,12 @@ void regenerate_key(void) { void load_all_subnets(void) { DIR *dir; struct dirent *ent; - char *dname; + char dname[PATH_MAX]; - xasprintf(&dname, "%s" SLASH "hosts", confbase); + snprintf(dname, sizeof dname, "%s" SLASH "hosts", confbase); dir = opendir(dname); if(!dir) { logger(DEBUG_ALWAYS, LOG_ERR, "Could not open %s: %s", dname, strerror(errno)); - free(dname); return; } @@ -383,13 +378,12 @@ void load_all_subnets(void) { void load_all_nodes(void) { DIR *dir; struct dirent *ent; - char *dname; + char dname[PATH_MAX]; - xasprintf(&dname, "%s" SLASH "hosts", confbase); + snprintf(dname, sizeof dname, "%s" SLASH "hosts", confbase); dir = opendir(dname); if(!dir) { logger(DEBUG_ALWAYS, LOG_ERR, "Could not open %s: %s", dname, strerror(errno)); - free(dname); return; }