]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
Add download.umask config option with default of 077
authorDavid Stainton <dstainton415@gmail.com>
Tue, 8 Dec 2015 01:01:19 +0000 (03:01 +0200)
committerDavid Stainton <dstainton415@gmail.com>
Tue, 8 Dec 2015 01:01:19 +0000 (03:01 +0200)
src/allmydata/client.py
src/allmydata/frontends/magic_folder.py
src/allmydata/test/test_magic_folder.py

index ef15840763dc72168fcb79c7f8466d658e4296dd..62d99b043daa45f233b43ee40e6b48536387d6b0 100644 (file)
@@ -511,8 +511,8 @@ class Client(node.Node, pollmixin.PollMixin):
             dbfile = abspath_expanduser_unicode(dbfile)
 
             from allmydata.frontends import magic_folder
-
-            s = magic_folder.MagicFolder(self, upload_dircap, collective_dircap, local_dir, dbfile)
+            umask = self.get_config("magic_folder", "download.umask", 0077)
+            s = magic_folder.MagicFolder(self, upload_dircap, collective_dircap, local_dir, dbfile, umask)
             s.setServiceParent(self)
             s.startService()
 
index dddffb928cc22dbed833f739a9750095fa116526..e1fbff619e5546ed8df465d4472691b182c8c3e6 100644 (file)
@@ -56,7 +56,7 @@ def is_new_file(pathinfo, db_entry):
 class MagicFolder(service.MultiService):
     name = 'magic-folder'
 
-    def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile,
+    def __init__(self, client, upload_dircap, collective_dircap, local_path_u, dbfile, umask,
                  pending_delay=1.0, clock=None):
         precondition_abspath(local_path_u)
 
@@ -77,7 +77,7 @@ class MagicFolder(service.MultiService):
 
         self.uploader = Uploader(client, local_path_u, db, upload_dirnode, pending_delay, clock, immediate)
         self.downloader = Downloader(client, local_path_u, db, collective_dirnode,
-                                     upload_dirnode.get_readonly_uri(), clock, self.uploader.is_pending)
+                                     upload_dirnode.get_readonly_uri(), clock, self.uploader.is_pending, umask)
 
     def startService(self):
         # TODO: why is this being called more than once?
@@ -527,7 +527,7 @@ class Downloader(QueueMixin, WriteFileMixin):
     REMOTE_SCAN_INTERVAL = 3  # facilitates tests
 
     def __init__(self, client, local_path_u, db, collective_dirnode,
-                 upload_readonly_dircap, clock, is_upload_pending, umask = 0123):
+                 upload_readonly_dircap, clock, is_upload_pending, umask):
         QueueMixin.__init__(self, client, local_path_u, db, 'downloader', clock)
 
         if not IDirectoryNode.providedBy(collective_dirnode):
index dbc91a8fad94588ad457b8a1dcce9fbb6dd28199..742a963625c63330c8193d0ec1a3cfed9e5d807e 100644 (file)
@@ -1122,7 +1122,7 @@ class MockTest(MagicFolderTestMixin, unittest.TestCase):
                 pass
 
         writefile = TestWriteFileMixin()
-        writefile._umask = 0123
+        writefile._umask = 0077
 
         # create a file with name "foobar" with content "foo"
         # write downloaded file content "bar" into "foobar" with is_conflict = False