From 27a1dde02dc017a0e48ff2b5419bdc2a85895cbc Mon Sep 17 00:00:00 2001 From: Petr Lautrbach Date: Fri, 21 Aug 2015 17:19:30 +0200 Subject: [PATCH] policycoreutils-2.4-10 - Port sandbox to GTK 3 and fix issue with Xephyr --- policycoreutils-rhat.patch | 893 +++++++++++++++++++++++++++++++++---- policycoreutils.spec | 7 +- 2 files changed, 810 insertions(+), 90 deletions(-) diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index 4dee5aa..45618b9 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -392,7 +392,7 @@ index 9d9f820..0c2b390 100644 polgen.glade \ portsPage.py \ diff --git a/policycoreutils-2.4/gui/booleansPage.py b/policycoreutils-2.4/gui/booleansPage.py -index eee954d..0c4b14b 100644 +index eee954d..8e7e8e6 100644 --- a/policycoreutils-2.4/gui/booleansPage.py +++ b/policycoreutils-2.4/gui/booleansPage.py @@ -18,20 +18,17 @@ @@ -400,10 +400,13 @@ index eee954d..0c4b14b 100644 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. # -import string - import gtk - import gtk.glade +-import gtk +-import gtk.glade -import os - import gobject +-import gobject ++from gi.repository import Gtk ++import Gtk.glade ++from gi.repository import GObject import sys -import tempfile import seobject @@ -430,24 +433,73 @@ index eee954d..0c4b14b 100644 class Modifier: def __init__(self,name, on, save): -@@ -103,8 +98,6 @@ class booleansPage: +@@ -86,8 +81,8 @@ class booleansPage: + self.selinuxsupport = True + self.typechanged = False + self.doDebug = doDebug +- self.busy_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) +- self.ready_cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR) ++ self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) ++ self.ready_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) + + # Bring in widgets from glade file. + self.typeHBox = xml.get_widget("typeHBox") +@@ -103,33 +98,31 @@ class booleansPage: self.revertButton = xml.get_widget("booleanRevertButton") self.revertButton.set_sensitive(self.local) self.revertButton.connect("clicked", self.on_revert_clicked) - listStore = gtk.ListStore(gobject.TYPE_STRING) - cell = gtk.CellRendererText() - self.store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) - self.store.set_sort_column_id(1, gtk.SORT_ASCENDING) -@@ -123,7 +116,7 @@ class booleansPage: +- self.store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) +- self.store.set_sort_column_id(1, gtk.SORT_ASCENDING) ++ self.store = Gtk.ListStore(GObject.TYPE_BOOLEAN, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) ++ self.store.set_sort_column_id(1, Gtk.SortType.ASCENDING) + self.booleansView.set_model(self.store) + +- checkbox = gtk.CellRendererToggle() ++ checkbox = Gtk.CellRendererToggle() + checkbox.connect("toggled", self.boolean_toggled) +- col = gtk.TreeViewColumn('Active', checkbox, active = ACTIVE) ++ col = Gtk.TreeViewColumn('Active', checkbox, active = ACTIVE) + col.set_clickable(True) + col.set_sort_column_id(ACTIVE) self.booleansView.append_column(col) - col = gtk.TreeViewColumn("Description", gtk.CellRendererText(), text=DESC) +- col = gtk.TreeViewColumn("Module", gtk.CellRendererText(), text=MODULE) ++ col = Gtk.TreeViewColumn("Module", Gtk.CellRendererText(), text=MODULE) + col.set_sort_column_id(MODULE) + col.set_resizable(True) + self.booleansView.append_column(col) + +- col = gtk.TreeViewColumn("Description", gtk.CellRendererText(), text=DESC) - col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) -+ col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) ++ col = Gtk.TreeViewColumn("Description", Gtk.CellRendererText(), text=DESC) ++ col.set_sizing(Gtk.TreeViewColumnSizing.FIXED) col.set_fixed_width(400) col.set_sort_column_id(DESC) col.set_resizable(True) + self.booleansView.append_column(col) + +- col = gtk.TreeViewColumn("Name", gtk.CellRendererText(), text=BOOLEAN) ++ col = Gtk.TreeViewColumn("Name", Gtk.CellRendererText(), text=BOOLEAN) + col.set_sort_column_id(BOOLEAN) + col.set_resizable(True) + self.booleansView.set_search_equal_func(self.__search) +@@ -138,10 +131,10 @@ class booleansPage: + self.load(self.filter) + + def error(self, message): +- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, +- gtk.BUTTONS_CLOSE, ++ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, ++ Gtk.ButtonsType.CLOSE, + message) +- dlg.set_position(gtk.WIN_POS_MOUSE) ++ dlg.set_position(Gtk.WindowPosition.MOUSE) + dlg.show_all() + dlg.run() + dlg.destroy() @@ -170,16 +163,15 @@ class booleansPage: # change cursor if boolean == None: @@ -505,18 +557,25 @@ index eee954d..0c4b14b 100644 def on_local_clicked(self, button): diff --git a/policycoreutils-2.4/gui/domainsPage.py b/policycoreutils-2.4/gui/domainsPage.py -index 6af1e9a..39a4574 100644 +index 6af1e9a..ea937b4 100644 --- a/policycoreutils-2.4/gui/domainsPage.py +++ b/policycoreutils-2.4/gui/domainsPage.py -@@ -20,7 +20,7 @@ import string - import gtk - import gtk.glade +@@ -17,11 +17,11 @@ + + ## Author: Dan Walsh + import string +-import gtk +-import gtk.glade ++from gi.repository import Gtk ++import Gtk.glade import os -import commands +-import gobject +import subprocess - import gobject ++from gi.repository import GObject import sys import seobject + import selinux @@ -41,8 +41,8 @@ try: unicode=False, codeset = 'utf-8') @@ -528,6 +587,27 @@ index 6af1e9a..39a4574 100644 class domainsPage(semanagePage): def __init__(self, xml): +@@ -51,15 +51,15 @@ class domainsPage(semanagePage): + self.domain_filter.connect("focus_out_event", self.filter_changed) + self.domain_filter.connect("activate", self.filter_changed) + +- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) ++ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING) + self.view.set_model(self.store) +- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Domain Name"), gtk.CellRendererText(), text = 0) ++ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Domain Name"), Gtk.CellRendererText(), text = 0) + col.set_sort_column_id(0) + col.set_resizable(True) + self.view.append_column(col) +- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Mode"), gtk.CellRendererText(), text = 1) ++ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Mode"), Gtk.CellRendererText(), text = 1) + col.set_sort_column_id(1) + col.set_resizable(True) + self.view.append_column(col) @@ -115,18 +115,17 @@ class domainsPage(semanagePage): selection = self.view.get_selection() store, iter = selection.get_selected() @@ -584,15 +664,20 @@ index 6af1e9a..39a4574 100644 + self.error(e.output) + self.ready() diff --git a/policycoreutils-2.4/gui/fcontextPage.py b/policycoreutils-2.4/gui/fcontextPage.py -index 131f1c2..9a34143 100644 +index 131f1c2..27de5fb 100644 --- a/policycoreutils-2.4/gui/fcontextPage.py +++ b/policycoreutils-2.4/gui/fcontextPage.py -@@ -18,10 +18,9 @@ +@@ -16,12 +16,11 @@ + ## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + ## Author: Dan Walsh - import gtk - import gtk.glade +-import gtk +-import gtk.glade -import os - import gobject +-import gobject ++from gi.repository import Gtk ++import Gtk.glade ++from gi.repository import GObject import seobject -import commands +import subprocess @@ -610,28 +695,47 @@ index 131f1c2..9a34143 100644 class fcontextPage(semanagePage): -@@ -72,16 +71,16 @@ class fcontextPage(semanagePage): +@@ -66,47 +65,47 @@ class fcontextPage(semanagePage): + self.fcontextFilter.connect("focus_out_event", self.filter_changed) + self.fcontextFilter.connect("activate", self.filter_changed) + +- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) ++ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) + self.view = xml.get_widget("fcontextView") + self.view.set_model(self.store) self.view.set_search_equal_func(self.search) - col = gtk.TreeViewColumn(_("File\nSpecification"), gtk.CellRendererText(), text=SPEC_COL) +- col = gtk.TreeViewColumn(_("File\nSpecification"), gtk.CellRendererText(), text=SPEC_COL) - col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) - col.set_fixed_width(250) -+ col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) ++ col = Gtk.TreeViewColumn(_("File\nSpecification"), Gtk.CellRendererText(), text=SPEC_COL) ++ col.set_sizing(Gtk.TreeViewColumnSizing.FIXED) + col.set_fixed_width(250) col.set_sort_column_id(SPEC_COL) col.set_resizable(True) self.view.append_column(col) - col = gtk.TreeViewColumn(_("Selinux\nFile Type"), gtk.CellRendererText(), text=TYPE_COL) +- col = gtk.TreeViewColumn(_("Selinux\nFile Type"), gtk.CellRendererText(), text=TYPE_COL) ++ col = Gtk.TreeViewColumn(_("Selinux\nFile Type"), Gtk.CellRendererText(), text=TYPE_COL) - col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) - col.set_fixed_width(250) -+ col.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) ++ col.set_sizing(Gtk.TreeViewColumnSizing.FIXED) + col.set_fixed_width(250) col.set_sort_column_id(TYPE_COL) col.set_resizable(True) self.view.append_column(col) -@@ -97,16 +96,16 @@ class fcontextPage(semanagePage): +- col = gtk.TreeViewColumn(_("File\nType"), gtk.CellRendererText(), text=2) ++ col = Gtk.TreeViewColumn(_("File\nType"), Gtk.CellRendererText(), text=2) + col.set_sort_column_id(FTYPE_COL) + col.set_resizable(True) + self.view.append_column(col) + +- self.store.set_sort_column_id(SPEC_COL, gtk.SORT_ASCENDING) ++ self.store.set_sort_column_id(SPEC_COL, Gtk.SortType.ASCENDING) + self.load() + self.fcontextEntry = xml.get_widget("fcontextEntry") + self.fcontextFileTypeCombo = xml.get_widget("fcontextFileTypeCombo") liststore=self.fcontextFileTypeCombo.get_model() for k in seobject.file_types: if len(k) > 0 and k[0] != '-': @@ -858,7 +962,7 @@ index 68eed76..32de37a 100644 if type(result) in [TupleType, ListType]: for item in result: diff --git a/policycoreutils-2.4/gui/loginsPage.py b/policycoreutils-2.4/gui/loginsPage.py -index ec29fd9..8a1c0b7 100644 +index ec29fd9..54b6b34 100644 --- a/policycoreutils-2.4/gui/loginsPage.py +++ b/policycoreutils-2.4/gui/loginsPage.py @@ -16,13 +16,10 @@ @@ -866,17 +970,20 @@ index ec29fd9..8a1c0b7 100644 ## Author: Dan Walsh -import string - import gtk - import gtk.glade +-import gtk +-import gtk.glade -import os - import gobject +-import gobject -import sys -import commands ++from gi.repository import Gtk ++import Gtk.glade ++from gi.repository import GObject +import subprocess import seobject from semanagePage import *; -@@ -39,8 +36,8 @@ try: +@@ -39,24 +36,24 @@ try: unicode=False, codeset = 'utf-8') except IOError: @@ -887,7 +994,28 @@ index ec29fd9..8a1c0b7 100644 class loginsPage(semanagePage): def __init__(self, xml): -@@ -68,21 +65,21 @@ class loginsPage(semanagePage): + self.firstTime = False + semanagePage.__init__(self, xml, "logins", _("User Mapping")) +- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) ++ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) + self.view.set_model(self.store) +- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Login\nName"), gtk.CellRendererText(), text = 0) ++ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Login\nName"), Gtk.CellRendererText(), text = 0) + col.set_sort_column_id(0) + col.set_resizable(True) + self.view.append_column(col) +- col = gtk.TreeViewColumn(_("SELinux\nUser"), gtk.CellRendererText(), text = 1) ++ col = Gtk.TreeViewColumn(_("SELinux\nUser"), Gtk.CellRendererText(), text = 1) + col.set_resizable(True) + self.view.append_column(col) +- col = gtk.TreeViewColumn(_("MLS/\nMCS Range"), gtk.CellRendererText(), text = 2) ++ col = Gtk.TreeViewColumn(_("MLS/\nMCS Range"), Gtk.CellRendererText(), text = 2) + col.set_resizable(True) + self.view.append_column(col) + self.load() +@@ -68,55 +65,55 @@ class loginsPage(semanagePage): self.filter=filter self.login = seobject.loginRecords() dict = self.login.get_all(0) @@ -914,8 +1042,12 @@ index ec29fd9..8a1c0b7 100644 + if self.firstTime: return self.firstTime = True - liststore = gtk.ListStore(gobject.TYPE_STRING) -@@ -92,31 +89,31 @@ class loginsPage(semanagePage): +- liststore = gtk.ListStore(gobject.TYPE_STRING) ++ liststore = Gtk.ListStore(GObject.TYPE_STRING) + self.loginsSelinuxUserCombo.set_model(liststore) +- cell = gtk.CellRendererText() ++ cell = Gtk.CellRendererText() + self.loginsSelinuxUserCombo.pack_start(cell, True) self.loginsSelinuxUserCombo.add_attribute(cell, 'text', 0) selusers = seobject.seluserRecords().get_all(0) @@ -1062,18 +1194,25 @@ index ec29fd9..8a1c0b7 100644 - self.store.set_value(iter, 1, seuser) - self.store.set_value(iter, 2, seobject.translate(serange)) diff --git a/policycoreutils-2.4/gui/modulesPage.py b/policycoreutils-2.4/gui/modulesPage.py -index 9ff0766..a52863e 100644 +index 9ff0766..f3277f5 100644 --- a/policycoreutils-2.4/gui/modulesPage.py +++ b/policycoreutils-2.4/gui/modulesPage.py -@@ -20,7 +20,7 @@ import string - import gtk - import gtk.glade +@@ -17,11 +17,11 @@ + + ## Author: Dan Walsh + import string +-import gtk +-import gtk.glade ++from gi.repository import Gtk ++import Gtk.glade import os -import commands +-import gobject +import subprocess - import gobject ++from gi.repository import GObject import sys import seobject + import selinux @@ -41,8 +41,8 @@ try: unicode=False, codeset = 'utf-8') @@ -1085,6 +1224,27 @@ index 9ff0766..a52863e 100644 class modulesPage(semanagePage): def __init__(self, xml): +@@ -52,15 +52,15 @@ class modulesPage(semanagePage): + self.module_filter.connect("activate", self.filter_changed) + self.audit_enabled = False + +- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) ++ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING) + self.view.set_model(self.store) +- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Module Name"), gtk.CellRendererText(), text = 0) ++ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Module Name"), Gtk.CellRendererText(), text = 0) + col.set_sort_column_id(0) + col.set_resizable(True) + self.view.append_column(col) +- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Version"), gtk.CellRendererText(), text = 1) ++ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Version"), Gtk.CellRendererText(), text = 1) + self.enable_audit_button = xml.get_widget("enableAuditButton") + self.enable_audit_button.connect("clicked", self.enable_audit) + self.new_button = xml.get_widget("newModuleButton") @@ -85,8 +85,8 @@ class modulesPage(semanagePage): except: return 0 @@ -1112,7 +1272,7 @@ index 9ff0766..a52863e 100644 except: pass self.view.get_selection().select_path ((0,)) -@@ -107,53 +107,51 @@ class modulesPage(semanagePage): +@@ -107,85 +107,82 @@ class modulesPage(semanagePage): def new_module(self, args): try: Popen(["/usr/share/system-config-selinux/polgengui.py"]) @@ -1200,22 +1360,34 @@ index 9ff0766..a52863e 100644 def propertiesDialog(self): # Do nothing -@@ -167,10 +165,10 @@ class modulesPage(semanagePage): - gtk.STOCK_OPEN, gtk.RESPONSE_OK)) - dialog.set_default_response(gtk.RESPONSE_OK) + return + + def addDialog(self): +- dialog = gtk.FileChooserDialog(_("Load Policy Module"), ++ dialog = Gtk.FileChooserDialog(_("Load Policy Module"), + None, +- gtk.FILE_CHOOSER_ACTION_OPEN, +- (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, +- gtk.STOCK_OPEN, gtk.RESPONSE_OK)) +- dialog.set_default_response(gtk.RESPONSE_OK) ++ Gtk.FileChooserAction.OPEN, ++ (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, ++ Gtk.STOCK_OPEN, Gtk.ResponseType.OK)) ++ dialog.set_default_response(Gtk.ResponseType.OK) - filter = gtk.FileFilter() - filter.set_name("Policy Files") - filter.add_pattern("*.pp") - dialog.add_filter(filter) -+ filt = gtk.FileFilter() ++ filt = Gtk.FileFilter() + filt.set_name("Policy Files") + filt.add_pattern("*.pp") + dialog.add_filter(filt) response = dialog.run() - if response == gtk.RESPONSE_OK: -@@ -178,14 +176,13 @@ class modulesPage(semanagePage): +- if response == gtk.RESPONSE_OK: ++ if response == Gtk.ResponseType.OK: + self.add(dialog.get_filename()) dialog.destroy() def add(self, file): @@ -1334,10 +1506,21 @@ index 37c1472..9854fb2 100644 False diff --git a/policycoreutils-2.4/gui/polgengui.py b/policycoreutils-2.4/gui/polgengui.py -index 0f0e564..1b88c47 100644 +index 0f0e564..e3c5594 100644 --- a/policycoreutils-2.4/gui/polgengui.py +++ b/policycoreutils-2.4/gui/polgengui.py -@@ -30,29 +30,15 @@ import gnome +@@ -22,37 +22,23 @@ + # + import signal + import string +-import gtk +-import gtk.glade ++from gi.repository import Gtk ++import Gtk.glade + import os +-import gobject ++from gi.repository import GObject + import gnome import sys try: from sepolicy import generate @@ -1381,6 +1564,18 @@ index 0f0e564..1b88c47 100644 gnome.program_init("SELinux Policy Generation Tool", "5") +@@ -85,9 +71,9 @@ def foreach(model, path, iter, selected): + ## Pull in the Glade file + ## + if os.access("polgen.glade", os.F_OK): +- xml = gtk.glade.XML ("polgen.glade", domain=PROGNAME) ++ xml = Gtk.glade.XML ("polgen.glade", domain=PROGNAME) + else: +- xml = gtk.glade.XML ("/usr/share/system-config-selinux/polgen.glade", domain=PROGNAME) ++ xml = Gtk.glade.XML ("/usr/share/system-config-selinux/polgen.glade", domain=PROGNAME) + + FILE = 1 + DIR = 2 @@ -191,10 +177,10 @@ class childWindow: try: @@ -1394,7 +1589,7 @@ index 0f0e564..1b88c47 100644 self.all_types = [] self.all_modules = [] self.all_roles = [] -@@ -262,7 +248,7 @@ class childWindow: +@@ -262,31 +248,31 @@ class childWindow: self.out_udp_entry = self.xml.get_widget("out_udp_entry") self.network_buttons[self.out_udp_all_checkbutton] = [ self.out_udp_entry ] @@ -1403,6 +1598,85 @@ index 0f0e564..1b88c47 100644 b.connect("clicked",self.network_all_clicked) self.boolean_treeview = self.xml.get_widget("boolean_treeview") +- self.boolean_store = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING) ++ self.boolean_store = Gtk.ListStore(GObject.TYPE_STRING,GObject.TYPE_STRING) + self.boolean_treeview.set_model(self.boolean_store) +- self.boolean_store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Name"), gtk.CellRendererText(), text = 0) ++ self.boolean_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Name"), Gtk.CellRendererText(), text = 0) + self.boolean_treeview.append_column(col) +- col = gtk.TreeViewColumn(_("Description"), gtk.CellRendererText(), text = 1) ++ col = Gtk.TreeViewColumn(_("Description"), Gtk.CellRendererText(), text = 1) + self.boolean_treeview.append_column(col) + + self.role_treeview = self.xml.get_widget("role_treeview") +- self.role_store = gtk.ListStore(gobject.TYPE_STRING) ++ self.role_store = Gtk.ListStore(GObject.TYPE_STRING) + self.role_treeview.set_model(self.role_store) +- self.role_treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) +- self.role_store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Role"), gtk.CellRendererText(), text = 0) ++ self.role_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) ++ self.role_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Role"), Gtk.CellRendererText(), text = 0) + self.role_treeview.append_column(col) + + self.existing_user_treeview = self.xml.get_widget("existing_user_treeview") +- self.existing_user_store = gtk.ListStore(gobject.TYPE_STRING) ++ self.existing_user_store = Gtk.ListStore(GObject.TYPE_STRING) + self.existing_user_treeview.set_model(self.existing_user_store) +- self.existing_user_store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Existing_User"), gtk.CellRendererText(), text = 0) ++ self.existing_user_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Existing_User"), Gtk.CellRendererText(), text = 0) + self.existing_user_treeview.append_column(col) + + for i in self.all_roles: +@@ -296,19 +282,19 @@ class childWindow: + self.in_tcp_reserved_checkbutton = xml.get_widget ("in_tcp_reserved_checkbutton") + + self.transition_treeview = self.xml.get_widget("transition_treeview") +- self.transition_store = gtk.ListStore(gobject.TYPE_STRING) ++ self.transition_store = Gtk.ListStore(GObject.TYPE_STRING) + self.transition_treeview.set_model(self.transition_store) +- self.transition_treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) +- self.transition_store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Application"), gtk.CellRendererText(), text = 0) ++ self.transition_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) ++ self.transition_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Application"), Gtk.CellRendererText(), text = 0) + self.transition_treeview.append_column(col) + + self.user_transition_treeview = self.xml.get_widget("user_transition_treeview") +- self.user_transition_store = gtk.ListStore(gobject.TYPE_STRING) ++ self.user_transition_store = Gtk.ListStore(GObject.TYPE_STRING) + self.user_transition_treeview.set_model(self.user_transition_store) +- self.user_transition_treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) +- self.user_transition_store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Application"), gtk.CellRendererText(), text = 0) ++ self.user_transition_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) ++ self.user_transition_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Application"), Gtk.CellRendererText(), text = 0) + self.user_transition_treeview.append_column(col) + + for i in self.all_users: +@@ -318,11 +304,11 @@ class childWindow: + self.existing_user_store.set_value(iter, 0, i[:-2]) + + self.admin_treeview = self.xml.get_widget("admin_treeview") +- self.admin_store = gtk.ListStore(gobject.TYPE_STRING) ++ self.admin_store = Gtk.ListStore(GObject.TYPE_STRING) + self.admin_treeview.set_model(self.admin_store) +- self.admin_treeview.get_selection().set_mode(gtk.SELECTION_MULTIPLE) +- self.admin_store.set_sort_column_id(0, gtk.SORT_ASCENDING) +- col = gtk.TreeViewColumn(_("Application"), gtk.CellRendererText(), text = 0) ++ self.admin_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE) ++ self.admin_store.set_sort_column_id(0, Gtk.SortType.ASCENDING) ++ col = Gtk.TreeViewColumn(_("Application"), Gtk.CellRendererText(), text = 0) + self.admin_treeview.append_column(col) + + try: @@ -333,7 +319,7 @@ class childWindow: for a in sepolicy.interface.get_admin(): iter = self.admin_store.append() @@ -1412,6 +1686,67 @@ index 0f0e564..1b88c47 100644 self.error(e.message) def confine_application(self): +@@ -372,17 +358,17 @@ class childWindow: + + if self.pages[type][self.current_page] == self.FINISH_PAGE: + self.generate_policy() +- self.xml.get_widget ("cancel_button").set_label(gtk.STOCK_CLOSE) ++ self.xml.get_widget ("cancel_button").set_label(Gtk.STOCK_CLOSE) + else: + self.current_page = self.current_page + 1 + self.notebook.set_current_page(self.pages[type][self.current_page]) + if self.pages[type][self.current_page] == self.FINISH_PAGE: +- self.forward_button.set_label(gtk.STOCK_APPLY) ++ self.forward_button.set_label(Gtk.STOCK_APPLY) + + def back(self,arg): + type = self.get_type() + if self.pages[type][self.current_page] == self.FINISH_PAGE: +- self.forward_button.set_label(gtk.STOCK_GO_FORWARD) ++ self.forward_button.set_label(Gtk.STOCK_GO_FORWARD) + + self.current_page = self.current_page - 1 + self.notebook.set_current_page(self.pages[type][self.current_page]) +@@ -395,30 +381,30 @@ class childWindow: + b.set_sensitive(not active) + + def verify(self, message, title="" ): +- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, +- gtk.BUTTONS_YES_NO, ++ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, ++ Gtk.ButtonsType.YES_NO, + message) + dlg.set_title(title) +- dlg.set_position(gtk.WIN_POS_MOUSE) ++ dlg.set_position(Gtk.WindowPosition.MOUSE) + dlg.show_all() + rc = dlg.run() + dlg.destroy() + return rc + + def info(self, message): +- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, +- gtk.BUTTONS_OK, ++ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, ++ Gtk.ButtonsType.OK, + message) +- dlg.set_position(gtk.WIN_POS_MOUSE) ++ dlg.set_position(Gtk.WindowPosition.MOUSE) + dlg.show_all() + dlg.run() + dlg.destroy() + + def error(self, message): +- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, +- gtk.BUTTONS_CLOSE, ++ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, ++ Gtk.ButtonsType.CLOSE, + message) +- dlg.set_position(gtk.WIN_POS_MOUSE) ++ dlg.set_position(Gtk.WindowPosition.MOUSE) + dlg.show_all() + dlg.run() + dlg.destroy() @@ -519,7 +505,7 @@ class childWindow: self.info(my_policy.generate(outputdir)) @@ -1421,6 +1756,116 @@ index 0f0e564..1b88c47 100644 self.error(e.message) def delete(self, args): +@@ -539,7 +525,7 @@ class childWindow: + self.boolean_description_entry.set_text("") + rc = self.boolean_dialog.run() + self.boolean_dialog.hide() +- if rc == gtk.RESPONSE_CANCEL: ++ if rc == Gtk.ResponseType.CANCEL: + return + iter = self.boolean_store.append() + self.boolean_store.set_value(iter, 0, self.boolean_name_entry.get_text()) +@@ -548,7 +534,7 @@ class childWindow: + def __add(self,type): + rc = self.file_dialog.run() + self.file_dialog.hide() +- if rc == gtk.RESPONSE_CANCEL: ++ if rc == Gtk.ResponseType.CANCEL: + return + for i in self.file_dialog.get_filenames(): + iter = self.store.append() +@@ -558,29 +544,29 @@ class childWindow: + def exec_select(self, args): + self.file_dialog.set_select_multiple(0) + self.file_dialog.set_title(_("Select executable file to be confined.")) +- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) ++ self.file_dialog.set_action(Gtk.FileChooserAction.OPEN) + self.file_dialog.set_current_folder("/usr/sbin") + rc = self.file_dialog.run() + self.file_dialog.hide() +- if rc == gtk.RESPONSE_CANCEL: ++ if rc == Gtk.ResponseType.CANCEL: + return + self.exec_entry.set_text(self.file_dialog.get_filename()) + + def init_script_select(self, args): + self.file_dialog.set_select_multiple(0) + self.file_dialog.set_title(_("Select init script file to be confined.")) +- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) ++ self.file_dialog.set_action(Gtk.FileChooserAction.OPEN) + self.file_dialog.set_current_folder("/etc/rc.d/init.d") + rc = self.file_dialog.run() + self.file_dialog.hide() +- if rc == gtk.RESPONSE_CANCEL: ++ if rc == Gtk.ResponseType.CANCEL: + return + self.init_script_entry.set_text(self.file_dialog.get_filename()) + + def add(self, args): + self.file_dialog.set_title(_("Select file(s) that confined application creates or writes")) + self.file_dialog.set_current_folder("/") +- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) ++ self.file_dialog.set_action(Gtk.FileChooserAction.OPEN) + self.file_dialog.set_select_multiple(1) + self.__add(FILE) + +@@ -588,7 +574,7 @@ class childWindow: + self.file_dialog.set_title(_("Select directory(s) that the confined application owns and writes into")) + self.file_dialog.set_current_folder("/") + self.file_dialog.set_select_multiple(1) +- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) ++ self.file_dialog.set_action(Gtk.FileChooserAction.SELECT_FOLDER) + self.__add(DIR) + + def on_about_clicked(self, args): +@@ -597,7 +583,7 @@ class childWindow: + dlg.hide () + + def quit(self, args): +- gtk.main_quit() ++ Gtk.main_quit() + + def setupScreen(self): + # Bring in widgets from glade file. +@@ -639,20 +625,20 @@ class childWindow: + self.view = self.xml.get_widget("write_treeview") + self.file_dialog = self.xml.get_widget("filechooserdialog") + +- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) ++ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_INT) + self.view.set_model(self.store) +- col = gtk.TreeViewColumn("", gtk.CellRendererText(), text = 0) ++ col = Gtk.TreeViewColumn("", Gtk.CellRendererText(), text = 0) + col.set_resizable(True) + self.view.append_column(col) + self.view.get_selection().select_path ((0,)) + + def output_button_clicked(self, *args): + self.file_dialog.set_title(_("Select directory to generate policy files in")) +- self.file_dialog.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER) ++ self.file_dialog.set_action(Gtk.FileChooserAction.SELECT_FOLDER) + self.file_dialog.set_select_multiple(0) + rc = self.file_dialog.run() + self.file_dialog.hide() +- if rc == gtk.RESPONSE_CANCEL: ++ if rc == Gtk.ResponseType.CANCEL: + return + self.output_entry.set_text(self.file_dialog.get_filename()) + +@@ -664,11 +650,11 @@ class childWindow: + name = entry.get_text() + if self.name != name: + if name in self.all_types: +- if self.verify(_("Type %s_t already defined in current policy.\nDo you want to continue?") % name, _("Verify Name")) == gtk.RESPONSE_NO: ++ if self.verify(_("Type %s_t already defined in current policy.\nDo you want to continue?") % name, _("Verify Name")) == Gtk.ResponseType.NO: + entry.set_text("") + return False + if name in self.all_modules: +- if self.verify(_("Module %s.pp already loaded in current policy.\nDo you want to continue?") % name, _("Verify Name")) == gtk.RESPONSE_NO: ++ if self.verify(_("Module %s.pp already loaded in current policy.\nDo you want to continue?") % name, _("Verify Name")) == Gtk.ResponseType.NO: + entry.set_text("") + return False + @@ -687,7 +673,7 @@ class childWindow: try: generate.verify_ports(self.in_tcp_entry.get_text()) @@ -1454,8 +1899,17 @@ index 0f0e564..1b88c47 100644 iter = self.store.append() self.store.set_value(iter, 0, f) self.store.set_value(iter, 1, DIR) +@@ -759,7 +745,7 @@ class childWindow: + self.mainWindow.connect("destroy", self.quit) + + self.mainWindow.show_all() +- gtk.main() ++ Gtk.main() + + if __name__ == "__main__": + signal.signal (signal.SIGINT, signal.SIG_DFL) diff --git a/policycoreutils-2.4/gui/portsPage.py b/policycoreutils-2.4/gui/portsPage.py -index bfb4e36..e6c87c5 100644 +index bfb4e36..c2a6e38 100644 --- a/policycoreutils-2.4/gui/portsPage.py +++ b/policycoreutils-2.4/gui/portsPage.py @@ -16,14 +16,11 @@ @@ -1463,11 +1917,14 @@ index bfb4e36..e6c87c5 100644 ## Author: Dan Walsh -import string - import gtk - import gtk.glade +-import gtk +-import gtk.glade -import os - import gobject +-import gobject -import sys ++from gi.repository import Gtk ++import Gtk.glade ++from gi.repository import GObject import seobject -import commands +import subprocess @@ -1485,7 +1942,7 @@ index bfb4e36..e6c87c5 100644 class portsPage(semanagePage): def __init__(self, xml): -@@ -62,19 +59,19 @@ class portsPage(semanagePage): +@@ -62,43 +59,43 @@ class portsPage(semanagePage): self.ports_properties_button = xml.get_widget("portsPropertiesButton") self.ports_delete_button = xml.get_widget("portsDeleteButton") liststore = self.ports_protocol_combo.get_model() @@ -1510,7 +1967,38 @@ index bfb4e36..e6c87c5 100644 + self.group_load(filt) def init_store(self): - self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING , gobject.TYPE_STRING) +- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING , gobject.TYPE_STRING) ++ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING , GObject.TYPE_STRING) + self.view.set_model(self.store) +- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) ++ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) + + self.view.set_search_equal_func(self.search) +- col = gtk.TreeViewColumn(_("SELinux Port\nType"), gtk.CellRendererText(), text = TYPE_COL) ++ col = Gtk.TreeViewColumn(_("SELinux Port\nType"), Gtk.CellRendererText(), text = TYPE_COL) + col.set_sort_column_id(TYPE_COL) + col.set_resizable(True) + self.view.append_column(col) +- self.store.set_sort_column_id(TYPE_COL, gtk.SORT_ASCENDING) ++ self.store.set_sort_column_id(TYPE_COL, Gtk.SortType.ASCENDING) + +- col = gtk.TreeViewColumn(_("Protocol"), gtk.CellRendererText(), text = PROTOCOL_COL) ++ col = Gtk.TreeViewColumn(_("Protocol"), Gtk.CellRendererText(), text = PROTOCOL_COL) + col.set_sort_column_id(PROTOCOL_COL) + col.set_resizable(True) + self.view.append_column(col) + +- self.mls_col = gtk.TreeViewColumn(_("MLS/MCS\nLevel"), gtk.CellRendererText(), text = MLS_COL) ++ self.mls_col = Gtk.TreeViewColumn(_("MLS/MCS\nLevel"), Gtk.CellRendererText(), text = MLS_COL) + self.mls_col.set_resizable(True) + self.mls_col.set_sort_column_id(MLS_COL) + self.view.append_column(self.mls_col) + +- col = gtk.TreeViewColumn(_("Port"), gtk.CellRendererText(), text = PORT_COL) ++ col = Gtk.TreeViewColumn(_("Port"), Gtk.CellRendererText(), text = PORT_COL) + col.set_sort_column_id(PORT_COL) + col.set_resizable(True) + self.view.append_column(col) @@ -116,43 +113,43 @@ class portsPage(semanagePage): except: return 0 @@ -1711,10 +2199,24 @@ index bfb4e36..e6c87c5 100644 def on_group_clicked(self, button): self.ports_add_button.set_sensitive(self.group) diff --git a/policycoreutils-2.4/gui/semanagePage.py b/policycoreutils-2.4/gui/semanagePage.py -index 3a0e478..040a4f8 100644 +index 3a0e478..9a5a4d2 100644 --- a/policycoreutils-2.4/gui/semanagePage.py +++ b/policycoreutils-2.4/gui/semanagePage.py -@@ -37,8 +37,8 @@ try: +@@ -17,10 +17,10 @@ + + ## Author: Dan Walsh + import string +-import gtk +-import gtk.glade ++from gi.repository import Gtk ++import Gtk.glade + import os +-import gobject ++from gi.repository import GObject + import sys + import seobject + +@@ -37,19 +37,19 @@ try: unicode=False, codeset = 'utf-8') except IOError: @@ -1724,7 +2226,22 @@ index 3a0e478..040a4f8 100644 + builtins.__dict__['_'] = str def idle_func(): - while gtk.events_pending(): +- while gtk.events_pending(): +- gtk.main_iteration() ++ while Gtk.events_pending(): ++ Gtk.main_iteration() + + class semanagePage: + def __init__(self, xml, name, description): + self.xml = xml + self.window = self.xml.get_widget("mainWindow").get_root_window() +- self.busy_cursor = gtk.gdk.Cursor(gtk.gdk.WATCH) +- self.ready_cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR) ++ self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) ++ self.ready_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) + + self.local = False + self.view = xml.get_widget("%sView" % name) @@ -77,9 +77,9 @@ class semanagePage: return @@ -1738,14 +2255,40 @@ index 3a0e478..040a4f8 100644 def search(self, model, col, key, i): sort_col = self.store.get_sort_column_id()[0] -@@ -122,13 +122,37 @@ class semanagePage: +@@ -102,57 +102,81 @@ class semanagePage: + self.propertiesDialog() + + def verify(self, message, title="" ): +- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, +- gtk.BUTTONS_YES_NO, ++ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, ++ Gtk.ButtonsType.YES_NO, + message) + dlg.set_title(title) +- dlg.set_position(gtk.WIN_POS_MOUSE) ++ dlg.set_position(Gtk.WindowPosition.MOUSE) + dlg.show_all() + rc = dlg.run() + dlg.destroy() + return rc + + def error(self, message): +- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, +- gtk.BUTTONS_CLOSE, ++ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, ++ Gtk.ButtonsType.CLOSE, + message) +- dlg.set_position(gtk.WIN_POS_MOUSE) ++ dlg.set_position(Gtk.WindowPosition.MOUSE) + dlg.show_all() + dlg.run() dlg.destroy() def deleteDialog(self): - store, iter = self.view.get_selection().get_selected() - if self.verify(_("Are you sure you want to delete %s '%s'?" % (self.description, store.get_value(iter, 0))), _("Delete %s" % self.description)) == gtk.RESPONSE_YES: + store, it = self.view.get_selection().get_selected() -+ if self.verify(_("Are you sure you want to delete %s '%s'?" % (self.description, store.get_value(it, 0))), _("Delete %s" % self.description)) == gtk.RESPONSE_YES: ++ if self.verify(_("Are you sure you want to delete %s '%s'?" % (self.description, store.get_value(it, 0))), _("Delete %s" % self.description)) == Gtk.ResponseType.YES: self.delete() def use_menus(self): @@ -1778,9 +2321,11 @@ index 3a0e478..040a4f8 100644 def addDialog(self): self.dialogClear() self.dialog.set_title(_("Add %s" % self.description)) -@@ -136,10 +160,10 @@ class semanagePage: +- self.dialog.set_position(gtk.WIN_POS_MOUSE) ++ self.dialog.set_position(Gtk.WindowPosition.MOUSE) - while self.dialog.run() == gtk.RESPONSE_OK: +- while self.dialog.run() == gtk.RESPONSE_OK: ++ while self.dialog.run() == Gtk.ResponseType.OK: try: - if self.add() == False: + if not self.add(): @@ -1791,9 +2336,13 @@ index 3a0e478..040a4f8 100644 self.error(e.args[0]) self.dialog.hide() -@@ -149,10 +173,10 @@ class semanagePage: - self.dialog.set_position(gtk.WIN_POS_MOUSE) - while self.dialog.run() == gtk.RESPONSE_OK: + def propertiesDialog(self): + self.dialogInit() + self.dialog.set_title(_("Modify %s" % self.description)) +- self.dialog.set_position(gtk.WIN_POS_MOUSE) +- while self.dialog.run() == gtk.RESPONSE_OK: ++ self.dialog.set_position(Gtk.WindowPosition.MOUSE) ++ while self.dialog.run() == Gtk.ResponseType.OK: try: - if self.modify() == False: + if not self.modify(): @@ -1805,7 +2354,7 @@ index 3a0e478..040a4f8 100644 self.dialog.hide() diff --git a/policycoreutils-2.4/gui/statusPage.py b/policycoreutils-2.4/gui/statusPage.py -index 02685f2..6510d2a 100644 +index 02685f2..0bdc5bf 100644 --- a/policycoreutils-2.4/gui/statusPage.py +++ b/policycoreutils-2.4/gui/statusPage.py @@ -16,18 +16,14 @@ @@ -1813,8 +2362,10 @@ index 02685f2..6510d2a 100644 ## Author: Dan Walsh -import string - import gtk - import gtk.glade +-import gtk +-import gtk.glade ++from gi.repository import Gtk ++import Gtk.glade import os -import gobject import sys @@ -1838,7 +2389,20 @@ index 02685f2..6510d2a 100644 class statusPage: def __init__(self, xml): -@@ -127,21 +123,21 @@ class statusPage: +@@ -117,48 +113,48 @@ class statusPage: + os.unlink(RELABELFILE) + + def verify(self, message): +- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, +- gtk.BUTTONS_YES_NO, ++ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, ++ Gtk.ButtonsType.YES_NO, + message) +- dlg.set_position(gtk.WIN_POS_MOUSE) ++ dlg.set_position(Gtk.WindowPosition.MOUSE) + dlg.show_all() + rc = dlg.run() + dlg.destroy() return rc def typemenu_changed(self, menu): @@ -1846,8 +2410,9 @@ index 02685f2..6510d2a 100644 + setype = self.get_type() enabled = self.enabledOptionMenu.get_active() - if self.initialtype != type: +- if self.verify(_("Changing the policy type will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == gtk.RESPONSE_NO: + if self.initialtype != setype: - if self.verify(_("Changing the policy type will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == gtk.RESPONSE_NO: ++ if self.verify(_("Changing the policy type will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == Gtk.ResponseType.NO: menu.set_active(self.typeHistory) return None @@ -1863,8 +2428,15 @@ index 02685f2..6510d2a 100644 + setype = self.get_type() if self.initEnabled != DISABLED and enabled == DISABLED: - if self.verify(_("Changing to SELinux disabled requires a reboot. It is not recommended. If you later decide to turn SELinux back on, the system will be required to relabel. If you just want to see if SELinux is causing a problem on your system, you can go to permissive mode which will only log errors and not enforce SELinux policy. Permissive mode does not require a reboot Do you wish to continue?")) == gtk.RESPONSE_NO: -@@ -154,11 +150,11 @@ class statusPage: +- if self.verify(_("Changing to SELinux disabled requires a reboot. It is not recommended. If you later decide to turn SELinux back on, the system will be required to relabel. If you just want to see if SELinux is causing a problem on your system, you can go to permissive mode which will only log errors and not enforce SELinux policy. Permissive mode does not require a reboot Do you wish to continue?")) == gtk.RESPONSE_NO: ++ if self.verify(_("Changing to SELinux disabled requires a reboot. It is not recommended. If you later decide to turn SELinux back on, the system will be required to relabel. If you just want to see if SELinux is causing a problem on your system, you can go to permissive mode which will only log errors and not enforce SELinux policy. Permissive mode does not require a reboot Do you wish to continue?")) == Gtk.ResponseType.NO: + combo.set_active(self.enabled) + return None + + if self.initEnabled == DISABLED and enabled < 2: +- if self.verify(_("Changing to SELinux enabled will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == gtk.RESPONSE_NO: ++ if self.verify(_("Changing to SELinux enabled will cause a relabel of the entire file system on the next boot. Relabeling takes a long time depending on the size of the file system. Do you wish to continue?")) == Gtk.ResponseType.NO: + combo.set_active(self.enabled) return None self.relabel_checkbutton.set_active(True) @@ -1889,22 +2461,31 @@ index 02685f2..6510d2a 100644 fd.write(l) fd.close() diff --git a/policycoreutils-2.4/gui/system-config-selinux.py b/policycoreutils-2.4/gui/system-config-selinux.py -index bc3027e..9482fa5 100644 +index bc3027e..b4bfe5c 100644 --- a/policycoreutils-2.4/gui/system-config-selinux.py +++ b/policycoreutils-2.4/gui/system-config-selinux.py -@@ -25,9 +25,9 @@ import string +@@ -24,15 +24,15 @@ import signal + import string import sys try: - import gtk +- import gtk -except RuntimeError, e: - print "system-config-selinux:", e - print "This is a graphical application and requires DISPLAY to be set." ++ from gi.repository import Gtk +except RuntimeError as e: + print("system-config-selinux:", e) + print("This is a graphical application and requires DISPLAY to be set.") sys.exit (1) - import gtk.glade +-import gtk.glade ++import Gtk.glade + import os +-import gobject ++from gi.repository import GObject + import gnome + import statusPage + import booleansPage @@ -57,8 +57,8 @@ try: unicode=False, codeset = 'utf-8') @@ -1916,6 +2497,18 @@ index bc3027e..9482fa5 100644 gnome.program_init("SELinux Management Tool", "5") +@@ -72,9 +72,9 @@ sys.path.append('/usr/share/system-config-selinux') + ## Pull in the Glade file + ## + if os.access("system-config-selinux.glade", os.F_OK): +- xml = gtk.glade.XML ("system-config-selinux.glade", domain=PROGNAME) ++ xml = Gtk.glade.XML ("system-config-selinux.glade", domain=PROGNAME) + else: +- xml = gtk.glade.XML ("/usr/share/system-config-selinux/system-config-selinux.glade", domain=PROGNAME) ++ xml = Gtk.glade.XML ("/usr/share/system-config-selinux/system-config-selinux.glade", domain=PROGNAME) + + class childWindow: + def __init__(self): @@ -95,7 +95,7 @@ class childWindow: self.add_page(portsPage.portsPage(xml)) self.add_page(modulesPage.modulesPage(xml)) # modules @@ -1925,8 +2518,52 @@ index bc3027e..9482fa5 100644 self.error(e.message) xml.signal_connect("on_quit_activate", self.destroy) +@@ -108,10 +108,10 @@ class childWindow: + self.delete_menu = xml.get_widget("delete_menu_item") + + def error(self, message): +- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_ERROR, +- gtk.BUTTONS_CLOSE, ++ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.ERROR, ++ Gtk.ButtonsType.CLOSE, + message) +- dlg.set_position(gtk.WIN_POS_MOUSE) ++ dlg.set_position(Gtk.WindowPosition.MOUSE) + dlg.show_all() + dlg.run() + dlg.destroy() +@@ -142,7 +142,7 @@ class childWindow: + dlg.hide () + + def destroy(self, args): +- gtk.main_quit() ++ Gtk.main_quit() + + def use_menus(self, use_menus): + self.add_menu.set_sensitive(use_menus) +@@ -165,9 +165,9 @@ class childWindow: + self.notebook = self.xml.get_widget("notebook") + self.view = self.xml.get_widget("selectView") + self.view.get_selection().connect("changed", self.itemSelected) +- self.store = gtk.ListStore(gobject.TYPE_STRING) ++ self.store = Gtk.ListStore(GObject.TYPE_STRING) + self.view.set_model(self.store) +- col = gtk.TreeViewColumn("", gtk.CellRendererText(), text = 0) ++ col = Gtk.TreeViewColumn("", Gtk.CellRendererText(), text = 0) + col.set_resizable(True) + self.view.append_column(col) + +@@ -184,7 +184,7 @@ class childWindow: + self.mainWindow.connect("destroy", self.destroy) + + self.mainWindow.show_all() +- gtk.main() ++ Gtk.main() + + if __name__ == "__main__": + signal.signal (signal.SIGINT, signal.SIG_DFL) diff --git a/policycoreutils-2.4/gui/usersPage.py b/policycoreutils-2.4/gui/usersPage.py -index 93804ac..1451903 100644 +index 93804ac..697d5b1 100644 --- a/policycoreutils-2.4/gui/usersPage.py +++ b/policycoreutils-2.4/gui/usersPage.py @@ -16,13 +16,10 @@ @@ -1934,17 +2571,20 @@ index 93804ac..1451903 100644 ## Author: Dan Walsh -import string - import gtk - import gtk.glade +-import gtk +-import gtk.glade -import os - import gobject +-import gobject -import sys -import commands ++from gi.repository import Gtk ++import Gtk.glade ++from gi.repository import GObject +import subprocess import seobject from semanagePage import *; -@@ -36,8 +33,8 @@ gettext.textdomain(PROGNAME) +@@ -36,27 +33,27 @@ gettext.textdomain(PROGNAME) try: gettext.install(PROGNAME, localedir="/usr/share/locale", unicode=1) except IOError: @@ -1955,6 +2595,30 @@ index 93804ac..1451903 100644 class usersPage(semanagePage): def __init__(self, xml): + semanagePage.__init__(self, xml, "users", _("SELinux User")) + +- self.store = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) ++ self.store = Gtk.ListStore(GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING, GObject.TYPE_STRING) + self.view.set_model(self.store) +- self.store.set_sort_column_id(0, gtk.SORT_ASCENDING) ++ self.store.set_sort_column_id(0, Gtk.SortType.ASCENDING) + +- col = gtk.TreeViewColumn(_("SELinux\nUser"), gtk.CellRendererText(), text = 0) ++ col = Gtk.TreeViewColumn(_("SELinux\nUser"), Gtk.CellRendererText(), text = 0) + col.set_sort_column_id(0) + col.set_resizable(True) + self.view.append_column(col) + +- col = gtk.TreeViewColumn(_("MLS/\nMCS Range"), gtk.CellRendererText(), text = 1) ++ col = Gtk.TreeViewColumn(_("MLS/\nMCS Range"), Gtk.CellRendererText(), text = 1) + col.set_resizable(True) + self.view.append_column(col) + +- col = gtk.TreeViewColumn(_("SELinux Roles"), gtk.CellRendererText(), text = 2) ++ col = Gtk.TreeViewColumn(_("SELinux Roles"), Gtk.CellRendererText(), text = 2) + col.set_resizable(True) + self.view.append_column(col) + @@ -65,34 +62,30 @@ class usersPage(semanagePage): self.mlsRangeEntry = xml.get_widget("mlsRangeEntry") self.selinuxRolesEntry = xml.get_widget("selinuxRolesEntry") @@ -654800,7 +655464,7 @@ index b306041..16eb50b 100644 msgid "Loss of data Dialog" msgstr "" diff --git a/policycoreutils-2.4/sandbox/sandbox b/policycoreutils-2.4/sandbox/sandbox -index 3678c5d..7fc755c 100644 +index 3678c5d..5109eca 100644 --- a/policycoreutils-2.4/sandbox/sandbox +++ b/policycoreutils-2.4/sandbox/sandbox @@ -1,4 +1,4 @@ @@ -654849,8 +655513,25 @@ index 3678c5d..7fc755c 100644 for e in elist.message: sys.stderr.write(e[2]) -@@ -107,7 +109,11 @@ def savefile(new, orig, X_ind): - if rc == gtk.RESPONSE_YES: +@@ -95,19 +97,23 @@ def copyfile(file, srcdir, dest): + def savefile(new, orig, X_ind): + copy = False + if(X_ind): +- import gtk +- dlg = gtk.MessageDialog(None, 0, gtk.MESSAGE_INFO, +- gtk.BUTTONS_YES_NO, ++ from gi.repository import Gtk ++ dlg = Gtk.MessageDialog(None, 0, Gtk.MessageType.INFO, ++ Gtk.ButtonsType.YES_NO, + _("Do you want to save changes to '%s' (Y/N): ") % orig) + dlg.set_title(_("Sandbox Message")) +- dlg.set_position(gtk.WIN_POS_MOUSE) ++ dlg.set_position(Gtk.WindowPosition.MOUSE) + dlg.show_all() + rc = dlg.run() + dlg.destroy() +- if rc == gtk.RESPONSE_YES: ++ if rc == Gtk.ResponseType.YES: copy = True else: - ans = raw_input(_("Do you want to save changes to '%s' (y/N): ") % orig) @@ -654883,6 +655564,17 @@ index 3678c5d..7fc755c 100644 def usage(self, message = ""): error_exit("%s\n%s" % (self.__parser.usage, message)) +@@ -431,8 +437,8 @@ sandbox [-h] [-l level ] [-[X|M] [-H homedir] [-T tempdir]] [-I includefile ] [- + if self.__options.dpi: + dpi = self.__options.dpi + else: +- import gtk +- dpi = str(gtk.settings_get_default().props.gtk_xft_dpi/1024) ++ from gi.repository import Gtk ++ dpi = str(Gtk.Settings.get_default().props.gtk_xft_dpi/1024) + + xmodmapfile = self.__homedir + "/.xmodmap" + xd = open(xmodmapfile,"w") @@ -492,13 +498,13 @@ if __name__ == '__main__': try: sandbox = Sandbox() @@ -654901,14 +655593,28 @@ index 3678c5d..7fc755c 100644 error_exit(error) except KeyboardInterrupt: rc = 0 +diff --git a/policycoreutils-2.4/sandbox/sandboxX.sh b/policycoreutils-2.4/sandbox/sandboxX.sh +index eaa500d..4774528 100644 +--- a/policycoreutils-2.4/sandbox/sandboxX.sh ++++ b/policycoreutils-2.4/sandbox/sandboxX.sh +@@ -20,7 +20,7 @@ cat > ~/.config/openbox/rc.xml << EOF + + EOF + +-(/usr/bin/Xephyr -resizeable -title "$TITLE" -terminate -screen $SCREENSIZE -dpi $DPI -nolisten tcp -displayfd 5 5>&1 2>/dev/null) | while read D; do ++(/usr/bin/Xephyr -resizeable -title "$TITLE" -terminate -reset -screen $SCREENSIZE -dpi $DPI -nolisten tcp -displayfd 5 5>&1 2>/dev/null) | while read D; do + export DISPLAY=:$D + cat > ~/seremote << __EOF + #!/bin/sh diff --git a/policycoreutils-2.4/sandbox/start b/policycoreutils-2.4/sandbox/start -index 52950d7..d895ba2 100644 +index 52950d7..8766420 100644 --- a/policycoreutils-2.4/sandbox/start +++ b/policycoreutils-2.4/sandbox/start @@ -1,9 +1,9 @@ - #! /usr/bin/python -Es +-#! /usr/bin/python -Es -import gtk, commands, sys -+import gtk, subprocess, sys ++#! /usr/bin/python3 -Es ++import subprocess, sys rc = [-1,''] try: - rc=commands.getstatusoutput(sys.argv[1]) @@ -660844,7 +661550,7 @@ index 6b53035..a06c6c4 100644 out += "%s # %s\n" % (self.write_te(out_dir), _("Type Enforcement file")) out += "%s # %s\n" % (self.write_if(out_dir), _("Interface file")) diff --git a/policycoreutils-2.4/sepolicy/sepolicy/gui.py b/policycoreutils-2.4/sepolicy/sepolicy/gui.py -index 5ca87b9..4437d9e 100644 +index 5ca87b9..da826e0 100644 --- a/policycoreutils-2.4/sepolicy/sepolicy/gui.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/gui.py @@ -1,4 +1,4 @@ @@ -660904,6 +661610,17 @@ index 5ca87b9..4437d9e 100644 self.quit() self.init_cur() +@@ -130,8 +126,8 @@ class SELinuxGui(): + self.popup = 0 + self.applications_selection_button = builder.get_object("applications_selection_button") + self.revert_button = builder.get_object("Revert_button") +- self.busy_cursor = Gdk.Cursor(Gdk.CursorType.WATCH) +- self.ready_cursor = Gdk.Cursor(Gdk.CursorType.LEFT_PTR) ++ self.busy_cursor = Gdk.Cursor.new(Gdk.CursorType.WATCH) ++ self.ready_cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) + self.initialtype = selinux.selinux_getpolicytype()[1] + self.current_popup = None + self.import_export = None @@ -139,7 +135,7 @@ class SELinuxGui(): self.files_add = False self.network_add = False diff --git a/policycoreutils.spec b/policycoreutils.spec index 0cbe3b1..18c7344 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -7,7 +7,7 @@ Summary: SELinux policy core utilities Name: policycoreutils Version: 2.4 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2 Group: System Environment/Base # https://github.com/SELinuxProject/selinux/wiki/Releases @@ -18,7 +18,7 @@ Source2: policycoreutils_man_ru2.tar.bz2 Source3: system-config-selinux.png Source4: sepolicy-icons.tgz # use make-rhat-patches.sh to create following patches from https://github.com/fedora-selinux/selinux/ -# HEAD https://github.com/fedora-selinux/selinux/commit/997cfe77c75093964f3952754f767f2d375f5cb5 +# HEAD https://github.com/fedora-selinux/selinux/commit/2540625875ebdfe0ef48798437288e8a07aa853d Patch: policycoreutils-rhat.patch Patch1: sepolgen-rhat.patch Obsoletes: policycoreutils < 2.0.61-2 @@ -399,6 +399,9 @@ The policycoreutils-restorecond package contains the restorecond service. %systemd_postun_with_restart restorecond.service %changelog +* Fri Aug 21 2015 Petr Lautrbach 2.4-10 +- Port sandbox to GTK 3 and fix issue with Xephyr + * Thu Aug 13 2015 Petr Lautrbach 2.4-9 - Fix another python3 issues mainly in sepolicy (#1247039,#1247575,#1251713)