Skip to content

Commit

Permalink
Update for libsepol 3.6
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
cgzones committed Dec 4, 2023
1 parent 9b4a77f commit f84bc83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setools/policyrep/boolcond.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
10 changes: 9 additions & 1 deletion setools/policyrep/sepol.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,14 @@ cdef extern from "<sepol/policydb/sidtab.h>":


cdef extern from "<sepol/policydb/conditional.h>":
"""
#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

Expand All @@ -309,7 +317,7 @@ cdef extern from "<sepol/policydb/conditional.h>":

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
Expand Down

0 comments on commit f84bc83

Please sign in to comment.