[PATCH] chcat: don't crash if access to binary policy is prohibited

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

 



sobject will crash if access to the binary policy is prohibited by
selinux, e.g. refpolicy
this also breaks file operations that don't require seobject.

Signed-off-by: bauen1 <j2468h@xxxxxxxxx>
---
 python/chcat/chcat | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/python/chcat/chcat b/python/chcat/chcat
index fdd2e46e..55408577 100755
--- a/python/chcat/chcat
+++ b/python/chcat/chcat
@@ -28,7 +28,6 @@ import os
 import pwd
 import getopt
 import selinux
-import seobject
 
 PROGNAME = "policycoreutils"
 try:
@@ -65,6 +64,7 @@ def verify_users(users):
 
 
 def chcat_user_add(newcat, users):
+    import seobject
     errors = 0
     logins = seobject.loginRecords()
     seusers = logins.get_all()
@@ -144,6 +144,7 @@ def chcat_add(orig, newcat, objects, login_ind):
 
 
 def chcat_user_remove(newcat, users):
+    import seobject
     errors = 0
     logins = seobject.loginRecords()
     seusers = logins.get_all()
@@ -233,6 +234,7 @@ def chcat_remove(orig, newcat, objects, login_ind):
 
 
 def chcat_user_replace(newcat, users):
+    import seobject
     errors = 0
     logins = seobject.loginRecords()
     seusers = logins.get_all()
@@ -376,6 +378,7 @@ def listcats():
 
 
 def listusercats(users):
+    import seobject
     if len(users) == 0:
         try:
             users.append(os.getlogin())
-- 
2.26.2




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

  Powered by Linux