Permalink
Browse files

Merge pull request #371 from viric/pem_mode

makepem: create pem only rw for the user, on non-win32
  • Loading branch information...
2 parents fddd891 + 0adf487 commit 30b4cfa1422b53b1b2b02a09138d90fa71e783c9 @DarthGandalf DarthGandalf committed Jun 13, 2013
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/znc.cpp
View
9 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");

0 comments on commit 30b4cfa

Please sign in to comment.