All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] chcat: don't crash if access to binary policy is prohibited
@ 2020-05-09 14:06 bauen1
  2020-05-10 17:25 ` Nicolas Iooss
  0 siblings, 1 reply; 6+ messages in thread
From: bauen1 @ 2020-05-09 14:06 UTC (permalink / raw)
  To: selinux

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-02-22 20:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-09 14:06 [PATCH] chcat: don't crash if access to binary policy is prohibited bauen1
2020-05-10 17:25 ` Nicolas Iooss
2020-05-29 13:16   ` Stephen Smalley
2021-02-17 21:16     ` [PATCH v2] chcat: allow usage if binary policy is inaccessible bauen1
2021-02-22 18:27       ` Petr Lautrbach
2021-02-22 20:33         ` bauen1

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.