monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Please review quickly [Fwd: [bug #19137] permissions on


From: Markus Schiltknecht
Subject: [Monotone-devel] Please review quickly [Fwd: [bug #19137] permissions on ~/.monotone/keys/ are too permissive]
Date: Wed, 11 Apr 2007 20:16:38 +0200
User-agent: Icedove 1.5.0.10 (X11/20070329)

Hi,

please, someone who's more into UNIX file permissions and C++ style, review revision a40d623653f3e9db83553ee2b9ecbd4f2b5a81f0 which I've just committed. It should fix bug # 19137.

There are only very few changes, thus I've copied them below for having a quick look.

Thanks.

Markus



#
# old_revision [24e396258037e472b264a8ed76689f7b7ef74563]
#
# patch "key_store.cc"
#  from [70b97a9e2a06654ec641a1709c2a875cdfa603d5]
#    to [fda46d5fa8a5b2a52421c1f83413a208e2c6401f]
#
============================================================
--- key_store.cc        70b97a9e2a06654ec641a1709c2a875cdfa603d5
+++ key_store.cc        fda46d5fa8a5b2a52421c1f83413a208e2c6401f
@@ -1,4 +1,5 @@
 #include <sstream>
+#include <sys/stat.h>

 #include "key_store.hh"
 #include "file_io.hh"
@@ -210,8 +211,12 @@ key_store::write_key(rsa_keypair_id cons
   data dat(oss.str());
   system_path file;
   get_key_file(ident, file);
+
+  // set a restrictive umask, write the file and reset umask
+  mode_t mask = umask(S_IRWXG|S_IRWXO);
L(FL("writing key '%s' to file '%s' in dir '%s'") % ident % file % key_dir);
   write_data(file, dat, key_dir);
+  umask(mask);
 }

 bool





reply via email to

[Prev in Thread] Current Thread [Next in Thread]