[prev in list] [next in list] [prev in thread] [next in thread]
List: tmda-cvs
Subject: CVS: tmda/TMDA ChangeLog,1.212,1.213 Defaults.py,1.132,1.133
From: "Jason R. Mastaler" <jasonrm () users ! sourceforge ! net>
Date: 2002-06-18 23:14:11
[Download RAW message or body]
Update of /cvsroot/tmda/tmda/TMDA
In directory usw-pr-cvs1:/tmp/cvs-serv24215
Modified Files:
ChangeLog Defaults.py
Log Message:
Add CONFIG_EXEC. Set by the administrator in /etc/tmdarc, this option
toggles Python interpretation of the users' .tmda/config.
If on (the default), the .tmda/config will be considered a series of
Python statements. If off, it will be assumed to be a ConfigParser
style configuration file. See
http://www.python.org/doc/current/lib/module-ConfigParser.html for
more details.
Might be used in applications where having executable Python in the
user's .tmda/config is a security concern.
Note the following differences from a traditional interpreted Python
config file:
o [TMDA_CONFIG] section header at the top.
o An option's value should not be quoted, as it will always be parsed
as a string. Digits will automatically be converted into integers.
o Only options which take a string or an integer can be set.
o Obviously, no Python will be recognized, so things like
os.path.expanduser() are out.
An example restricted .tmda/config:
[TMDA_CONFIG]
DATED_TEMPLATE_VARS = 1
HMAC_BYTES = 3
HOSTNAME = mastaler.com
OUTGOINGMAIL = sendmail
RECIPIENT_DELIMITER = -
TEMPLATE_DIR = /home/jason/.tmda/templates
TIMEOUT = 8d
USERNAME = jason
Index: ChangeLog
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/ChangeLog,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -r1.212 -r1.213
--- ChangeLog 16 Jun 2002 23:44:32 -0000 1.212
+++ ChangeLog 18 Jun 2002 23:14:09 -0000 1.213
@@ -1,3 +1,7 @@
+2002-06-18 Jason R. Mastaler <jasonrm@nightshade.la.mastaler.com>
+
+ * Defaults.py (CONFIG_EXEC): New variable.
+
2002-06-16 Jason R. Mastaler <jasonrm@nightshade.la.mastaler.com>
* Defaults.py: Add PENDING_WHITELIST_APPEND &
Index: Defaults.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/Defaults.py,v
retrieving revision 1.132
retrieving revision 1.133
diff -u -r1.132 -r1.133
--- Defaults.py 16 Jun 2002 23:44:32 -0000 1.132
+++ Defaults.py 18 Jun 2002 23:14:09 -0000 1.133
@@ -76,9 +76,32 @@
if not os.path.exists(TMDARC):
TMDARC = os.path.expanduser('~/.tmda/config')
+# CONFIG_EXEC
+# If set to 0 in GLOBAL_TMDARC, the user's TMDARC file will be parsed
+# using ConfigParser, otherwise it will evaluated as a sequence of
+# Python statements using execfile().
+# Default is 1 (execfile())
+if not vars().has_key('CONFIG_EXEC'):
+ CONFIG_EXEC = 1
+
# Read-in the user's configuration file.
if os.path.exists(TMDARC):
- execfile(TMDARC)
+ if CONFIG_EXEC:
+ execfile(TMDARC)
+ else:
+ import ConfigParser
+ cf = ConfigParser.ConfigParser()
+ cf.read(TMDARC)
+ cf_section = 'TMDA_CONFIG'
+ for option in cf.options(cf_section):
+ value = cf.get(cf_section, option)
+ option = option.upper()
+ # Translate options into variables.
+ if value in list(string.digits):
+ # make sure integer values don't get turned into strings
+ exec('%s = %s' % (option, value))
+ else:
+ exec('%s = "%s"' % (option, value))
import Util
____________________________________________
tmda-cvs mailing list
http://libertine.org/lists/listinfo/tmda-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic