-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 This patch looks good to me. acked. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk45uJcACgkQrlYvE4MpobOAlgCgjjiMkFrmN/0fU0zpEOLHEyyn sCsAn0mlEdGhtnZ6FYodyARKY3wHSk9k =NcUk -----END PGP SIGNATURE-----
>From 7b5b9148aa4b64f94b309e1a38699f32d15dab94 Mon Sep 17 00:00:00 2001 From: Eric Paris <eparis@xxxxxxxxxx> Date: Fri, 15 Jul 2011 18:45:37 +0200 Subject: [PATCH 056/155] 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@xxxxxxxxxx> --- policycoreutils/semanage/seobject.py | 40 ++++++++++++++++++++++++++++++++++ 1 files changed, 40 insertions(+), 0 deletions(-) diff --git a/policycoreutils/semanage/seobject.py b/policycoreutils/semanage/seobject.py index a9faa35..c115b5f 100644 --- a/policycoreutils/semanage/seobject.py +++ b/policycoreutils/semanage/seobject.py @@ -487,6 +487,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: @@ -695,6 +705,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: @@ -1145,6 +1165,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 : @@ -1317,6 +1347,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: -- 1.7.6
Attachment:
0056-policycoreutils-semanage-introduce-more-deleteall-op.patch.sig
Description: PGP signature