X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Ftincd.c;h=9e0ad4aabb87043268a8b0c559827273b11904d9;hp=a37a61253a5bab3a9f9508b62ec2d37f1dcf1565;hb=5e7c52610f8c8b9c38e437ef166a08372d5b8a61;hpb=bb2f18a3fc8acb7802f30e06153def30eb97a994 diff --git a/src/tincd.c b/src/tincd.c index a37a6125..9e0ad4aa 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: tincd.c,v 1.10.4.84 2003/08/08 19:45:21 guus Exp $ + $Id: tincd.c,v 1.10.4.86 2003/08/17 09:03:30 guus Exp $ */ #include "system.h" @@ -300,11 +300,16 @@ static bool keygen(int bits) fprintf(stderr, _("Done.\n")); asprintf(&filename, "%s/rsa_key.priv", confbase); - f = ask_and_safe_open(filename, _("private RSA key"), true, "a"); + f = ask_and_open(filename, _("private RSA key"), "a"); if(!f) return false; - + +#ifdef HAVE_FCHMOD + /* Make it unreadable for others. */ + fchmod(fileno(f), 0600); +#endif + if(ftell(f)) fprintf(stderr, _("Appending key to existing contents.\nMake sure only one key is stored in the file.\n")); @@ -319,7 +324,7 @@ static bool keygen(int bits) else asprintf(&filename, "%s/rsa_key.pub", confbase); - f = ask_and_safe_open(filename, _("public RSA key"), false, "a"); + f = ask_and_open(filename, _("public RSA key"), "a"); if(!f) return false; @@ -353,7 +358,7 @@ static void make_names(void) #ifdef HAVE_MINGW if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) { if(!RegQueryValueEx(key, NULL, 0, 0, installdir, &len)) { - if(!pidfilename) + if(!logfilename) asprintf(&logfilename, "%s/log/%s.log", identname); if(!confbase) { if(netname)