mirror of
https://github.com/SELinuxProject/selinux
synced 2025-01-18 19:30:47 +00:00
policycoreutils: semanage: introduce more deleteall options
Some semanage objects have a deleteall function, some don't. This adds them to login seluser node and interface. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
849e7d5be7
commit
72a83a110d
@ -475,6 +475,16 @@ class loginRecords(semanageRecords):
|
||||
|
||||
mylog.log(1, "delete SELinux user mapping", name);
|
||||
|
||||
def deleteall(self):
|
||||
(rc, ulist) = semanage_seuser_list_local(self.sh)
|
||||
if rc < 0:
|
||||
raise ValueError(_("Could not list login mappings"))
|
||||
|
||||
self.begin()
|
||||
for u in ulist:
|
||||
self.__delete(semanage_seuser_get_name(u))
|
||||
self.commit()
|
||||
|
||||
def get_all(self, locallist = 0):
|
||||
ddict = {}
|
||||
if locallist:
|
||||
@ -682,6 +692,16 @@ class seluserRecords(semanageRecords):
|
||||
|
||||
mylog.log(1,"delete SELinux user record", name)
|
||||
|
||||
def deleteall(self):
|
||||
(rc, ulist) = semanage_user_list_local(self.sh)
|
||||
if rc < 0:
|
||||
raise ValueError(_("Could not list login mappings"))
|
||||
|
||||
self.begin()
|
||||
for u in ulist:
|
||||
self.__delete(semanage_user_get_name(u))
|
||||
self.commit()
|
||||
|
||||
def get_all(self, locallist = 0):
|
||||
ddict = {}
|
||||
if locallist:
|
||||
@ -1135,6 +1155,16 @@ class nodeRecords(semanageRecords):
|
||||
self.__delete(addr, mask, proto)
|
||||
self.commit()
|
||||
|
||||
def deleteall(self):
|
||||
(rc, nlist) = semanage_node_list_local(self.sh)
|
||||
if rc < 0:
|
||||
raise ValueError(_("Could not deleteall node mappings"))
|
||||
|
||||
self.begin()
|
||||
for node in nlist:
|
||||
self.__delete(semanage_node_get_addr(self.sh, node)[1], semanage_node_get_mask(self.sh, node)[1], self.protocol[semanage_node_get_proto(node)])
|
||||
self.commit()
|
||||
|
||||
def get_all(self, locallist = 0):
|
||||
ddict = {}
|
||||
if locallist :
|
||||
@ -1310,6 +1340,16 @@ class interfaceRecords(semanageRecords):
|
||||
self.__delete(interface)
|
||||
self.commit()
|
||||
|
||||
def deleteall(self):
|
||||
(rc, ulist) = semanage_iface_list_local(self.sh)
|
||||
if rc < 0:
|
||||
raise ValueError(_("Could not delete all interface mappings"))
|
||||
|
||||
self.begin()
|
||||
for i in ulist:
|
||||
self.__delete(semanage_iface_get_name(i))
|
||||
self.commit()
|
||||
|
||||
def get_all(self, locallist = 0):
|
||||
ddict = {}
|
||||
if locallist:
|
||||
|
Loading…
Reference in New Issue
Block a user