diff mbox

[2/2] python/semanage: Enable listing fcontexts.homedirs

Message ID 20170927081645.32481-3-vmojzis@redhat.com (mailing list archive)
State Superseded
Headers show

Commit Message

Vit Mojzis Sept. 27, 2017, 8:16 a.m. UTC
Include entries from fcontexts.homedirs when listing file contexts
via "semanage fcontext -l"

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1409813
---
 python/semanage/seobject.py | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Stephen Smalley Sept. 27, 2017, 5:42 p.m. UTC | #1
On Wed, 2017-09-27 at 10:16 +0200, Vit Mojzis wrote:
> Include entries from fcontexts.homedirs when listing file contexts
> via "semanage fcontext -l"
> 
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1409813
> ---
>  python/semanage/seobject.py | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/python/semanage/seobject.py
> b/python/semanage/seobject.py
> index 70fd192..cf64e25 100644
> --- a/python/semanage/seobject.py
> +++ b/python/semanage/seobject.py
> @@ -2566,10 +2566,15 @@ class fcontextRecords(semanageRecords):
>              if rc < 0:
>                  raise ValueError(_("Could not list file contexts"))
>  
> +            (rc, fchomedirs) =
> semanage_fcontext_list_homedirs(self.sh)
> +            if rc < 0:
> +                raise ValueError(_("Could not list local file
> contexts"))
> +

The error message needs to match the actual failure (local vs
homedirs).

>              (rc, fclocal) = semanage_fcontext_list_local(self.sh)
>              if rc < 0:
>                  raise ValueError(_("Could not list local file
> contexts"))
>  
> +            self.flist += fchomedirs
>              self.flist += fclocal
>  
>          ddict = {}
diff mbox

Patch

diff --git a/python/semanage/seobject.py b/python/semanage/seobject.py
index 70fd192..cf64e25 100644
--- a/python/semanage/seobject.py
+++ b/python/semanage/seobject.py
@@ -2566,10 +2566,15 @@  class fcontextRecords(semanageRecords):
             if rc < 0:
                 raise ValueError(_("Could not list file contexts"))
 
+            (rc, fchomedirs) = semanage_fcontext_list_homedirs(self.sh)
+            if rc < 0:
+                raise ValueError(_("Could not list local file contexts"))
+
             (rc, fclocal) = semanage_fcontext_list_local(self.sh)
             if rc < 0:
                 raise ValueError(_("Could not list local file contexts"))
 
+            self.flist += fchomedirs
             self.flist += fclocal
 
         ddict = {}