Apply patches from Christoph A.

* fix sandbox title
* stop xephyr from li
Also ignore errors on sandbox include of directory missing files
This commit is contained in:
Dan Walsh 2011-04-22 07:06:23 -04:00
parent e1285d4541
commit 4a56398540
2 changed files with 29 additions and 18 deletions

View File

@ -1642,7 +1642,7 @@ index ff0ee7c..0c8a085 100644
test: test:
@python test_sandbox.py -v @python test_sandbox.py -v
diff --git a/policycoreutils/sandbox/sandbox b/policycoreutils/sandbox/sandbox diff --git a/policycoreutils/sandbox/sandbox b/policycoreutils/sandbox/sandbox
index 48a26c2..29c99ed 100644 index 48a26c2..5fa1d72 100644
--- a/policycoreutils/sandbox/sandbox --- a/policycoreutils/sandbox/sandbox
+++ b/policycoreutils/sandbox/sandbox +++ b/policycoreutils/sandbox/sandbox
@@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
@ -1702,7 +1702,7 @@ index 48a26c2..29c99ed 100644
if not os.path.exists(newdir): if not os.path.exists(newdir):
os.makedirs(newdir) os.makedirs(newdir)
dest = newdir + "/" + bname dest = newdir + "/" + bname
@@ -81,9 +85,10 @@ def copyfile(file, dir, dest): @@ -81,9 +85,12 @@ def copyfile(file, dir, dest):
shutil.copytree(file, dest) shutil.copytree(file, dest)
else: else:
shutil.copy2(file, dest) shutil.copy2(file, dest)
@ -1711,11 +1711,13 @@ index 48a26c2..29c99ed 100644
- for e in elist: - for e in elist:
- sys.stderr.write(e[1]) - sys.stderr.write(e[1])
+ for e in elist.message: + for e in elist.message:
+ # ignore files that are missing
+ if not e[2].startswith("[Errno 2]"):
+ sys.stderr.write(e[2]) + sys.stderr.write(e[2])
SAVE_FILES[file] = (dest, os.path.getmtime(dest)) SAVE_FILES[file] = (dest, os.path.getmtime(dest))
@@ -161,10 +166,10 @@ class Sandbox: @@ -161,10 +168,10 @@ class Sandbox:
if not self.__options.homedir or not self.__options.tmpdir: if not self.__options.homedir or not self.__options.tmpdir:
self.usage(_("Homedir and tempdir required for level mounts")) self.usage(_("Homedir and tempdir required for level mounts"))
@ -1729,7 +1731,7 @@ index 48a26c2..29c99ed 100644
def __mount_callback(self, option, opt, value, parser): def __mount_callback(self, option, opt, value, parser):
self.__mount = True self.__mount = True
@@ -172,6 +177,15 @@ class Sandbox: @@ -172,6 +179,15 @@ class Sandbox:
def __x_callback(self, option, opt, value, parser): def __x_callback(self, option, opt, value, parser):
self.__mount = True self.__mount = True
setattr(parser.values, option.dest, True) setattr(parser.values, option.dest, True)
@ -1745,7 +1747,7 @@ index 48a26c2..29c99ed 100644
def __validdir(self, option, opt, value, parser): def __validdir(self, option, opt, value, parser):
if not os.path.isdir(value): if not os.path.isdir(value):
@@ -194,6 +208,8 @@ class Sandbox: @@ -194,6 +210,8 @@ class Sandbox:
self.__include(option, opt, i[:-1], parser) self.__include(option, opt, i[:-1], parser)
except IOError, e: except IOError, e:
sys.stderr.write(str(e)) sys.stderr.write(str(e))
@ -1754,7 +1756,7 @@ index 48a26c2..29c99ed 100644
fd.close() fd.close()
def __copyfiles(self): def __copyfiles(self):
@@ -212,13 +228,15 @@ class Sandbox: @@ -212,13 +230,15 @@ class Sandbox:
/etc/gdm/Xsession /etc/gdm/Xsession
""") """)
else: else:
@ -1772,7 +1774,7 @@ index 48a26c2..29c99ed 100644
kill -TERM $WM_PID 2> /dev/null kill -TERM $WM_PID 2> /dev/null
""" % (command, wm, command)) """ % (command, wm, command))
fd.close() fd.close()
@@ -226,14 +244,25 @@ kill -TERM $WM_PID 2> /dev/null @@ -226,14 +246,25 @@ kill -TERM $WM_PID 2> /dev/null
def usage(self, message = ""): def usage(self, message = ""):
error_exit("%s\n%s" % (self.__parser.usage, message)) error_exit("%s\n%s" % (self.__parser.usage, message))
@ -1802,7 +1804,7 @@ index 48a26c2..29c99ed 100644
parser = OptionParser(version=self.VERSION, usage=usage) parser = OptionParser(version=self.VERSION, usage=usage)
parser.disable_interspersed_args() parser.disable_interspersed_args()
@@ -268,6 +297,10 @@ sandbox [-h] [-[X|M] [-l level ] [-H homedir] [-T tempdir]] [-I includefile ] [- @@ -268,6 +299,10 @@ sandbox [-h] [-[X|M] [-l level ] [-H homedir] [-T tempdir]] [-I includefile ] [-
action="callback", callback=self.__validdir, action="callback", callback=self.__validdir,
help=_("alternate /tmp directory to use for mounting")) help=_("alternate /tmp directory to use for mounting"))
@ -1813,7 +1815,7 @@ index 48a26c2..29c99ed 100644
parser.add_option("-W", "--windowmanager", dest="wm", parser.add_option("-W", "--windowmanager", dest="wm",
type="string", type="string",
default="/usr/bin/matchbox-window-manager -use_titlebar no", default="/usr/bin/matchbox-window-manager -use_titlebar no",
@@ -276,13 +309,17 @@ sandbox [-h] [-[X|M] [-l level ] [-H homedir] [-T tempdir]] [-I includefile ] [- @@ -276,13 +311,17 @@ sandbox [-h] [-[X|M] [-l level ] [-H homedir] [-T tempdir]] [-I includefile ] [-
parser.add_option("-l", "--level", dest="level", parser.add_option("-l", "--level", dest="level",
help=_("MCS/MLS level for the sandbox")) help=_("MCS/MLS level for the sandbox"))
@ -1832,7 +1834,7 @@ index 48a26c2..29c99ed 100644
if self.__options.setype: if self.__options.setype:
self.setype = self.__options.setype self.setype = self.__options.setype
@@ -300,6 +337,10 @@ sandbox [-h] [-[X|M] [-l level ] [-H homedir] [-T tempdir]] [-I includefile ] [- @@ -300,6 +339,10 @@ sandbox [-h] [-[X|M] [-l level ] [-H homedir] [-T tempdir]] [-I includefile ] [-
self.__homedir = self.__options.homedir self.__homedir = self.__options.homedir
self.__tmpdir = self.__options.tmpdir self.__tmpdir = self.__options.tmpdir
else: else:
@ -1843,7 +1845,7 @@ index 48a26c2..29c99ed 100644
if len(cmds) == 0: if len(cmds) == 0:
self.usage(_("Command required")) self.usage(_("Command required"))
cmds[0] = fullpath(cmds[0]) cmds[0] = fullpath(cmds[0])
@@ -329,44 +370,43 @@ sandbox [-h] [-[X|M] [-l level ] [-H homedir] [-T tempdir]] [-I includefile ] [- @@ -329,44 +372,43 @@ sandbox [-h] [-[X|M] [-l level ] [-H homedir] [-T tempdir]] [-I includefile ] [-
def __setup_dir(self): def __setup_dir(self):
if self.__options.level or self.__options.session: if self.__options.level or self.__options.session:
return return
@ -1907,7 +1909,7 @@ index 48a26c2..29c99ed 100644
selinux.setexeccon(self.__execcon) selinux.setexeccon(self.__execcon)
rc = subprocess.Popen(self.__cmds).wait() rc = subprocess.Popen(self.__cmds).wait()
@@ -404,7 +444,7 @@ if __name__ == '__main__': @@ -404,7 +446,7 @@ if __name__ == '__main__':
sandbox = Sandbox() sandbox = Sandbox()
rc = sandbox.main() rc = sandbox.main()
except OSError, error: except OSError, error:
@ -2057,19 +2059,22 @@ index ff8b3ef..8508647 100644
# Source function library. # Source function library.
diff --git a/policycoreutils/sandbox/sandboxX.sh b/policycoreutils/sandbox/sandboxX.sh diff --git a/policycoreutils/sandbox/sandboxX.sh b/policycoreutils/sandbox/sandboxX.sh
index 8338203..e501b03 100644 index 8338203..f9e23ec 100644
--- a/policycoreutils/sandbox/sandboxX.sh --- a/policycoreutils/sandbox/sandboxX.sh
+++ b/policycoreutils/sandbox/sandboxX.sh +++ b/policycoreutils/sandbox/sandboxX.sh
@@ -1,13 +1,17 @@ @@ -1,13 +1,17 @@
#!/bin/bash #!/bin/bash
context=`id -Z | secon -t -l -P` -context=`id -Z | secon -t -l -P`
export TITLE="Sandbox $context -- `grep ^#TITLE: ~/.sandboxrc | /usr/bin/cut -b8-80`" -export TITLE="Sandbox $context -- `grep ^#TITLE: ~/.sandboxrc | /usr/bin/cut -b8-80`"
-export SCREENSIZE="1000x700" -export SCREENSIZE="1000x700"
-#export SCREENSIZE=`xdpyinfo | awk '/dimensions/ { print $2 }'` -#export SCREENSIZE=`xdpyinfo | awk '/dimensions/ { print $2 }'`
+context=`id -Z | secon -t `
+export TITLE="`grep ^#TITLE: ~/.sandboxrc | /usr/bin/cut -b8-80` ($context)"
+[ $# -eq 1 ] && export SCREENSIZE="$1" || export SCREENSIZE="1000x700" +[ $# -eq 1 ] && export SCREENSIZE="$1" || export SCREENSIZE="1000x700"
trap "exit 0" HUP trap "exit 0" HUP
(/usr/bin/Xephyr -title "$TITLE" -terminate -screen $SCREENSIZE -displayfd 5 5>&1 2>/dev/null) | while read D; do -(/usr/bin/Xephyr -title "$TITLE" -terminate -screen $SCREENSIZE -displayfd 5 5>&1 2>/dev/null) | while read D; do
+(/usr/bin/Xephyr -nolisten tcp -title "$TITLE" -terminate -screen $SCREENSIZE -displayfd 5 5>&1 2>/dev/null) | while read D; do
export DISPLAY=:$D export DISPLAY=:$D
- python -c 'import gtk, os, commands; commands.getstatusoutput("%s/.sandboxrc" % os.environ["HOME"])' - python -c 'import gtk, os, commands; commands.getstatusoutput("%s/.sandboxrc" % os.environ["HOME"])'
+ cat > ~/seremote << __EOF + cat > ~/seremote << __EOF

View File

@ -7,7 +7,7 @@
Summary: SELinux policy core utilities Summary: SELinux policy core utilities
Name: policycoreutils Name: policycoreutils
Version: 2.0.86 Version: 2.0.86
Release: 5%{?dist} Release: 6%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Base Group: System Environment/Base
# Based on git repository with tag 20101221 # Based on git repository with tag 20101221
@ -331,6 +331,12 @@ fi
exit 0 exit 0
%changelog %changelog
* Fri Apr 22 2011 Dan Walsh <dwalsh@redhat.com> 2.0.86-6
- Apply patches from Christoph A.
* fix sandbox title
* stop xephyr from li
- Also ignore errors on sandbox include of directory missing files
* Thu Apr 21 2011 Dan Walsh <dwalsh@redhat.com> 2.0.86-5 * Thu Apr 21 2011 Dan Walsh <dwalsh@redhat.com> 2.0.86-5
- rebuild versus latest libsepol - rebuild versus latest libsepol