]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cauthtool: mode 0600 for keyrings
authorSage Weil <sage@newdream.net>
Thu, 11 Feb 2010 23:31:14 +0000 (15:31 -0800)
committerSage Weil <sage@newdream.net>
Thu, 11 Feb 2010 23:33:09 +0000 (15:33 -0800)
src/cauthtool.cc
src/common/buffer.cc
src/include/buffer.h

index 44c4d7586b9e6a8591fc3be6c199b2c43bc41834..6458e6c206418dcf9c0f1ed53e89c513cac3dad9 100644 (file)
@@ -197,7 +197,7 @@ int main(int argc, const char **argv)
   if (modified) {
     bufferlist bl;
     ::encode(keyring, bl);
-    r = bl.write_file(fn);
+    r = bl.write_file(fn, 0600);
     if (r < 0) {
       cerr << "could not write " << fn << std::endl;
     }
index da17022295478797df31510c4f11946956db67ad..bb47673b3a6b56990a9b8e2528b49530982e3da9 100644 (file)
@@ -71,9 +71,9 @@ int buffer::list::read_file(const char *fn, bool silent)
   return 0;
 }
 
-int buffer::list::write_file(const char *fn)
+int buffer::list::write_file(const char *fn, int mode)
 {
-  int fd = ::open(fn, O_WRONLY|O_CREAT|O_TRUNC, 0644);
+  int fd = ::open(fn, O_WRONLY|O_CREAT|O_TRUNC, mode);
   if (fd < 0) {
     char buf[80];
     cerr << "can't write " << fn << ": " << strerror_r(errno, buf, sizeof(buf)) << std::endl;
index a1656e0c145a5808d8ad61812b387eb4f21122e9..7ff6d85749ef209b69c1ce083e95b5cd59c44cd4 100644 (file)
@@ -1129,7 +1129,7 @@ public:
 
     void hexdump(std::ostream &out) const;
     int read_file(const char *fn, bool silent=false);
-    int write_file(const char *fn);
+    int write_file(const char *fn, int mode=0644);
     __u32 crc32c(__u32 crc) {
       for (std::list<ptr>::const_iterator it = _buffers.begin(); 
           it != _buffers.end();