X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincd.c;h=2ab9ba7a09160d8b14bbb0cad35ef5f66c897f24;hb=7c223917cb3d478fc3f5b23ee5602925f083e4d4;hp=14a0c1120d4d0c81519c5a8e20b14944bd733da2;hpb=0a786ffbb9d293d7704b8e264f3943a616ed25cc;p=tinc diff --git a/src/tincd.c b/src/tincd.c index 14a0c112..2ab9ba7a 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -1,7 +1,7 @@ /* tincd.c -- the main file for tincd Copyright (C) 1998-2005 Ivo Timmermans - 2000-2015 Guus Sliepen + 2000-2016 Guus Sliepen 2008 Max Rijevski 2009 Michael Tokarev 2010 Julien Muchembled @@ -43,8 +43,6 @@ #include #endif -#include - #include "conf.h" #include "control.h" #include "crypto.h" @@ -263,11 +261,14 @@ static bool parse_options(int argc, char **argv) { netname = NULL; } - if(netname && (strpbrk(netname, "\\/") || *netname == '.')) { + if(netname && !check_netname(netname, false)) { fprintf(stderr, "Invalid character in netname!\n"); return false; } + if(netname && !check_netname(netname, true)) + fprintf(stderr, "Warning: unsafe character in netname!\n"); + return true; } @@ -340,11 +341,12 @@ int main(int argc, char **argv) { return 1; make_names(true); + chdir(confbase); if(show_version) { printf("%s version %s (built %s %s, protocol %d.%d)\n", PACKAGE, BUILD_VERSION, BUILD_DATE, BUILD_TIME, PROT_MAJOR, PROT_MINOR); - printf("Copyright (C) 1998-2014 Ivo Timmermans, Guus Sliepen and others.\n" + printf("Copyright (C) 1998-2016 Ivo Timmermans, Guus Sliepen and others.\n" "See the AUTHORS file for a complete list.\n\n" "tinc comes with ABSOLUTELY NO WARRANTY. This is free software,\n" "and you are welcome to redistribute it under certain conditions;\n" @@ -398,6 +400,9 @@ int main(int argc, char **argv) { if(!read_server_config()) return 1; + if(!debug_level) + get_config_int(lookup_config(config_tree, "LogLevel"), &debug_level); + #ifdef HAVE_LZO if(lzo_init() != LZO_E_OK) { logger(DEBUG_ALWAYS, LOG_ERR, "Error initializing LZO compressor!");