From 0adf4876a432c25d4ed05ba68970a43c62ea749d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Wed, 12 Jun 2013 20:29:47 +0000 Subject: [PATCH] makepem: create pem only rw for the user, on non-win32 --- src/znc.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/znc.cpp b/src/znc.cpp index 8421bf51..f664c8c6 100644 --- a/src/znc.cpp +++ b/src/znc.cpp @@ -263,7 +263,16 @@ bool CZNC::WritePemFile() { CString sPemFile = GetPemLocation(); CUtils::PrintAction("Writing Pem file [" + sPemFile + "]"); +#ifndef _WIN32 + int fd = creat(sPemFile.c_str(), 0600); + if (fd == -1) { + CUtils::PrintStatus(false, "Unable to open"); + return false; + } + FILE *f = fdopen(fd, "w"); +#else FILE *f = fopen(sPemFile.c_str(), "w"); +#endif if (!f) { CUtils::PrintStatus(false, "Unable to open");