1 Index: checkpolicy/policy_parse.y
2 ===================================================================
3 RCS file: /nfshome/pal/CVS/selinux-usr/checkpolicy/policy_parse.y,v
4 retrieving revision 1.11
5 diff -u -r1.11 policy_parse.y
6 --- checkpolicy/policy_parse.y 15 Jan 2004 14:23:02 -0000 1.11
7 +++ checkpolicy/policy_parse.y 15 Jan 2004 17:48:45 -0000
9 static int define_common_base(void);
10 static int define_av_base(void);
11 static int define_attrib(void);
12 +static int define_typealias(void);
13 static int define_type(int alias);
14 static int define_compute_type(int which);
15 static int define_te_avtab(int which);
26 te_decl : attribute_def
33 | TYPE identifier opt_attr_list ';'
34 {if (define_type(0)) return -1;}
36 +typealias_def : TYPEALIAS identifier alias_def
37 + {if (define_typealias()) return -1;}
39 opt_attr_list : ',' id_comma_list
42 @@ -1479,6 +1485,61 @@
46 +static int define_typealias(void)
49 + type_datum_t *t, *aliasdatum;
54 + while ((id = queue_remove(id_queue)))
59 + id = (char *) queue_remove(id_queue);
61 + yyerror("no type name for typealias definition?");
65 + t = hashtab_search(policydbp->p_types.table, id);
66 + if (!t || t->isattr) {
67 + sprintf(errormsg, "unknown type %s", id);
73 + while ((id = queue_remove(id_queue))) {
74 + aliasdatum = (type_datum_t *) malloc(sizeof(type_datum_t));
76 + yyerror("out of memory");
79 + memset(aliasdatum, 0, sizeof(type_datum_t));
80 + aliasdatum->value = t->value;
82 + ret = hashtab_insert(policydbp->p_types.table,
83 + (hashtab_key_t) id, (hashtab_datum_t) aliasdatum);
85 + if (ret == HASHTAB_PRESENT) {
86 + sprintf(errormsg, "name conflict for type alias %s", id);
92 + if (ret == HASHTAB_OVERFLOW) {
93 + yyerror("hash table overflow");
102 static int define_type(int alias)
104 Index: checkpolicy/policy_scan.l
105 ===================================================================
106 RCS file: /nfshome/pal/CVS/selinux-usr/checkpolicy/policy_scan.l,v
107 retrieving revision 1.3
108 diff -u -r1.3 policy_scan.l
109 --- checkpolicy/policy_scan.l 17 Dec 2003 16:52:20 -0000 1.3
110 +++ checkpolicy/policy_scan.l 15 Jan 2004 17:33:23 -0000
112 roles { return(ROLES); }
114 types { return(TYPES); }
116 +typealias { return(TYPEALIAS); }
118 type { return(TYPE); }