[Nym3-commit] r468 - trunk/nymbaron/Server
zax at conuropsis.org
zax at conuropsis.org
Thu Mar 9 01:41:33 CET 2006
Author: zax
Date: 2006-03-09 01:41:32 +0100 (Thu, 09 Mar 2006)
New Revision: 468
Modified:
trunk/nymbaron/Server/Config.py
Log:
Add a file/dir permissions check function. (Not called at this time)
Modified: trunk/nymbaron/Server/Config.py
===================================================================
--- trunk/nymbaron/Server/Config.py 2006-03-08 21:21:54 UTC (rev 467)
+++ trunk/nymbaron/Server/Config.py 2006-03-09 00:41:32 UTC (rev 468)
@@ -27,6 +27,7 @@
import os
import ConfigParser
import logging
+import stat
SYSFILE = "/etc/nymbaron/nymbarond.conf"
LEVELMAP = {'debug': logging.DEBUG, 'info': logging.INFO}
@@ -46,6 +47,23 @@
return logging.INFO
return logging.DEBUG
+def permissions_check(fs):
+#TODO: This function isn't called at this time
+ if os.path.exists(fs):
+ st = os.stat(fs)
+ # Is the item a directory or a file? Set the acceptable permission
+ # parameter to match dir or file.
+ if stat.S_ISDIR(st[stat.ST_MODE]):
+ type = 'directory'
+ allow = '0700'
+ else:
+ type = 'file'
+ allow = '0600'
+ # Check the permissions on the item
+ mode = oct(st[stat.ST_MODE] & 0777)
+ if mode != allow:
+ logger.info('Permissions on %s %s currently %s, should be %s' % (type,item,mode,allow))
+
class Config:
def __init__(self, filename = None):
More information about the Nym3-commit
mailing list