packages: policycoreutils/policycoreutils-gui.patch (NEW) - patch obtained ...
amateja
amateja at pld-linux.org
Mon May 11 11:29:12 CEST 2009
Author: amateja Date: Mon May 11 09:29:12 2009 GMT
Module: packages Tag: HEAD
---- Log message:
- patch obtained from fedora repo
---- Files affected:
packages/policycoreutils:
policycoreutils-gui.patch (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/policycoreutils/policycoreutils-gui.patch
diff -u /dev/null packages/policycoreutils/policycoreutils-gui.patch:1.1
--- /dev/null Mon May 11 11:29:12 2009
+++ packages/policycoreutils/policycoreutils-gui.patch Mon May 11 11:29:06 2009
@@ -0,0 +1,13865 @@
+diff --exclude-from=exclude -N -u -r nsapolicycoreutils/gui/booleansPage.py policycoreutils-2.0.62/gui/booleansPage.py
+--- nsapolicycoreutils/gui/booleansPage.py 1969-12-31 19:00:00.000000000 -0500
++++ policycoreutils-2.0.62/gui/booleansPage.py 2009-02-18 16:52:27.000000000 -0500
+@@ -0,0 +1,247 @@
++#
++# booleansPage.py - GUI for Booleans page in system-config-securitylevel
++#
++# Dan Walsh <dwalsh at redhat.com>
++#
++# Copyright 2006, 2007 Red Hat, Inc.
++#
++# This program is free software; you can redistribute it and/or modify
++# it under the terms of the GNU General Public License as published by
++# the Free Software Foundation; either version 2 of the License, or
++# (at your option) any later version.
++#
++# This program is distributed in the hope that it will be useful,
++# but WITHOUT ANY WARRANTY; without even the implied warranty of
++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++# GNU General Public License for more details.
++#
++# You should have received a copy of the GNU General Public License
++# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++#
++import string
++import gtk
++import gtk.glade
++import os
++import gobject
++import sys
++import tempfile
++import seobject
++import semanagePage
++
++INSTALLPATH='/usr/share/system-config-selinux'
++sys.path.append(INSTALLPATH)
++
++import commands
++ENFORCING=0
++PERMISSIVE=1
++DISABLED=2
++
++##
++## I18N
++##
++PROGNAME="policycoreutils"
++
++import gettext
++gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
++gettext.textdomain(PROGNAME)
++try:
++ gettext.install(PROGNAME,
++ localedir="/usr/share/locale",
++ unicode=False,
++ codeset = 'utf-8')
++except IOError:
++ import __builtin__
++ __builtin__.__dict__['_'] = unicode
++
++from glob import fnmatch
++
++class Modifier:
++ def __init__(self,name, on, save):
++ self.on=on
++ self.name=name
++ self.save=save
++
++ def set(self,value):
++ self.on=value
++ self.save=True
++
++ def isOn(self):
++ return self.on
++
++class Boolean(Modifier):
++ def __init__(self,name, val, save=False):
++ Modifier.__init__(self,name, val, save)
++
++ACTIVE = 0
++MODULE = 1
++DESC = 2
++BOOLEAN = 3
++
++class booleansPage:
++ def __init__(self, xml, doDebug=None):
++ self.xml = xml
++ xml.signal_connect("on_lockdown_clicked", self.on_lockdown_clicked)
++ self.window = self.xml.get_widget("mainWindow").get_root_window()
++ self.local = False
++ self.types=[]
++ 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)
++
++ # Bring in widgets from glade file.
++ self.typeHBox = xml.get_widget("typeHBox")
++ self.booleanSW = xml.get_widget("booleanSW")
++ self.booleansFilter = xml.get_widget("booleansFilter")
++ self.booleansFilter.connect("focus_out_event", self.filter_changed)
++ self.booleansFilter.connect("activate", self.filter_changed)
++
++ self.booleansView = xml.get_widget("booleansView")
++ self.typeLabel = xml.get_widget("typeLabel")
++ self.modifySeparator = xml.get_widget("modifySeparator")
++
++ 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)
++ self.booleansView.set_model(self.store)
++
++ checkbox = gtk.CellRendererToggle()
++ checkbox.connect("toggled", self.boolean_toggled)
++ 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("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_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.set_sort_column_id(BOOLEAN)
++ col.set_resizable(True)
++ self.booleansView.set_search_equal_func(self.__search)
++ self.booleansView.append_column(col)
++ self.filter=""
++ self.load(self.filter)
++
++ def __search(self, model, col, key, i):
++ sort_col = self.store.get_sort_column_id()[0]
++ if sort_col > 0:
++ val = model.get_value(i, sort_col)
++ if val.lower().startswith(key.lower()):
++ return False
++ return True
++
++ def wait(self):
++ self.window.set_cursor(self.busy_cursor)
++ semanagePage.idle_func()
++
++ def ready(self):
++ self.window.set_cursor(self.ready_cursor)
++ semanagePage.idle_func()
++
++ def deleteDialog(self):
++ store, iter = self.booleansView.get_selection().get_selected()
++ if iter == None:
++ return
++ boolean = store.get_value(iter, BOOLEAN)
++ # change cursor
++ if boolean == None:
++ return
++ try:
++ self.wait()
++ (rc, out) = commands.getstatusoutput("semanage boolean -d %s" % boolean)
++
++ self.ready()
++ if rc != 0:
++ return self.error(out)
++ self.load(self.filter)
++ except ValueError, e:
++ self.error(e.args[0])
++
++ def filter_changed(self, *arg):
++ filter = arg[0].get_text()
++ if filter != self.filter:
++ self.load(filter)
++ self.filter=filter
++
++ def use_menus(self):
++ return False
++
++ def get_description(self):
++ return _("Boolean")
++
++ def match(self,key, filter=""):
++ try:
++ f=filter.lower()
++ cat=self.booleans.get_category(key).lower()
++ val=self.booleans.get_desc(key).lower()
++ k=key.lower()
++ return val.find(f) >= 0 or k.find(f) >= 0 or cat.find(f) >= 0
++ except:
++ return False
++
++
++ def load(self, filter=None):
++ self.store.clear()
++ self.booleans = seobject.booleanRecords()
++ booleansList = self.booleans.get_all(self.local)
++ for name in booleansList:
++ rec = booleansList[name]
++ if self.match(name, filter):
++ iter=self.store.append()
++ self.store.set_value(iter, ACTIVE, rec[2] == 1)
++ self.store.set_value(iter, MODULE, self.booleans.get_category(name))
++ self.store.set_value(iter, DESC, self.booleans.get_desc(name))
++ self.store.set_value(iter, BOOLEAN, name)
++
++ def boolean_toggled(self, widget, row):
++ iter = self.store.get_iter(row)
++ val = self.store.get_value(iter, ACTIVE)
++ key = self.store.get_value(iter, BOOLEAN)
++ self.store.set_value(iter, ACTIVE , not val)
++ self.wait()
++ setsebool="/usr/sbin/setsebool -P %s=%d" % (key, not val)
++ commands.getstatusoutput(setsebool)
++ self.load(self.filter)
++ self.ready()
++
++ def on_revert_clicked(self, button):
++ self.wait()
++ setsebool="semanage boolean --deleteall"
++ commands.getstatusoutput(setsebool)
++ self.load(self.filter)
++ self.ready()
++
++ def on_lockdown_clicked(self, button):
++ try:
++ os.spawnl(os.P_NOWAIT, "/usr/share/system-config-selinux/lockdown.py")
++ except ValueError, e:
++ self.error(e.args[0])
++
++ def on_local_clicked(self, button):
++ self.local = not self.local
++ self.revertButton.set_sensitive(self.local)
++
++ if self.local:
++ button.set_label(_("all"))
++ else:
++ button.set_label(_("Customized"))
++
++ self.load(self.filter)
++ return True
++
+diff --exclude-from=exclude -N -u -r nsapolicycoreutils/gui/domainsPage.py policycoreutils-2.0.62/gui/domainsPage.py
+--- nsapolicycoreutils/gui/domainsPage.py 1969-12-31 19:00:00.000000000 -0500
++++ policycoreutils-2.0.62/gui/domainsPage.py 2009-02-18 16:52:27.000000000 -0500
+@@ -0,0 +1,154 @@
++## domainsPage.py - show selinux domains
++## Copyright (C) 2009 Red Hat, Inc.
++
++## This program is free software; you can redistribute it and/or modify
++## it under the terms of the GNU General Public License as published by
++## the Free Software Foundation; either version 2 of the License, or
++## (at your option) any later version.
++
++## This program is distributed in the hope that it will be useful,
++## but WITHOUT ANY WARRANTY; without even the implied warranty of
++## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++## GNU General Public License for more details.
++
++## You should have received a copy of the GNU General Public License
++## along with this program; if not, write to the Free Software
++## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++
++## Author: Dan Walsh
++import string
++import gtk
++import gtk.glade
++import os
++import commands
++import gobject
++import sys
++import seobject
++import selinux
++from semanagePage import *;
++import polgen
++
++##
++## I18N
++##
++PROGNAME="policycoreutils"
++import gettext
++gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
++gettext.textdomain(PROGNAME)
++try:
++ gettext.install(PROGNAME,
++ localedir="/usr/share/locale",
++ unicode=False,
++ codeset = 'utf-8')
++except IOError:
++ import __builtin__
++ __builtin__.__dict__['_'] = unicode
++
++class domainsPage(semanagePage):
++ def __init__(self, xml):
++ semanagePage.__init__(self, xml, "domains", _("Process Domain"))
++ self.domain_filter = xml.get_widget("domainsFilterEntry")
++ 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.view.set_model(self.store)
++ self.store.set_sort_column_id(0, gtk.SORT_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)
++ col.set_sort_column_id(1)
++ col.set_resizable(True)
++ self.view.append_column(col)
++ self.view.get_selection().connect("changed", self.itemSelected)
++
++ self.permissive_button = xml.get_widget("permissiveButton")
++ self.enforcing_button = xml.get_widget("enforcingButton")
++
++ self.domains=polgen.get_all_domains()
++ self.load()
++
++ def get_modules(self):
++ modules=[]
++ fd=os.popen("semodule -l")
++ mods = fd.readlines()
++ fd.close()
++ for l in mods:
++ modules.append(l.split()[0])
++ return modules
++
++ def load(self, filter=""):
++ self.filter=filter
++ self.store.clear()
++ try:
++ modules=self.get_modules()
++ for domain in self.domains:
++ if not self.match(domain, filter):
++ continue
++ iter = self.store.append()
++ self.store.set_value(iter, 0, domain)
++ t = "permissive_%s_t" % domain
++ if t in modules:
++ self.store.set_value(iter, 1, _("Permissive"))
++ else:
++ self.store.set_value(iter, 1, "")
++ except:
++ pass
++ self.view.get_selection().select_path ((0,))
++
++ def itemSelected(self, selection):
++ store, iter = selection.get_selected()
++ if iter == None:
++ return
++ p = store.get_value(iter, 1) == _("Permissive")
++ self.permissive_button.set_sensitive(not p)
++ self.enforcing_button.set_sensitive(p)
++
++ def deleteDialog(self):
++ # Do nothing
++ return self.delete()
++
++ def delete(self):
++ selection = self.view.get_selection()
++ store, iter = selection.get_selected()
++ domain = store.get_value(iter, 0)
++ try:
++ self.wait()
++ status, output = commands.getstatusoutput("semanage permissive -d %s_t" % domain)
++ self.ready()
++ if status != 0:
++ self.error(output)
++ else:
++ domain = store.set_value(iter, 1, "")
++ self.itemSelected(selection)
++
++ except ValueError, e:
++ self.error(e.args[0])
++
++ def propertiesDialog(self):
++ # Do nothing
++ return
++
++ def addDialog(self):
++ # Do nothing
++ return self.add()
++
++ def add(self):
++ selection = self.view.get_selection()
++ store, iter = selection.get_selected()
++ domain = store.get_value(iter, 0)
++ try:
++ self.wait()
++ status, output = commands.getstatusoutput("semanage permissive -a %s_t" % domain)
++ self.ready()
++ if status != 0:
++ self.error(output)
++ else:
++ domain = store.set_value(iter, 1, _("Permissive"))
++ self.itemSelected(selection)
++
++ except ValueError, e:
++ self.error(e.args[0])
+diff --exclude-from=exclude -N -u -r nsapolicycoreutils/gui/fcontextPage.py policycoreutils-2.0.62/gui/fcontextPage.py
+--- nsapolicycoreutils/gui/fcontextPage.py 1969-12-31 19:00:00.000000000 -0500
++++ policycoreutils-2.0.62/gui/fcontextPage.py 2009-02-18 16:52:27.000000000 -0500
+@@ -0,0 +1,223 @@
++## fcontextPage.py - show selinux mappings
++## Copyright (C) 2006 Red Hat, Inc.
++
++## This program is free software; you can redistribute it and/or modify
++## it under the terms of the GNU General Public License as published by
++## the Free Software Foundation; either version 2 of the License, or
++## (at your option) any later version.
++
++## This program is distributed in the hope that it will be useful,
++## but WITHOUT ANY WARRANTY; without even the implied warranty of
++## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++## GNU General Public License for more details.
++
++## You should have received a copy of the GNU General Public License
++## along with this program; if not, write to the Free Software
++## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++
++## Author: Dan Walsh
++import gtk
++import gtk.glade
++import os
++import gobject
++import seobject
++import commands
++from semanagePage import *;
++
++SPEC_COL = 0
++TYPE_COL = 1
++FTYPE_COL = 2
++
++class context:
++ def __init__(self, scontext):
++ self.scontext = scontext
++ con=scontext.split(":")
++ self.type = con[0]
++ if len(con) > 1:
++ self.mls = con[1]
++ else:
++ self.mls = "s0"
++
++ def __str__(self):
++ return self.scontext
++
++##
++## I18N
++##
++PROGNAME="policycoreutils"
++
++import gettext
++gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
++gettext.textdomain(PROGNAME)
++try:
++ gettext.install(PROGNAME,
++ localedir="/usr/share/locale",
++ unicode=False,
++ codeset = 'utf-8')
++except IOError:
++ import __builtin__
++ __builtin__.__dict__['_'] = unicode
++
++
++class fcontextPage(semanagePage):
++ def __init__(self, xml):
++ semanagePage.__init__(self, xml, "fcontext", _("File Labeling"))
++ self.fcontextFilter = xml.get_widget("fcontextFilterEntry")
++ 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.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.set_sizing(gtk.TREE_VIEW_COLUMN_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.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
++ col.set_fixed_width(250)
++ col.set_sort_column_id(TYPE_COL)
++ col.set_resizable(True)
++ self.view.append_column(col)
++ 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.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] != '-':
++ iter=liststore.append()
++ liststore.set_value(iter, 0, k)
++ iter = liststore.get_iter_first()
++ self.fcontextFileTypeCombo.set_active_iter(iter)
++ self.fcontextTypeEntry = xml.get_widget("fcontextTypeEntry")
++ self.fcontextMLSEntry = xml.get_widget("fcontextMLSEntry")
++
++ def match(self, fcon_dict, k, filter):
++ try:
++ f=filter.lower()
++ for con in k:
++ k=con.lower()
++ if k.find(f) >= 0:
++ return True
++ for con in fcon_dict[k]:
++ k=con.lower()
++ if k.find(f) >= 0:
++ return True
++ except:
++ pass
++ return False
++
++ def load(self, filter=""):
++ self.filter=filter
++ self.fcontext=seobject.fcontextRecords()
++ self.store.clear()
++ fcon_dict=self.fcontext.get_all(self.local)
++ keys = fcon_dict.keys()
++ keys.sort()
++ for k in keys:
++ if not self.match(fcon_dict, k, filter):
++ continue
++ iter=self.store.append()
++ self.store.set_value(iter, SPEC_COL, k[0])
++ self.store.set_value(iter, FTYPE_COL, k[1])
++ if fcon_dict[k]:
++ rec="%s:%s" % (fcon_dict[k][2], seobject.translate(fcon_dict[k][3],False))
++ else:
++ rec="<<None>>"
++ self.store.set_value(iter, TYPE_COL, rec)
++ self.view.get_selection().select_path ((0,))
++
++ def filter_changed(self, *arg):
++ filter = arg[0].get_text()
++ if filter != self.filter:
++ self.load(filter)
++
++ def dialogInit(self):
++ store, iter = self.view.get_selection().get_selected()
++ self.fcontextEntry.set_text(store.get_value(iter, SPEC_COL))
++ self.fcontextEntry.set_sensitive(False)
++ scontext = store.get_value(iter, TYPE_COL)
++ scon=context(scontext)
++ self.fcontextTypeEntry.set_text(scon.type)
++ self.fcontextMLSEntry.set_text(scon.mls)
++ type=store.get_value(iter, FTYPE_COL)
++ liststore=self.fcontextFileTypeCombo.get_model()
++ iter = liststore.get_iter_first()
++ while iter != None and liststore.get_value(iter,0) != type:
++ iter = liststore.iter_next(iter)
++ if iter != None:
++ self.fcontextFileTypeCombo.set_active_iter(iter)
++ self.fcontextFileTypeCombo.set_sensitive(False)
++
++ def dialogClear(self):
++ self.fcontextEntry.set_text("")
++ self.fcontextEntry.set_sensitive(True)
++ self.fcontextFileTypeCombo.set_sensitive(True)
++ self.fcontextTypeEntry.set_text("")
++ self.fcontextMLSEntry.set_text("s0")
++
++ def delete(self):
++ store, iter = self.view.get_selection().get_selected()
++ try:
++ fspec=store.get_value(iter, SPEC_COL)
++ ftype=store.get_value(iter, FTYPE_COL)
++ self.wait()
++ (rc, out) = commands.getstatusoutput("semanage fcontext -d -f '%s' '%s'" % (ftype, fspec))
++ self.ready()
<<Diff was trimmed, longer than 597 lines>>
More information about the pld-cvs-commit
mailing list