setools/libqpol
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
..
include/qpol Add printf format attribute to relevant functions in libqpol 2014-11-02 13:02:11 -05:00
avrule_query.c Remove unused-by-set variables 2014-11-02 13:02:58 -05:00
bool_query.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
bounds_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
class_perm_query.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
cond_query.c Remove unused-by-set variables 2014-11-02 13:02:58 -05:00
config.h Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
constraint_query.c Remove unused-by-set variables 2014-11-02 13:02:58 -05:00
context_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
default_object_query.c Remove unused-by-set variables 2014-11-02 13:02:58 -05:00
expand.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
expand.h Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
fs_use_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
ftrule_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
genfscon_query.c Fix typo in variable name in qpol_policy_get_genfscon_by_name 2014-11-02 13:02:58 -05:00
isid_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
iterator_internal.h Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
iterator.c Remove unused-by-set variables 2014-11-02 13:02:58 -05:00
libqpol.map Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
mls_query.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
mlsrule_query.c Remove unused-by-set variables 2014-11-02 13:02:58 -05:00
module_compiler.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
module_compiler.h Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
module.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
netifcon_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
nodecon_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
permissive_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
polcap_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
policy_define.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
policy_define.h Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
policy_extend.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
policy_parse.y Fix gcc -Wstrict-prototypes warnings 2014-11-02 13:02:57 -05:00
policy_scan.l Fix gcc -Wstrict-prototypes warnings 2014-11-02 13:02:57 -05:00
policy.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
portcon_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
qpol_internal.h Add printf format attribute to relevant functions in libqpol 2014-11-02 13:02:11 -05:00
queue.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
queue.h Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
rbacrule_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
role_query.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
syn_rule_internal.h Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
syn_rule_query.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00
terule_query.c Remove unused-by-set variables 2014-11-02 13:02:58 -05:00
type_query.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
user_query.c Cast the 2nd parameter of hashtab_search to hashtab_key_t 2014-11-02 13:02:58 -05:00
util.c Import libqpol from setools3. 2014-10-24 21:00:24 -04:00