SELinux Security Module development
 help / color / mirror / Atom feed
From: Petr Lautrbach <plautrba@redhat.com>
To: Vit Mojzis <vmojzis@redhat.com>, selinux@vger.kernel.org
Subject: Re: [PATCH v2] gui: fix "file type" selection in fcontextPage
Date: Wed, 24 Feb 2021 15:16:00 +0100	[thread overview]
Message-ID: <871rd5361r.fsf@redhat.com> (raw)
In-Reply-To: <20210219142314.1962469-1-vmojzis@redhat.com>

Vit Mojzis <vmojzis@redhat.com> writes:

> A change in seobject.py file_type_str_to_option made the "file type"
> list not compatible with items in this ComboBox.
> See: 317743bbe2a235a5c68f1066b4153e0726a3118f
>
> Avoid this in the future by populating the ComboBox using keys from
> file_type_str_to_option.
>
> This change disables translations on the file types, but those cause
> other issues (adding file context fails the same way as with 'socket
> file' since the translated strings differ form
> file_type_str_to_option.keys, 'properties' of a file context entry
> shows no file type for the same reason).
>
> Fixes:
>  Traceback (most recent call last):
>   File "/usr/share/system-config-selinux/system-config-selinux.py", line 136, in add
>     self.tabs[self.notebook.get_current_page()].addDialog()
>   File "/usr/share/system-config-selinux/semanagePage.py", line 143, in addDialog
>     if self.add() is False:
>   File "/usr/share/system-config-selinux/fcontextPage.py", line 195, in add
>     (rc, out) = getstatusoutput("semanage fcontext -a -t %s -r %s -f '%s' '%s'" % (type, mls, seobject.file_type_str_to_option[ftype], fspec))
>  KeyError: 'socket file'
>
> Signed-off-by: Vit Mojzis <vmojzis@redhat.com>

Acked-by: Petr Lautrbach <plautrba@redhat.com>

And merged. Thanks!

> ---
> Add missing "Signed-off-by".
>
>  gui/fcontextPage.py          |  7 +++++++
>  gui/system-config-selinux.ui | 26 --------------------------
>  2 files changed, 7 insertions(+), 26 deletions(-)
>
> diff --git a/gui/fcontextPage.py b/gui/fcontextPage.py
> index 370bbee4..d26aa1b4 100644
> --- a/gui/fcontextPage.py
> +++ b/gui/fcontextPage.py
> @@ -102,6 +102,13 @@ class fcontextPage(semanagePage):
>          self.load()
>          self.fcontextEntry = xml.get_object("fcontextEntry")
>          self.fcontextFileTypeCombo = xml.get_object("fcontextFileTypeCombo")
> +        # Populate file type combo_box
> +        liststore = self.fcontextFileTypeCombo.get_model()
> +        for ftype in seobject.file_type_str_to_option.keys():
> +            iter = liststore.append()
> +            liststore.set_value(iter, 0, ftype)
> +        iter = liststore.get_iter_first()
> +        self.fcontextFileTypeCombo.set_active_iter(iter)
>          self.fcontextTypeEntry = xml.get_object("fcontextTypeEntry")
>          self.fcontextMLSEntry = xml.get_object("fcontextMLSEntry")
>  
> diff --git a/gui/system-config-selinux.ui b/gui/system-config-selinux.ui
> index 7cc1cc53..e7b84a64 100644
> --- a/gui/system-config-selinux.ui
> +++ b/gui/system-config-selinux.ui
> @@ -401,32 +401,6 @@ Level</property>
>        <!-- column-name gchararray -->
>        <column type="gchararray"/>
>      </columns>
> -    <data>
> -      <row>
> -        <col id="0" translatable="yes">all files</col>
> -      </row>
> -      <row>
> -        <col id="0" translatable="yes">regular file</col>
> -      </row>
> -      <row>
> -        <col id="0" translatable="yes">directory</col>
> -      </row>
> -      <row>
> -        <col id="0" translatable="yes">character device</col>
> -      </row>
> -      <row>
> -        <col id="0" translatable="yes">block device</col>
> -      </row>
> -      <row>
> -        <col id="0" translatable="yes">socket file</col>
> -      </row>
> -      <row>
> -        <col id="0" translatable="yes">symbolic link</col>
> -      </row>
> -      <row>
> -        <col id="0" translatable="yes">named pipe</col>
> -      </row>
> -    </data>
>    </object>
>    <object class="GtkDialog" id="fcontextDialog">
>      <property name="can_focus">False</property>
> -- 
> 2.29.2


      reply	other threads:[~2021-02-24 15:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-16 20:08 [PATCH] gui: fix "file type" selection in fcontextPage Vit Mojzis
2021-02-17 15:26 ` Ondrej Mosnacek
2021-02-19 14:23   ` [PATCH v2] " Vit Mojzis
2021-02-24 14:16     ` Petr Lautrbach [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871rd5361r.fsf@redhat.com \
    --to=plautrba@redhat.com \
    --cc=selinux@vger.kernel.org \
    --cc=vmojzis@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox