Home | History | Annotate | Download | only in src

Lines Matching refs:fp

1637 static int role_set_read(role_set_t * r, struct policy_file *fp)
1642 if (ebitmap_read(&r->roles, fp))
1644 rc = next_entry(buf, fp, sizeof(uint32_t));
1652 static int type_set_read(type_set_t * t, struct policy_file *fp)
1657 if (ebitmap_read(&t->types, fp))
1659 if (ebitmap_read(&t->negset, fp))
1662 rc = next_entry(buf, fp, sizeof(uint32_t));
1674 static int mls_read_range_helper(mls_range_t * r, struct policy_file *fp)
1679 rc = next_entry(buf, fp, sizeof(uint32_t));
1685 ERR(fp->handle, "range overflow");
1689 rc = next_entry(buf, fp, sizeof(uint32_t) * items);
1691 ERR(fp->handle, "truncated range");
1700 rc = ebitmap_read(&r->level[0].cat, fp);
1702 ERR(fp->handle, "error reading low categories");
1706 rc = ebitmap_read(&r->level[1].cat, fp);
1708 ERR(fp->handle, "error reading high categories");
1714 ERR(fp->handle, "out of memory");
1732 struct policy_file *fp)
1741 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
1743 ERR(fp->handle, "truncated level");
1752 ERR(fp->handle, "out of memory");
1760 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
1762 ERR(fp->handle, "error reading level categories");
1780 struct policy_file *fp)
1784 rc = mls_read_semantic_level_helper(&r->level[0], fp);
1788 rc = mls_read_semantic_level_helper(&r->level[1], fp);
1843 policydb_t * p, struct policy_file *fp)
1848 rc = next_entry(buf, fp, sizeof(uint32_t) * 3);
1850 ERR(fp->handle, "context truncated");
1860 if (mls_read_range_helper(&c->range, fp)) {
1861 ERR(fp->handle, "error reading MLS range "
1868 ERR(fp->handle, "invalid security context");
1883 struct policy_file *fp)
1895 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
1905 rc = next_entry(key, fp, len);
1920 static int common_read(policydb_t * p, hashtab_t h, struct policy_file *fp)
1933 rc = next_entry(buf, fp, sizeof(uint32_t) * 4);
1948 rc = next_entry(key, fp, len);
1954 if (perm_read(p, comdatum->permissions.table, fp))
1970 int allowxtarget, struct policy_file *fp)
1990 rc = next_entry(buf, fp, (sizeof(uint32_t) * 2));
2011 rc = next_entry(buf, fp, (sizeof(uint32_t) * 3));
2040 if (ebitmap_read(&e->names, fp))
2043 type_set_read(e->type_names, fp))
2047 type_set_read(e->type_names, fp))
2063 static int class_read(policydb_t * p, hashtab_t h, struct policy_file *fp)
2076 rc = next_entry(buf, fp, sizeof(uint32_t) * 6);
2094 rc = next_entry(key, fp, len);
2103 rc = next_entry(cladatum->comkey, fp, len2);
2111 ERR(fp->handle, "unknown common %s", cladatum->comkey);
2116 if (perm_read(p, cladatum->permissions.table, fp))
2120 if (read_cons_helper(p, &cladatum->constraints, ncons, 0, fp))
2128 rc = next_entry(buf, fp, sizeof(uint32_t));
2132 if (read_cons_helper(p, &cladatum->validatetrans, ncons, 1, fp))
2140 rc = next_entry(buf, fp, sizeof(uint32_t) * 3);
2152 rc = next_entry(buf, fp, sizeof(uint32_t));
2170 struct policy_file *fp)
2185 rc = next_entry(buf, fp, sizeof(uint32_t) * to_read);
2197 rc = next_entry(key, fp, len);
2202 if (ebitmap_read(&role->dominates, fp))
2206 if (ebitmap_read(&role->types.types, fp))
2209 if (type_set_read(&role->types, fp))
2215 rc = next_entry(buf, fp, sizeof(uint32_t));
2221 if (ebitmap_read(&role->roles, fp))
2227 ERR(fp->handle, "role %s has wrong value %d",
2248 struct policy_file *fp)
2275 rc = next_entry(buf, fp, sizeof(uint32_t) * to_read);
2316 if (ebitmap_read(&typdatum->types, fp))
2323 rc = next_entry(key, fp, len);
2338 int role_trans_read(policydb_t *p, struct policy_file *fp)
2348 rc = next_entry(buf, fp, sizeof(uint32_t));
2363 rc = next_entry(buf, fp, sizeof(uint32_t) * 3);
2370 rc = next_entry(buf, fp, sizeof(uint32_t));
2381 int role_allow_read(role_allow_t ** r, struct policy_file *fp)
2388 rc = next_entry(buf, fp, sizeof(uint32_t));
2403 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
2413 int filename_trans_read(filename_trans_t **t, struct policy_file *fp)
2421 rc = next_entry(buf, fp, sizeof(uint32_t));
2436 rc = next_entry(buf, fp, sizeof(uint32_t));
2447 rc = next_entry(name, fp, len);
2451 rc = next_entry(buf, fp, sizeof(uint32_t) * 4);
2464 policydb_t *p, struct policy_file *fp)
2473 rc = next_entry(buf, fp, sizeof(uint32_t));
2489 rc = next_entry(buf, fp, sizeof(uint32_t));
2494 (&c->context[0], p, fp))
2498 rc = next_entry(buf, fp, sizeof(uint32_t));
2503 (&c->context[0], p, fp))
2507 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
2513 (&c->context[0], p, fp))
2517 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
2523 (&c->context[0], p, fp))
2527 rc = next_entry(buf, fp, sizeof(uint32_t));
2532 (&c->context[0], p, fp))
2537 ERR(fp->handle, "Unknown Xen ocontext");
2545 policydb_t * p, struct policy_file *fp)
2554 rc = next_entry(buf, fp, sizeof(uint32_t));
2572 rc = next_entry(buf, fp, sizeof(uint32_t));
2577 (&c->context[0], p, fp))
2582 rc = next_entry(buf, fp, sizeof(uint32_t));
2589 rc = next_entry(c->u.name, fp, len);
2594 (&c->context[0], p, fp))
2597 (&c->context[1], p, fp))
2601 rc = next_entry(buf, fp, sizeof(uint32_t) * 3);
2608 (&c->context[0], p, fp))
2612 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
2618 (&c->context[0], p, fp))
2622 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
2630 rc = next_entry(c->u.name, fp, len);
2635 (&c->context[0], p, fp))
2641 rc = next_entry(buf, fp, sizeof(uint32_t) * 8);
2651 (&c->context[0], p, fp))
2656 ERR(fp->handle, "Unknown SELinux ocontext");
2666 policydb_t *p, struct policy_file *fp)
2671 rc = ocontext_read_selinux(info, p, fp);
2674 rc = ocontext_read_xen(info, p, fp);
2677 ERR(fp->handle, "Unknown target");
2682 static int genfs_read(policydb_t * p, struct policy_file *fp)
2691 rc = next_entry(buf, fp, sizeof(uint32_t));
2697 rc = next_entry(buf, fp, sizeof(uint32_t));
2709 rc = next_entry(newgenfs->fstype, fp, len);
2719 ERR(fp->handle, "dup genfs fstype %s",
2733 rc = next_entry(buf, fp, sizeof(uint32_t));
2742 rc = next_entry(buf, fp, sizeof(uint32_t));
2750 rc = next_entry(newc->u.name, fp, len);
2754 rc = next_entry(buf, fp, sizeof(uint32_t));
2758 if (context_read_and_validate(&newc->context[0], p, fp))
2765 ERR(fp->handle, "dup genfs entry "
2799 static int mls_read_level(mls_level_t * lp, struct policy_file *fp)
2806 rc = next_entry(buf, fp, sizeof(uint32_t));
2808 ERR(fp->handle, "truncated level");
2813 if (ebitmap_read(&lp->cat, fp)) {
2814 ERR(fp->handle, "error reading level categories");
2823 static int user_read(policydb_t * p, hashtab_t h, struct policy_file *fp)
2838 rc = next_entry(buf, fp, sizeof(uint32_t) * to_read);
2850 rc = next_entry(key, fp, len);
2856 if (ebitmap_read(&usrdatum->roles.roles, fp))
2859 if (role_set_read(&usrdatum->roles, fp))
2875 if (mls_read_range_helper(&usrdatum->exp_range, fp))
2877 if (mls_read_level(&usrdatum->exp_dfltlevel, fp))
2891 if (mls_read_semantic_range_helper(&usrdatum->range, fp))
2893 if (mls_read_semantic_level_helper(&usrdatum->dfltlevel, fp))
2909 struct policy_file *fp)
2921 rc = next_entry(buf, fp, (sizeof(uint32_t) * 2));
2931 rc = next_entry(key, fp, len);
2937 if (!levdatum->level || mls_read_level(levdatum->level, fp))
2952 struct policy_file *fp)
2964 rc = next_entry(buf, fp, (sizeof(uint32_t) * 3));
2975 rc = next_entry(key, fp, len);
2991 struct policy_file * fp) = {
2998 __attribute__ ((unused)), struct policy_file *fp)
3012 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
3019 if (type_set_read(&avrule->stypes, fp))
3022 if (type_set_read(&avrule->ttypes, fp))
3025 rc = next_entry(buf, fp, sizeof(uint32_t));
3036 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
3062 static int range_read(policydb_t * p, struct policy_file *fp)
3072 rc = next_entry(buf, fp, sizeof(uint32_t));
3085 rc = next_entry(buf, fp, (sizeof(uint32_t) * 2));
3091 rc = next_entry(buf, fp, (sizeof(uint32_t)));
3097 if (mls_read_range_helper(&rt->target_range, fp))
3157 struct policy_file *fp)
3166 rc = next_entry(buf, fp, sizeof(uint32_t));
3173 cur = avrule_read(p, fp);
3190 struct policy_file *fp)
3197 rc = next_entry(buf, fp, sizeof(uint32_t));
3215 if (role_set_read(&tr->roles, fp))
3218 if (type_set_read(&tr->types, fp))
3222 if (ebitmap_read(&tr->classes, fp))
3229 rc = next_entry(buf, fp, sizeof(uint32_t));
3239 static int role_allow_rule_read(role_allow_rule_t ** r, struct policy_file *fp)
3246 rc = next_entry(buf, fp, sizeof(uint32_t));
3264 if (role_set_read(&ra->roles, fp))
3267 if (role_set_read(&ra->new_roles, fp))
3275 static int filename_trans_rule_read(filename_trans_rule_t ** r, struct policy_file *fp)
3282 rc = next_entry(buf, fp, sizeof(uint32_t));
3300 rc = next_entry(buf, fp, sizeof(uint32_t));
3310 rc = next_entry(ftr->name, fp, len);
3315 if (type_set_read(&ftr->stypes, fp))
3318 if (type_set_read(&ftr->ttypes, fp))
3321 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
3332 struct policy_file *fp)
3339 rc = next_entry(buf, fp, sizeof(uint32_t));
3355 if (type_set_read(&rt->stypes, fp))
3358 if (type_set_read(&rt->ttypes, fp))
3361 if (ebitmap_read(&rt->tclasses, fp))
3364 if (mls_read_semantic_range_helper(&rt->trange, fp))
3374 unsigned int num_scope_syms, struct policy_file *fp)
3381 if (ebitmap_read(scope_index->scope + i, fp) == -1) {
3385 rc = next_entry(buf, fp, sizeof(uint32_t));
3399 if (ebitmap_read(scope_index->class_perms_map + i, fp) == -1) {
3407 unsigned int num_scope_syms, struct policy_file *fp)
3413 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
3418 if (cond_read_list(p, &decl->cond_list, fp) == -1 ||
3419 avrule_read_list(p, &decl->avrules, fp) == -1 ||
3420 role_trans_rule_read(p, &decl->role_tr_rules, fp) == -1 ||
3421 role_allow_rule_read(&decl->role_allow_rules, fp) == -1) {
3426 filename_trans_rule_read(&decl->filename_trans_rules, fp))
3430 range_trans_rule_read(&decl->range_tr_rules, fp) == -1) {
3433 if (scope_index_read(&decl->required, num_scope_syms, fp) == -1 ||
3434 scope_index_read(&decl->declared, num_scope_syms, fp) == -1) {
3439 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
3445 if (read_f[i] (p, decl->symtab[i].table, fp)) {
3457 struct policy_file *fp)
3465 rc = next_entry(buf, fp, sizeof(uint32_t));
3476 rc = next_entry(buf, fp, sizeof(uint32_t));
3491 if (avrule_decl_read(p, curdecl, num_scope_syms, fp) ==
3532 static int scope_read(policydb_t * p, int symnum, struct policy_file *fp)
3542 rc = next_entry(buf, fp, sizeof(uint32_t));
3549 rc = next_entry(key, fp, key_len);
3562 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
3572 rc = next_entry(scope->decl_ids, fp, sizeof(uint32_t) * scope->decl_ids_len);
3599 int policydb_read(policydb_t * p, struct policy_file *fp, unsigned verbose)
3612 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
3623 ERR(fp->handle, "policydb magic number %#08x does not "
3631 ERR(fp->handle, "policydb string length too long ");
3637 ERR(fp->handle, "unable to allocate memory for policydb "
3641 rc = next_entry(policydb_str, fp, len);
3643 ERR(fp->handle, "truncated policydb string identifier");
3659 ERR(fp->handle, "cannot find a valid target for policy "
3666 ERR(fp->handle, "invalid string identifier %s",
3683 rc = next_entry(buf, fp, sizeof(uint32_t) * nel);
3697 ERR(fp->handle, "unknown module type: %#08x",
3708 ERR(fp->handle, "policydb version %d does not match "
3716 ERR(fp->handle, "policydb module version %d does "
3744 ERR(fp->handle, "unable to find policy compat info "
3751 ERR(fp->handle,
3760 if ((rc = next_entry(buf, fp, sizeof(uint32_t))) < 0) {
3767 if ((rc = next_entry(p->name, fp, len)) < 0) {
3771 if ((rc = next_entry(buf, fp, sizeof(uint32_t))) < 0) {
3778 if ((rc = next_entry(p->version, fp, len)) < 0) {
3790 if (ebitmap_read(&p->policycaps, fp))
3796 if (ebitmap_read(&p->permissive_map, fp))
3801 rc = next_entry(buf, fp, sizeof(uint32_t) * 2);
3807 if (read_f[i] (p, p->symtab[i].table, fp))
3815 if (avtab_read(&p->te_avtab, fp, r_policyvers))
3818 if (cond_read_list(p, &p->cond_list, fp))
3820 if (role_trans_read(p, fp))
3822 if (role_allow_read(&p->role_allow, fp))
3825 filename_trans_read(&p->filename_trans, fp))
3831 if (avrule_block_read(p, &p->global, info->sym_num, fp) == -1) {
3835 if ((rc = next_entry(buf, fp, sizeof(uint32_t))) < 0) {
3840 if (scope_read(p, i, fp))
3853 if (policydb_index_others(fp->handle, p, verbose))
3856 if (ocontext_read(info, p, fp) == -1) {
3860 if (genfs_read(p, fp) == -1) {
3869 if (range_read(p, fp)) {
3885 if (ebitmap_read(&p->type_attr_map[i], fp))