[PATCH 27/48] policycoreutils: sandbox: Allow user to specify the

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


   This patch looks good to me. acked.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7dHHIACgkQrlYvE4MpobNt2ACfdyyJYfeCqjJsyWeb0H1e1BJ4
3lQAn2wn6hpLjwVRbLGPeoL4xCfaYec7
=OgGK
-----END PGP SIGNATURE-----
>From fa5f4100442c95430d68d69f2a6cc5309ac75121 Mon Sep 17 00:00:00 2001
From: Dan Walsh <dwalsh@xxxxxxxxxx>
Date: Mon, 7 Nov 2011 15:52:37 -0500
Subject: [PATCH 27/48] policycoreutils: sandbox: Allow user to specify the
 DPI value for X in a sandbox

Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
---
 policycoreutils/sandbox/sandbox   |   14 ++++++++++++--
 policycoreutils/sandbox/sandbox.8 |    7 +++++--
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/policycoreutils/sandbox/sandbox b/policycoreutils/sandbox/sandbox
index 486cd4e..dd2e345 100644
--- a/policycoreutils/sandbox/sandbox
+++ b/policycoreutils/sandbox/sandbox
@@ -278,6 +278,10 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
                           action="callback", callback=self.__mount_callback, 
                           help=_("mount new home and/or tmp directory"))
 
+        parser.add_option("-d", "--dpi",
+                          dest="dpi", action="store",
+                          help=_("dots per inch for X display"))
+
         parser.add_option("-S", "--session", action="store_true",  dest="session", 
                           default=False,  help=_("run complete desktop session within sandbox"))
 
@@ -322,7 +326,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
 
         if self.__options.X_ind:
                self.setype = DEFAULT_X_TYPE
-               self.dpi=commands.getoutput("xrdb -query | grep dpi  | /bin/cut -f 2")
+
         if self.__options.setype:
                self.setype = self.__options.setype
 
@@ -401,6 +405,12 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
                          cmds +=  [ "-t", self.__tmpdir, "-h", self.__homedir ]
 
                          if self.__options.X_ind:
+                                if self.__options.dpi:
+                                       dpi = self.__options.dpi
+                                else:
+                                       import gtk
+                                       dpi = str(gtk.settings_get_default().props.gtk_xft_dpi/1024)
+
                                 xmodmapfile = self.__homedir + "/.xmodmap"
                                 xd = open(xmodmapfile,"w")
                                 subprocess.Popen(["/usr/bin/xmodmap","-pke"],stdout=xd).wait()
@@ -408,7 +418,7 @@ sandbox [-h] [-c] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile
 
                                 self.__setup_sandboxrc(self.__options.wm)
 
-                                cmds += [ "--", SANDBOXSH, self.__options.windowsize, self.dpi ]
+                                cmds += [ "--", SANDBOXSH, self.__options.windowsize, dpi ]
                          else:
                                 cmds += [ "--" ] + self.__paths
                          return subprocess.Popen(cmds).wait()
diff --git a/policycoreutils/sandbox/sandbox.8 b/policycoreutils/sandbox/sandbox.8
index 2b37e63..3f05c79 100644
--- a/policycoreutils/sandbox/sandbox.8
+++ b/policycoreutils/sandbox/sandbox.8
@@ -3,11 +3,11 @@
 sandbox \- Run cmd under an SELinux sandbox
 .SH SYNOPSIS
 .B sandbox
-[-C] [-c] [-l level ] [[-M | -X]  -H homedir -T tempdir ] [-I includefile ] [ -W windowmanager ] [ -w windowsize ] [[-i file ]...] [ -t type ] cmd
+[-C] [-c] [ -d DPI ] [-l level ] [[-M | -X]  -H homedir -T tempdir ] [-I includefile ] [ -W windowmanager ] [ -w windowsize ] [[-i file ]...] [ -t type ] cmd
 
 .br
 .B sandbox
-[-C] [-c] [-l level ] [[-M | -X]  -H homedir -T tempdir ] [-I includefile ] [ -W windowmanager ] [ -w windowsize ] [[-i file ]...] [ -t type ] -S
+[-C] [-c] [ -d DPI ] [-l level ] [[-M | -X]  -H homedir -T tempdir ] [-I includefile ] [ -W windowmanager ] [ -w windowsize ] [[-i file ]...] [ -t type ] -S
 .br
 .SH DESCRIPTION
 .PP
@@ -60,6 +60,9 @@ Default to /usr/bin/matchbox-window-manager.
 Create an X based Sandbox for gui apps, temporary files for
 $HOME and /tmp, secondary Xserver, defaults to sandbox_x_t
 .TP
+\fB\-d\fR
+Set the DPI value for the sanbox X Server. Defaults to the current X Sever DPI.
+.TP
 \fB\-c\fR
 Use control groups to control this copy of sandbox.  Specify parameters in /etc/sysconfig/sandbox.  Max memory usage and cpu usage are to be specified in percent.  You can specify which CPUs to use by numbering them 0,1,2... etc.
 .TP
-- 
1.7.7.4


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux