From f84bc834f8505d6202e8ad751f6824843b7746bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Mon, 4 Dec 2023 19:04:46 +0100 Subject: [PATCH] Update for libsepol 3.6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In libsepol 3.6 the member name holding the value of the struct `cond_expr_t` has been changed from `bool` to `boolean`. Check on the availability macro to support building against older and newer libsepol versions. Fixes: #110 Signed-off-by: Christian Göttsche --- setools/policyrep/boolcond.pxi | 2 +- setools/policyrep/sepol.pxd | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/setools/policyrep/boolcond.pxi b/setools/policyrep/boolcond.pxi index 13e730be..26339fb5 100644 --- a/setools/policyrep/boolcond.pxi +++ b/setools/policyrep/boolcond.pxi @@ -333,7 +333,7 @@ cdef class ConditionalExprIterator(PolicyIterator): if self.curr.expr_type == sepol.COND_BOOL: item = Boolean.factory(self.policy, - self.policy.boolean_value_to_datum(self.curr.bool - 1)) + self.policy.boolean_value_to_datum(self.curr.boolean - 1)) else: item = ConditionalOperator.factory(self.policy, self.curr) diff --git a/setools/policyrep/sepol.pxd b/setools/policyrep/sepol.pxd index 36589ed1..922065e4 100644 --- a/setools/policyrep/sepol.pxd +++ b/setools/policyrep/sepol.pxd @@ -283,6 +283,14 @@ cdef extern from "": cdef extern from "": + """ + #if defined(COND_EXPR_T_RENAME_BOOL_BOOLEAN) + #define COND_EXPR_T_RENAME_BOOL_NAME boolean + #else + #define COND_EXPR_T_RENAME_BOOL_NAME bool + #endif + """ + cdef int COND_EXPR_MAXDEPTH cdef int COND_MAX_BOOLS @@ -309,7 +317,7 @@ cdef extern from "": cdef struct cond_expr: uint32_t expr_type - uint32_t bool + uint32_t boolean "COND_EXPR_T_RENAME_BOOL_NAME" cond_expr *next ctypedef cond_expr cond_expr_t