Advertisement
Guest User

ZODB Blob Permissions Patch

a guest
Jun 17th, 2011
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.72 KB | None | 0 0
  1. Index: ZODB/blob.py
  2. ===================================================================
  3. --- ZODB/blob.py    (Revision 121959)
  4. +++ ZODB/blob.py    (Arbeitskopie)
  5. @@ -337,11 +337,11 @@
  6.  
  7.      def create(self):
  8.          if not os.path.exists(self.base_dir):
  9. -            os.makedirs(self.base_dir, 0700)
  10. +            os.makedirs(self.base_dir, 0750)
  11.              log("Blob directory '%s' does not exist. "
  12.                  "Created new directory." % self.base_dir)
  13.          if not os.path.exists(self.temp_dir):
  14. -            os.makedirs(self.temp_dir, 0700)
  15. +            os.makedirs(self.temp_dir, 0750)
  16.              log("Blob temporary directory '%s' does not exist. "
  17.                  "Created new directory." % self.temp_dir)
  18.  
  19. @@ -359,8 +359,8 @@
  20.                      (self.layout_name, self.base_dir, layout))
  21.  
  22.      def isSecure(self, path):
  23. -        """Ensure that (POSIX) path mode bits are 0700."""
  24. -        return (os.stat(path).st_mode & 077) == 0
  25. +        """Ensure that (POSIX) path mode bits are 0750."""
  26. +        return (os.stat(path).st_mode & 027) == 0
  27.  
  28.      def checkSecure(self):
  29.          if not self.isSecure(self.base_dir):
  30. @@ -385,7 +385,7 @@
  31.  
  32.          if create and not os.path.exists(path):
  33.              try:
  34. -                os.makedirs(path, 0700)
  35. +                os.makedirs(path, 0750)
  36.              except OSError:
  37.                  # We might have lost a race.  If so, the directory
  38.                  # must exist now
  39. @@ -891,7 +891,7 @@
  40.              file2.close()
  41.          remove_committed(f1)
  42.      if chmod:
  43. -        os.chmod(f2, stat.S_IREAD)
  44. +        os.chmod(f2, stat.S_IRUSR | stat.S_IRGRP)
  45.  
  46.  if sys.platform == 'win32':
  47.      # On Windows, you can't remove read-only files, so make the
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement