libsepol/cil: Add function to check CIL neverallows against binary policy
PATCH v3 1/3 libsepol/cil: Add function to check CIL neverallows against binary policy
Add the function cil_check_neverallows_against_pdb() that will extract the neverallows from a CIL db and check them against a kernel policydb.
Android has the requirement of validating policies from partners against the standard AOSP assertions. While this is done at build time, the requirement is also enforced during certification via the Compatibility Test Suite.
Currently, this validation is done by manually parsing the neverallow assertions which is brittle and does not support neverallowx assertions.
This function will allow a CIL db with the neverallow and neverallowxperm rules to be used to check a kernel policydb for violations as part of the Compatibility Test Suite.
---
v2: Add more context to commit msg
Add error messages for when type or class-permission look-ups fail Set violation to CIL_FALSE initially to ensure it gets set Add more description in cil_binary.h for the function
libsepol/cil/include/cil/cil.h | 1 + libsepol/cil/src/cil_binary.c | 48 ++++++++++++++++++++++++++++++++++ libsepol/cil/src/cil_binary.h | 15 +++++++++++ libsepol/src/libsepol.map.in | 5 ++++ 4 files changed, 69 insertions(+)
libsepol/cil/include/cil/cil.h +1 -0
@@ -65,6 +65,7 @@ extern int cil_write_parse_ast(FILE *out, cil_db_t *db);extern int cil_write_build_ast (FILE *out,cil_db_t *db);extern int cil_write_resolve_ast (FILE *out,cil_db_t *db);extern int cil_write_post_ast (FILE *out,cil_db_t *db); +extern int cil_check_neverallows_against_pdb (const struct cil_db *db,policydb_t *pdb,int *violation);enum cil_log_level {CIL_ERR =1 ,
libsepol/cil/src/cil_binary.c +48 -0
54 lines not on this page · raw message
libsepol/cil/src/cil_binary.h +15 -0
@@ -36,6 +36,21 @@#include "cil_tree.h" #include "cil_list.h" + +/** +* Check neverallows from a CIL database against a policy database. +* +* The types, classes, and permissions used in the CIL neverallow rules must +* be declared in the policy database. +* +* @param[in] db The cil database containing the neverallows to be used. +* @param[in] pdb The policy database to be checked for violations. +* @param[out] violation 1 if a neverallow violation was found, 0 otherwise +* +* @return SEPOL_OK upon success or an error otherwise. +*/ +int cil_check_neverallows_against_pdb (const struct cil_db *db,policydb_t *pdb,int *violation); +/** * Create a binary policydb from the cil db. *
libsepol/src/libsepol.map.in +5 -0
@@ -294,3 +294,8 @@ LIBSEPOL_3.6 { global: cil_write_post_ast; } LIBSEPOL_3.4; + +LIBSEPOL_3.11 { + global: + cil_check_neverallows_against_pdb; +} LIBSEPOL_3.6;
Signature · 1 line
2.54.0
PATCH v3 2/3 libsepol: Add a function to output CIL declarations from a binary policy
Add the function sepol_kernel_policydb_decls_to_cil() that takes a binary policy as input and outputs the declarations in CIL format.
Also move the checks for a supported policy to a new common function and use that function in kernel_to_conf and kernel_to_cil.
In the near-term this will be used get the declarations from a policydb so they can be used along with neverallows written in CIL to check for neverallow and neverallowx violations in the binary policy.
---
v3: Split out less common functionality to keep the same order for the rules
to prevent breaking existing tests (even though CIL is not dependent on order.)
v2: Added more explanation to the commit msg
Split out common functionality
libselinux/src/selinuxswig_python_exception.i | 1224 ---------- .../src/semanageswig_python_exception.i | 2128 ----------------- libsepol/include/sepol/kernel_to_cil.h | 3 +- libsepol/src/kernel_to_cil.c | 97 +- libsepol/src/kernel_to_common.c | 26 + libsepol/src/kernel_to_common.h | 2 + libsepol/src/kernel_to_conf.c | 29 +- libsepol/src/libsepol.map.in | 1 + 8 files changed, 109 insertions(+), 3401 deletions(-) delete mode 100644 libselinux/src/selinuxswig_python_exception.i delete mode 100644 libsemanage/src/semanageswig_python_exception.i
libselinux/src/selinuxswig_python_exception.i deleted +0 -1224
@@ -1,1224 +0,0 @@ - -%exception is_selinux_enabled { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception is_selinux_mls_enabled { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpidcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpidcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getprevcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getprevcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpidprevcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpidprevcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getexeccon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getexeccon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setexeccon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setexeccon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getfscreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getfscreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setfscreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setfscreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getkeycreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getkeycreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setkeycreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setkeycreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getsockcreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getsockcreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setsockcreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setsockcreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception lgetfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception lgetfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception fgetfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception fgetfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception lsetfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception lsetfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception fsetfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception fsetfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpeercon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpeercon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_av { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_av_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_av_flags { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_av_flags_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_create_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_create_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_create_name_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_relabel { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_relabel_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_member { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_member_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_user { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_user_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_validatetrans { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_validatetrans_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_load_policy { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_initial_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_initial_context_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_mkload_policy { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_init_load_policy { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_set_boolean_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_load_booleans { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_check_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_check_context_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_canonicalize_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_canonicalize_context_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_getenforce { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_setenforce { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_reject_unknown { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_deny_unknown { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_checkreqprot { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_disable { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_policyvers { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_boolean_names { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_boolean_pending { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_boolean_active { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_set_boolean { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_commit_booleans { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_set_mapping { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_av_string { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon_init { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon_init_prefix { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception realpath_not_final { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon_index { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon_filespec_add { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchmediacon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_getenforcemode { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_getpolicytype { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_set_policy_root { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_check_access { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_check_passwd_access { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception checkPasswdAccess { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_check_securetty_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinuxfs_exists { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setexecfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception rpm_execcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception is_context_customizable { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_trans_to_raw_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_raw_to_trans_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_raw_context_to_color { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getseuserbyname { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getseuser { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_file_context_verify { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_lsetfilecon_default { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_sid_to_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_sid_to_context_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_context_to_sid { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_context_to_sid_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception sidget { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception sidput { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_get_initial_sid { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_init { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_open { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_reset { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_has_perm_noaudit { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_has_perm { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_compute_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_compute_member { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_add_callback { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_netlink_open { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_netlink_acquire_fd { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_netlink_check_nb { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_open { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_updated { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_getenforce { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_policyload { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_deny_unknown { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception context_type_set { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception context_range_set { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception context_role_set { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception context_user_set { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_ordered_context_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_ordered_context_list_with_level { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_context_with_level { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_context_with_role { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_context_with_rolelevel { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception query_user_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception manual_user_enter_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_type { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_lookup { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_lookup_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_lookup_best_match { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_lookup_best_match_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_digest { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_restorecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_restorecon_parallel { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_restorecon_set_alt_rootpath { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_restorecon_xattr { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -}
libsemanage/src/semanageswig_python_exception.i deleted +0 -2128
1,776 lines not on this page · raw message
libsepol/src/kernel_to_cil.c +73 -24
97 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.54.0
Part of the diff is not shown here. View the raw message.
Stephen Smalley
maintainerRe: [PATCH 2/3 v3] libsepol: Add a function to output CIL declarations from a binary policy
Doubt you meant to delete the python .i files here.
Quoted 3,631 lines · James Carter
Add the function
sepol_kernel_policydb_decls_to_cil()that takes a binary policy as input and outputs the declarations in CIL format.Also move the checks for a supported policy to a new common function and use that function in
kernel_to_confandkernel_to_cil.In the near-term this will be used get the declarations from a policydb so they can be used along with neverallows written in CIL to check for neverallow and neverallowx violations in the binary policy.
Suggested-by Thiébaud Weksteen <[email protected]>Signed-off-by James Carter <[email protected]>---
v3: Split out less common functionality to keep the same order for the rules
to prevent breaking existing tests (even though CIL is not dependent on order.)
v2: Added more explanation to the commit msg
Split out common functionalitylibselinux/src/selinuxswig_python_exception.i | 1224 ---------- .../src/semanageswig_python_exception.i | 2128 ----------------- libsepol/include/sepol/kernel_to_cil.h | 3 +- libsepol/src/kernel_to_cil.c | 97 +- libsepol/src/kernel_to_common.c | 26 + libsepol/src/kernel_to_common.h | 2 + libsepol/src/kernel_to_conf.c | 29 +- libsepol/src/libsepol.map.in | 1 + 8 files changed, 109 insertions(+), 3401 deletions(-) delete mode 100644 libselinux/src/selinuxswig_python_exception.i delete mode 100644 libsemanage/src/semanageswig_python_exception.ilibselinux/src/selinuxswig_python_exception.i deleted +0
-1224@@ -1,1224 +0,0 @@ - -%exception is_selinux_enabled { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception is_selinux_mls_enabled { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpidcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpidcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getprevcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getprevcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpidprevcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpidprevcon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getexeccon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getexeccon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setexeccon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setexeccon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getfscreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getfscreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setfscreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setfscreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getkeycreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getkeycreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setkeycreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setkeycreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getsockcreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getsockcreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setsockcreatecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setsockcreatecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception lgetfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception lgetfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception fgetfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception fgetfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception lsetfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception lsetfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception fsetfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception fsetfilecon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpeercon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getpeercon_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_av { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_av_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_av_flags { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_av_flags_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_create_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_create_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_create_name_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_relabel { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_relabel_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_member { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_member_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_user { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_compute_user_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_validatetrans { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_validatetrans_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_load_policy { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_initial_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_initial_context_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_mkload_policy { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_init_load_policy { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_set_boolean_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_load_booleans { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_check_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_check_context_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_canonicalize_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_canonicalize_context_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_getenforce { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_setenforce { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_reject_unknown { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_deny_unknown { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_checkreqprot { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_disable { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_policyvers { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_boolean_names { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_boolean_pending { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_get_boolean_active { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_set_boolean { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_commit_booleans { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_set_mapping { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception security_av_string { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon_init { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon_init_prefix { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception realpath_not_final { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon_index { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchpathcon_filespec_add { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception matchmediacon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_getenforcemode { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_getpolicytype { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_set_policy_root { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_check_access { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_check_passwd_access { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception checkPasswdAccess { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_check_securetty_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinuxfs_exists { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception setexecfilecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception rpm_execcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception is_context_customizable { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_trans_to_raw_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_raw_to_trans_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_raw_context_to_color { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getseuserbyname { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception getseuser { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_file_context_verify { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_lsetfilecon_default { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_sid_to_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_sid_to_context_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_context_to_sid { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_context_to_sid_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception sidget { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception sidput { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_get_initial_sid { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_init { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_open { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_reset { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_has_perm_noaudit { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_has_perm { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_compute_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_compute_member { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_add_callback { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_netlink_open { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_netlink_acquire_fd { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception avc_netlink_check_nb { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_open { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_updated { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_getenforce { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_policyload { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_status_deny_unknown { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception context_type_set { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception context_range_set { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception context_role_set { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception context_user_set { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_ordered_context_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_ordered_context_list_with_level { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_context_with_level { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_context_with_role { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_context_with_rolelevel { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception query_user_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception manual_user_enter_context { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception get_default_type { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_lookup { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_lookup_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_lookup_best_match { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_lookup_best_match_raw { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selabel_digest { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_restorecon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_restorecon_parallel { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_restorecon_set_alt_rootpath { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception selinux_restorecon_xattr { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -}libsemanage/src/semanageswig_python_exception.i deleted +0
-2128@@ -1,2128 +0,0 @@ - -%exception semanage_reload_policy { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_get_hll_compiler_path { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_get_disable_dontaudit { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_set_default_priority { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_is_managed { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_connect { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_disconnect { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_begin_transaction { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_commit { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_access_check { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_is_connected { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_mls_enabled { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_set_root { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_get_preserve_tunables { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_get_ignore_module_cache { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception select { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception pselect { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_install { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_install_file { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_remove { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_destroy { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_get_priority { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_get_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_get_lang_ext { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_get_enabled { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_set_priority { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_set_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_set_lang_ext { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_info_set_enabled { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_key_destroy { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_key_get_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_key_get_priority { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_key_set_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_key_set_priority { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_set_enabled { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_get_module_info { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_list_all { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_install_info { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_remove_key { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_get_enabled { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_module_compute_checksum { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_msg_get_level { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_key_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_compare { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_compare2 { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_set_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_get_value { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_key_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_compare { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_compare2 { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_set_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_set_prefix { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_set_mlslevel { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_set_mlsrange { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_get_num_roles { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_add_role { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_has_role { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_get_roles { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_set_roles { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_key_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_compare { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_compare2 { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_set_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_set_sename { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_set_mlsrange { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_context_set_user { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_context_set_role { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_context_set_type { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_context_set_mls { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_context_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_context_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_context_from_string { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_context_to_string { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_iface_compare { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_iface_compare2 { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_iface_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_iface_key_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_iface_set_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_iface_set_ifcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_iface_set_msgcon { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_iface_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_iface_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_compare { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_compare2 { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_key_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_get_proto { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_get_low { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_get_high { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_set_con { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_compare { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_compare2 { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_key_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_get_subnet_prefix { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_set_subnet_prefix { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_get_low { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_get_high { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_set_con { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_compare { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_compare2 { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_key_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_get_ibdev_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_set_ibdev_name { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_get_port { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_set_con { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibendport_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_compare { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_compare2 { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_key_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_get_addr { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_get_addr_bytes { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_set_addr { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_set_addr_bytes { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_get_mask { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_get_mask_bytes { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_set_mask { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_set_mask_bytes { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_get_proto { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_set_con { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_node_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_modify_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_del_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_query_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_exists_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_count_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_iterate_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_list_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_query { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_exists { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_count { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_iterate { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_set_active { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_query_active { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_exists_active { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_count_active { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_iterate_active { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_bool_list_active { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_modify_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_del_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_query_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_exists_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_count_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_iterate_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_list_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_query { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_exists { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_count { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_iterate { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_user_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_compare { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_compare2 { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_key_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_key_extract { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_set_expr { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_get_type { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_set_con { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_create { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_clone { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_modify_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_del_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_query_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_exists_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_count_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_iterate_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_list_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_query { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_exists { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_count { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_iterate { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_fcontext_list_homedirs { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_modify_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_del_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_query_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_exists_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_count_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_iterate_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_list_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_query { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_exists { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_count { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_iterate { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_seuser_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_modify_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_del_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_query_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_exists_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_count_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_iterate_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_list_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_query { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_exists { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_count { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_iterate { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_port_list { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_modify_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_del_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_query_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -} - -%exception semanage_ibpkey_exists_local { - $action - if (result < 0) { - PyErr_SetFromErrno(PyExc_OSError); - SWIG_fail; - } -}Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
2.54.0
Part of the diff is not shown here. View the raw message.
PATCH v3 3/3 secilc: Add program that checks CIL neverallows against a binary policy
In reply to James CarterAdd the program secilcheck that takes a binary policy and one or more CIL files and checks for violations in the binary policy using the neverallow and neverallowx rules from the CIL policy.
ex/
secilcheck policy.bin neverallows.cil
The CIL neverallow and neverallowx rules must only use types, classes, and permissions that are declared in the binary policy.
This is planned on being used in Android to validate policies from partners against the standard AOSP assertions as part of the Compatibility Test Suite.
---
v2: Added more explanation to the commit msg
Added the header unistd.h
secilc/.gitignore | 2 + secilc/Makefile | 20 ++- secilc/secilcheck.8.xml | 81 +++++++++++ secilc/secilcheck.c | 302 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 403 insertions(+), 2 deletions(-) create mode 100644 secilc/secilcheck.8.xml create mode 100644 secilc/secilcheck.c
secilc/.gitignore +2 -0
@@ -4,6 +4,8 @@ secil2conf secil2conf.8 secil2tree secil2tree.8 +secilcheck +secilcheck.8 policy.* file_contexts docs/html
secilc/Makefile +18 -2
@@ -14,9 +14,14 @@ SECIL2TREE = secil2tree SECIL2TREE_SRCS := secil2tree.c SECIL2TREE_OBJS := $(patsubst %.c,%.o,$(SECIL2TREE_SRCS)) +SECILCHECK = secilcheck +SECILCHECK_SRCS := secilcheck.c +SECILCHECK_OBJS := $(patsubst %.c,%.o,$(SECILCHECK_SRCS)) + SECILC_MANPAGE = secilc.8 SECIL2CONF_MANPAGE = secil2conf.8 SECIL2TREE_MANPAGE = secil2tree.8 +SECILCHECK_MANPAGE = secilcheck.8 XMLTO = xmlto DIFF = diff
@@ -28,7 +33,7 @@ CFLAGS ?= -Wall -Wshadow -Wextra -Wundef -Wmissing-format-attribute -Wcast-align override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 override LDLIBS += -lsepol -all: $(SECILC) $(SECIL2CONF) $(SECIL2TREE) man +all: $(SECILC) $(SECIL2CONF) $(SECIL2TREE) $(SECILCHECK) man $(SECILC): $(SECILC_OBJS) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
@@ -45,7 +50,10 @@ $(SECIL2CONF): $(SECIL2CONF_OBJS) $(SECIL2TREE): $(SECIL2TREE_OBJS) $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) -man: $(SECILC_MANPAGE) $(SECIL2CONF_MANPAGE) $(SECIL2TREE_MANPAGE) +$(SECILCHECK): $(SECILCHECK_OBJS) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS) + +man: $(SECILC_MANPAGE) $(SECIL2CONF_MANPAGE) $(SECIL2TREE_MANPAGE) $(SECILCHECK_MANPAGE) $(SECILC_MANPAGE): $(SECILC_MANPAGE).xml $(XMLTO) man $(SECILC_MANPAGE).xml
@@ -56,15 +64,20 @@ $(SECIL2CONF_MANPAGE): $(SECIL2CONF_MANPAGE).xml $(SECIL2TREE_MANPAGE): $(SECIL2TREE_MANPAGE).xml $(XMLTO) man $(SECIL2TREE_MANPAGE).xml +$(SECILCHECK_MANPAGE): $(SECILCHECK_MANPAGE).xml + $(XMLTO) man $(SECILCHECK_MANPAGE).xml + install: all man -mkdir -p $(DESTDIR)$(BINDIR) -mkdir -p $(DESTDIR)$(MANDIR)/man8 install -m 755 $(SECILC) $(DESTDIR)$(BINDIR) install -m 755 $(SECIL2CONF) $(DESTDIR)$(BINDIR) install -m 755 $(SECIL2TREE) $(DESTDIR)$(BINDIR) + install -m 755 $(SECILCHECK) $(DESTDIR)$(BINDIR) install -m 644 $(SECILC_MANPAGE) $(DESTDIR)$(MANDIR)/man8 install -m 644 $(SECIL2CONF_MANPAGE) $(DESTDIR)$(MANDIR)/man8 install -m 644 $(SECIL2TREE_MANPAGE) $(DESTDIR)$(MANDIR)/man8 + install -m 644 $(SECILCHECK_MANPAGE) $(DESTDIR)$(MANDIR)/man8 doc: $(MAKE) -C docs
@@ -76,11 +89,14 @@ clean: rm -f $(SECIL2CONF_OBJS) rm -f $(SECIL2TREE) rm -f $(SECIL2TREE_OBJS) + rm -f $(SECILCHECK) + rm -f $(SECILCHECK_OBJS) rm -f policy.* rm -f file_contexts rm -f $(SECILC_MANPAGE) rm -f $(SECIL2CONF_MANPAGE) rm -f $(SECIL2TREE_MANPAGE) + rm -f $(SECILCHECK_MANPAGE) rm -f opt-actual.cil rm -f opt-actual.bin $(MAKE) -C docs clean
secilc/secilcheck.8.xml new file +81 -0
81 lines not on this page · raw message
secilc/secilcheck.c new file +302 -0
302 lines not on this page · raw message
Signature · 1 line
2.54.0