Lines Matching defs:module
50 /* a pointer to within the base module's avrule_block chain to
51 * where this module's global now resides */
69 /* used to report the name of the module if dependency error occurs */
87 /* Deallocates all elements within a module, but NOT the policydb_t
108 /***** functions that copy identifiers from a module to base *****/
185 * module permission bit to target permission bit. that bit
259 * that either a) a module is trying to declare a new object class (which
361 * module expected. duplicate declarations (e.g., two
435 /* Copy types and attributes from a module into the base module. The
456 * module expected. duplicate declarations (e.g., two
922 /* if this already exists and isn't an alias it was required by another module (or base)
946 /* the aliases map points from its value to its primary so when this module
1226 policy_module_t * module, link_state_t * state)
1247 (&cur->stypes, &new_rule->stypes, module) == -1
1248 || type_set_convert(&cur->ttypes, &new_rule->ttypes, module) == -1) {
1262 module->map[SYM_CLASSES][cur_perm->tclass - 1];
1268 module->perm_map_len[cur_perm->tclass - 1];
1274 (module->
1280 module->map[SYM_TYPES][cur_perm->data - 1];
1329 policy_module_t * module, link_state_t * state)
1347 (&cur->roles, &new_rule->roles, module, state)
1349 module)) {
1353 if (ebitmap_convert(&cur->classes, &new_rule->classes, module->map[SYM_CLASSES]))
1356 new_rule->new_role = module->map[SYM_ROLES][cur->new_role - 1];
1375 policy_module_t * module, link_state_t * state)
1394 (&cur->roles, &new_rule->roles, module, state)
1396 &new_rule->new_roles, module,
1417 policy_module_t * module,
1444 if (type_set_or_convert(&cur->stypes, &new_rule->stypes, module) ||
1445 type_set_or_convert(&cur->ttypes, &new_rule->ttypes, module))
1448 new_rule->tclass = module->map[SYM_CLASSES][cur->tclass - 1];
1449 new_rule->otype = module->map[SYM_TYPES][cur->otype - 1];
1500 policy_module_t * module, link_state_t * state)
1527 assert(module->map[SYM_BOOLS][cur_expr->bool - 1] != 0);
1529 module->map[SYM_BOOLS][cur_expr->bool - 1];
1535 module->map[SYM_BOOLS][cur->bool_ids[i] - 1];
1542 (cur->avtrue_list, &new_node->avtrue_list, module, state)
1544 &new_node->avfalse_list, module,
1566 /*********** functions that copy avrule_decls from module to base ***********/
1613 policy_module_t * module, link_state_t * state)
1626 assert(module->map[i][j] != 0);
1628 (destmap, module->map[i][j] - 1, 1) != 0) {
1634 module->map[SYM_CLASSES][j]) {
1636 module->map[SYM_CLASSES][j];
1650 dest->class_perms_map + module->map[SYM_CLASSES][i] - 1;
1652 if (ebitmap_convert(srcmap, destmap, module->perm_map[i]))
1663 static int copy_avrule_decl(link_state_t * state, policy_module_t * module,
1670 (src_decl->avrules, &dest_decl->avrules, module, state) == -1
1672 &dest_decl->role_tr_rules, module,
1675 &dest_decl->role_allow_rules, module,
1678 module, state) == -1) {
1684 module, state))
1688 &dest_decl->range_tr_rules, module, state))
1699 module, state) == -1 ||
1701 module, state) == -1) {
1708 static int copy_avrule_block(link_state_t * state, policy_module_t * module,
1732 if (module->policy->name != NULL) {
1733 new_decl->module_name = strdup(module->policy->name);
1750 state->decl_to_mod[state->next_decl_id] = module->policy;
1752 module->avdecl_map[decl->decl_id] = new_decl->decl_id;
1754 ret = copy_avrule_decl(state, module, decl, new_decl);
1809 /* this module declared symbol, so overwrite the old
1823 /* this module depended on a symbol that now exists,
1835 /* this module declared a symbol, and it was already
1840 "%s: Duplicate declaration in module: %s %s",
1860 /* Copy a module over to a base, remapping all values within. After
1863 static int copy_module(link_state_t * state, policy_module_t * module)
1867 state->cur = module;
1868 state->cur_mod_name = module->policy->name;
1871 ret = copy_identifiers(state, module->policy->symtab, NULL);
1877 for (cur = module->policy->global; cur != NULL; cur = cur->next) {
1878 ret = copy_avrule_block(state, module, cur);
1888 (module->policy->scope[i].table, scope_copy_callback,
1897 /***** functions that check requirements and enable blocks in a module ******/
2162 INFO(state->handle, "check module %s decl %d",
2210 /* Given a module's policy, normalize all conditional expressions
2230 static int prepare_module(link_state_t * state, policy_module_t * module)
2238 items = module->policy->symtab[i].nprim;
2239 if ((module->map[i] =
2241 sizeof(*module->map[i]))) == NULL) {
2248 items = module->policy->p_classes.nprim;
2249 if ((module->perm_map_len =
2250 calloc(items, sizeof(*module->perm_map_len))) == NULL) {
2254 if ((module->perm_map =
2255 calloc(items, sizeof(*module->perm_map))) == NULL) {
2261 for (cur = module->policy->global; cur != NULL; cur = cur->next) {
2270 if ((module->avdecl_map = calloc(num_decls, sizeof(uint32_t))) == NULL) {
2274 module->num_decls = num_decls;
2277 if (cond_normalize(module->policy) < 0) {
2279 "Error while normalizing conditionals within the module %s.",
2280 module->policy->name);
2316 /* This allocates the decl block to module mapping used for error reporting */
2338 "Error while normalizing conditionals within the base module.");
2458 /* Link a set of modules into a base module. This process is somewhat
2460 * steps. The base and every module must have been indexed prior to
2481 /* first allocate some space to hold the maps from module
2492 "Tried to link in a policy that was not a module.");
2499 "Tried to link in a non-MLS module with an MLS base.");
2502 "Tried to link in an MLS module with a non-MLS base.");
2529 /* copy and remap the module's data over to base */