[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Add ability to disable testing file paranoia; hook up c...



Update of /home/minion/cvsroot/src/minion/lib/mixminion
In directory moria.mit.edu:/tmp/cvs-serv19899/lib/mixminion

Modified Files:
	ClientMain.py Common.py testSupport.py 
Log Message:
Add ability to disable testing file paranoia; hook up config option to disable paranoia altogether

Index: ClientMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/ClientMain.py,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- ClientMain.py	26 Jun 2003 17:43:27 -0000	1.93
+++ ClientMain.py	26 Jun 2003 17:52:08 -0000	1.94
@@ -1907,7 +1907,7 @@
                 else:
                     LOG.setMinSeverity("INFO")
             mixminion.Common.configureShredCommand(self.config)
-            mixminion.Common.configureTrustedUsers(self.config)
+            mixminion.Common.configureFileParanoia(self.config)
             if not self.verbose:
                 try:
                     LOG.setMinSeverity("WARN")

Index: Common.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/Common.py,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- Common.py	26 Jun 2003 17:43:27 -0000	1.93
+++ Common.py	26 Jun 2003 17:52:08 -0000	1.94
@@ -452,7 +452,14 @@
                          d, groupName, mode&0777)
                 _WARNED_DIRECTORIES[d] = 1
 
-def configureTrustedUsers(config):
+def configureFileParanoia(config):
+    global _CHECK_UID
+    global _CHECK_GID
+    global _CHECK_MODE
+    paranoia = config['Host']['FileParanoia']
+    if not paranoia:
+        _CHECK_UID = _CHECK_GID = _CHECK_MODE = 0
+
     users = config['Host']['TrustedUser']
     if not users:
         return

Index: testSupport.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/testSupport.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- testSupport.py	5 Jun 2003 05:34:56 -0000	1.17
+++ testSupport.py	26 Jun 2003 17:52:09 -0000	1.18
@@ -126,6 +126,11 @@
 # directory.  If None, it hasn't been created yet.  If it exists,
 # it must be owned by us, mode 700.
 
+_CHECK_MODE = 1
+_CHECK_UID = 1
+if sys.platform in ('cygwin', 'win32') or os.environ.get("MM_NO_FILE_PARANOIA"):
+    _CHECK_MODE = _CHECK_UID = 0
+
 _MM_TESTING_TEMPDIR = None
 # How many temporary files have we created so far?
 _MM_TESTING_TEMPDIR_COUNTER = 0
@@ -168,11 +173,11 @@
         st = os.stat(temp)
 
         # And be writeable only by us...
-        if st[stat.ST_MODE] & 077:
+        if _CHECK_MODE and st[stat.ST_MODE] & 077:
             print "Couldn't make temp dir %r with secure permissions" %temp
             sys.exit(1)
         # And be owned by us...
-        if st[stat.ST_UID] != os.getuid():
+        if _CHECK_UID and st[stat.ST_UID] != os.getuid():
             print "The wrong user owns temp dir %r"%temp
             sys.exit(1)