Cache corrections
The following patch does the role set expansion when adding users in reindex_user (necessary for sepol_genusers_policydb), and in my users patch. This is a bugfix. The first bit is needed, even if the users patch is not merged.
This patch depends on:
libsepol-1.1-context.diff
libsepol-1.2-fix_memory_leaks.diff
libsepol-2.1-users.diff
src/policydb.c +4 -3
@@ -2602,8 +2602,9 @@ int policydb_reindex_users(policydb_t *if (hashtab_map (p->symtab[i].table, index_f[i], p))return -1 ; +/* Expand user roles for context validity checking */ +if (hashtab_map (p->p_users.table, policydb_user_cache, p)) +return -1 ; +return 0 ; } - - -
src/users.c +7 -0
@@ -5,6 +5,7 @@#include <sepol/sepol.h> #include <sepol/policydb.h> +#include <sepol/expand.h> #include <sepol/mls.h> #include <sepol/users.h> #include <sys/types.h>
@@ -295,6 +296,12 @@ int sepol_user_load(policydb_t* policydb/* Set up reverse entry */ policydb->p_user_val_to_name[usrdatum->value -1 ] = key; policydb->user_val_to_struct[usrdatum->value -1 ] = usrdatum; + +/* Expand roles */ +if (role_set_expand (&usrdatum->roles, &usrdatum->cache, policydb)) { +DEBUG (__FUNCTION__,"unable to expand role set\n" ); + goto err; + } }free (name);