Skip to contentSkip to conversation

nested {}

DISCUSSION Russell Coker 2 participants 2 messages Apr 20, 2002 – Apr 22, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

I would like to be able to do { file devfile_class_set } but such things currently don't work because checkpolicy doesn't like nested {}.

Could this be changed?

Signature · 9 lines
If you send email to me or to a mailing list that I use which has >4 lines
of legalistic junk at the end then you are specifically authorizing me to do
whatever I wish with the message and all other messages from your domain, by
posting the message you agree that your long legalistic sig is void.

--
You have received this message because you are subscribed to the selinux list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 4 lines · Russell Coker

I would like to be able to do { file devfile_class_set } but such things currently don't work because checkpolicy doesn't like nested {}.

Could this be changed?

So, you want something like the attached patch?

--
Stephen D. Smalley, NAI Labs
[email protected]

Index: module/checkpolicy/policy_parse.y
===================================================================
RCS file: /cvs/lsm/selinux/module/checkpolicy/policy_parse.y,v retrieving revision 1.11

checkpolicy/policy_parse.y +8 -2
diff -u -r1.11 policy_parse.y
@@ -453,7 +453,7 @@
 			;
 names           	: identifier
 			{ if (insert_separator(0)) return -1; }
-			| '{' identifier_list '}'
+			| nested_id_set
 			{ if (insert_separator(0)) return -1; }
 			| asterisk
                         { if (insert_id("*", 0)) return -1; 
@@ -461,7 +461,7 @@
 			| tilde identifier
                         { if (insert_id("~", 0)) return -1;
 			  if (insert_separator(0)) return -1; }
-			| tilde '{' identifier_list '}'
+			| tilde nested_id_set
 	 		{ if (insert_id("~", 0)) return -1; 
 			  if (insert_separator(0)) return -1; }
 			;
@@ -486,6 +486,12 @@
 identifier_list		: identifier
 			| identifier_list identifier
 			;
+nested_id_set           : '{' nested_id_list '}'
+                        ;
+nested_id_list          : nested_id_element | nested_id_list nested_id_element
+                        ;
+nested_id_element       : identifier | nested_id_set
+                        ;
 identifier		: IDENTIFIER
 			{ if (insert_id(yytext,0)) return -1; }
 			;