diff options
author | Xin Ouyang <Xin.Ouyang@windriver.com> | 2013-01-17 16:32:51 +0800 |
---|---|---|
committer | Xin Ouyang <Xin.Ouyang@windriver.com> | 2013-01-18 14:50:36 +0800 |
commit | 8d481d76a95497d19bd0cfa2eadce251e64cae6d (patch) | |
tree | 12ff6317e659aa065d1671139e8150fa20f1c536 | |
parent | 4766a54dd801733b3b56f103609163e52ad0b115 (diff) | |
download | meta-selinux-8d481d76a95497d19bd0cfa2eadce251e64cae6d.tar.gz |
python: disable exit handler to rw history file
oe-core adds a exit handler to rw python command history file
(~/.python-history). There are no allow rules for every user&role
to use create/read/write ~/.python-history, and it is also
improper to add rules because these rules would blow up the
user&role's scope of authority.
So disable the handler, if selinux enabled.
Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
-rw-r--r-- | recipes-devtools/python/python/sitecustomize.py | 26 | ||||
-rw-r--r-- | recipes-devtools/python/python_2.7.2.bbappend | 5 |
2 files changed, 31 insertions, 0 deletions
diff --git a/recipes-devtools/python/python/sitecustomize.py b/recipes-devtools/python/python/sitecustomize.py new file mode 100644 index 0000000..d2b71fa --- /dev/null +++ b/recipes-devtools/python/python/sitecustomize.py | |||
@@ -0,0 +1,26 @@ | |||
1 | # OpenEmbedded sitecustomize.py (C) 2002-2008 Michael 'Mickey' Lauer <mlauer@vanille-media.de> | ||
2 | # GPLv2 or later | ||
3 | # Version: 20081123 | ||
4 | # Features: | ||
5 | # * set proper default encoding | ||
6 | # Features removed for SELinux: | ||
7 | # * enable readline completion in the interactive interpreter | ||
8 | # * load command line history on startup | ||
9 | # * save command line history on exit | ||
10 | |||
11 | import os | ||
12 | |||
13 | def __enableDefaultEncoding(): | ||
14 | import sys | ||
15 | try: | ||
16 | sys.setdefaultencoding( "utf8" ) | ||
17 | except LookupError: | ||
18 | pass | ||
19 | |||
20 | import sys | ||
21 | try: | ||
22 | import rlcompleter, readline | ||
23 | except ImportError: | ||
24 | pass | ||
25 | else: | ||
26 | __enableDefaultEncoding() | ||
diff --git a/recipes-devtools/python/python_2.7.2.bbappend b/recipes-devtools/python/python_2.7.2.bbappend new file mode 100644 index 0000000..b8447e9 --- /dev/null +++ b/recipes-devtools/python/python_2.7.2.bbappend | |||
@@ -0,0 +1,5 @@ | |||
1 | PR .= ".1" | ||
2 | |||
3 | inherit selinux | ||
4 | # If selinux enabled, disable handlers to rw command history file | ||
5 | FILESEXTRAPATHS_prepend := "${@target_selinux(d, '${THISDIR}/${PN}:')}" | ||