[Zodb-checkins] SVN: ZODB/branches/blob-merge-branch/src/Z Create a method to log if the base directory is not secure.

Chris McDonough chrism at plope.com
Mon Feb 27 16:33:36 EST 2006


Log message for revision 65532:
  Create a method to log if the base directory is not secure.
  

Changed:
  U   ZODB/branches/blob-merge-branch/src/ZEO/ClientStorage.py
  U   ZODB/branches/blob-merge-branch/src/ZODB/Blobs/Blob.py
  U   ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py

-=-
Modified: ZODB/branches/blob-merge-branch/src/ZEO/ClientStorage.py
===================================================================
--- ZODB/branches/blob-merge-branch/src/ZEO/ClientStorage.py	2006-02-27 19:11:08 UTC (rev 65531)
+++ ZODB/branches/blob-merge-branch/src/ZEO/ClientStorage.py	2006-02-27 21:33:35 UTC (rev 65532)
@@ -318,11 +318,10 @@
         if blob_dir is not None:
             self.fshelper = FilesystemHelper(blob_dir)
             self.fshelper.create()
-            if not self.fshelper.isSecure(blob_dir):
-                log2('Blob dir %s has insecure mode setting' % blob_dir,
-                     level=logging.WARNING)
+            self.fshelper.checkSecure()
         else:
             self.fshelper = None
+
         # Initialize locks
         self.blob_status_lock = threading.Lock()
         self.blob_status = {}

Modified: ZODB/branches/blob-merge-branch/src/ZODB/Blobs/Blob.py
===================================================================
--- ZODB/branches/blob-merge-branch/src/ZODB/Blobs/Blob.py	2006-02-27 19:11:08 UTC (rev 65531)
+++ ZODB/branches/blob-merge-branch/src/ZODB/Blobs/Blob.py	2006-02-27 21:33:35 UTC (rev 65532)
@@ -298,6 +298,11 @@
         """ Ensure that (POSIX) path mode bits are 0700 """
         return (os.stat(path).st_mode & 077) != 0
 
+    def checkSecure(self):
+        if not self.isSecure(self.base_dir):
+            log('Blob dir %s has insecure mode setting' % path,
+                 level=logging.WARNING)
+
     def getPathForOID(self, oid):
         """ Given an OID, return the path on the filesystem where
         the blob data relating to that OID is stored """

Modified: ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py
===================================================================
--- ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py	2006-02-27 19:11:08 UTC (rev 65531)
+++ ZODB/branches/blob-merge-branch/src/ZODB/Blobs/BlobStorage.py	2006-02-27 21:33:35 UTC (rev 65532)
@@ -44,10 +44,8 @@
         # TODO Complain if storage is ClientStorage
         ProxyBase.__init__(self, storage)
         self.fshelper = FilesystemHelper(base_directory)
-        if not os.path.exists(self.base_directory):
-            os.makedirs(self.base_directory, 0700)
-            logger.info("Blob directory '%s' does not exist. "
-                        "Created new directory." % self.base_directory)
+        self.fshelper.create()
+        self.fshelper.checkSecure()
         self.dirty_oids = []
 
     def __repr__(self):



More information about the Zodb-checkins mailing list