Commit Graph

7 Commits

Author SHA1 Message Date
Chris PeBenito
4e0b7d853b Thoroughly test MLS representations.
Implement category and level decl. lookups along the way.
2015-04-09 14:27:51 -04:00
Chris PeBenito
a44a82a8a1 Fix compile error. 2015-02-22 09:43:15 -05:00
Chris PeBenito
a8d7f740b2 Change range constructor to use regular levels instead of semantic ones.
This affords better error reporting since levels can be invalid for
several reasons.

* Fix memory leak in qpol_semantic_level
* Add unit tests
2015-02-22 09:24:39 -05:00
Chris PeBenito
4953ebdcc4 Implement MLS range lookup. 2015-02-21 16:43:32 -05:00
Chris PeBenito
2dd517b4b3 Implement MLS level lookup. 2015-02-21 15:09:52 -05:00
Nicolas Iooss
2994d1ca1d Cast the 2nd parameter of hashtab_search to hashtab_key_t
"gcc -Wwrite-strings" reported warnings when using hashtab_search (from
libsepol) with string literals as its second parameter is a non-constant
string.

Indeed /usr/include/sepol/policydb/hashtab.h contains:

    typedef char *hashtab_key_t;
    /* ... */
    extern hashtab_datum_t hashtab_search(hashtab_t h, const hashtab_key_t k);

This means the second parameter is "char *const k", not "const char *k".
As a consequence:

* Casting to "const hashtab_key_t" leads to misunderstanding the code.
* "const char*" variables need to be explicitly casted to "char*" or
  "hashtab_key_t" before calling hashtab_search.
* When using "gcc -Wwrite-strings", literal strings need to be casted to
  "char*" or "hashtab_key_t" before calling hashtab_search.
* "gcc -Wcast-qual" reports an awful amount of warnings due to
  const-to-nonconst pointer casts.

Add missing casts to hashtab_key_t to help finding real bugs in
setools/libqpol with gcc flags.
2014-11-02 13:02:58 -05:00
Chris PeBenito
8363f8edf7 Import libqpol from setools3.
Break setools3 dependence. Also fix SWIG wrapper to work with SWIG 2.x.
2014-10-24 21:00:24 -04:00