1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23#ifndef _SS_AVTAB_H_
24#define _SS_AVTAB_H_
25
26#include "security.h"
27
28struct avtab_key {
29 u16 source_type;
30 u16 target_type;
31 u16 target_class;
32#define AVTAB_ALLOWED 0x0001
33#define AVTAB_AUDITALLOW 0x0002
34#define AVTAB_AUDITDENY 0x0004
35#define AVTAB_AV (AVTAB_ALLOWED | AVTAB_AUDITALLOW | AVTAB_AUDITDENY)
36#define AVTAB_TRANSITION 0x0010
37#define AVTAB_MEMBER 0x0020
38#define AVTAB_CHANGE 0x0040
39#define AVTAB_TYPE (AVTAB_TRANSITION | AVTAB_MEMBER | AVTAB_CHANGE)
40
41#define AVTAB_XPERMS_ALLOWED 0x0100
42#define AVTAB_XPERMS_AUDITALLOW 0x0200
43#define AVTAB_XPERMS_DONTAUDIT 0x0400
44#define AVTAB_XPERMS (AVTAB_XPERMS_ALLOWED | \
45 AVTAB_XPERMS_AUDITALLOW | \
46 AVTAB_XPERMS_DONTAUDIT)
47#define AVTAB_ENABLED_OLD 0x80000000
48#define AVTAB_ENABLED 0x8000
49 u16 specified;
50};
51
52
53
54
55
56struct avtab_extended_perms {
57
58#define AVTAB_XPERMS_IOCTLFUNCTION 0x01
59#define AVTAB_XPERMS_IOCTLDRIVER 0x02
60
61 u8 specified;
62
63
64
65
66
67 u8 driver;
68
69 struct extended_perms_data perms;
70};
71
72struct avtab_datum {
73 union {
74 u32 data;
75 struct avtab_extended_perms *xperms;
76 } u;
77};
78
79struct avtab_node {
80 struct avtab_key key;
81 struct avtab_datum datum;
82 struct avtab_node *next;
83};
84
85struct avtab {
86 struct avtab_node **htable;
87 u32 nel;
88 u32 nslot;
89 u32 mask;
90};
91
92int avtab_init(struct avtab *);
93int avtab_alloc(struct avtab *, u32);
94struct avtab_datum *avtab_search(struct avtab *h, struct avtab_key *k);
95void avtab_destroy(struct avtab *h);
96void avtab_hash_eval(struct avtab *h, char *tag);
97
98struct policydb;
99int avtab_read_item(struct avtab *a, void *fp, struct policydb *pol,
100 int (*insert)(struct avtab *a, struct avtab_key *k,
101 struct avtab_datum *d, void *p),
102 void *p);
103
104int avtab_read(struct avtab *a, void *fp, struct policydb *pol);
105int avtab_write_item(struct policydb *p, struct avtab_node *cur, void *fp);
106int avtab_write(struct policydb *p, struct avtab *a, void *fp);
107
108struct avtab_node *avtab_insert_nonunique(struct avtab *h, struct avtab_key *key,
109 struct avtab_datum *datum);
110
111struct avtab_node *avtab_search_node(struct avtab *h, struct avtab_key *key);
112
113struct avtab_node *avtab_search_node_next(struct avtab_node *node, int specified);
114
115#define MAX_AVTAB_HASH_BITS 16
116#define MAX_AVTAB_HASH_BUCKETS (1 << MAX_AVTAB_HASH_BITS)
117
118#endif
119
120