Skip to content

Commit 20ef6ff

Browse files
cgzonesdburgener
authored andcommitted
Support genfscon partial paths to be a quoted string
Required if the path contains a dot.
1 parent 5aa17d1 commit 20ef6ff

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

src/parse.y

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@
178178
%type<sl> xperm_items
179179
%type<sl> spt_contents
180180
%type<sl> spt_content
181+
%type<string> string_or_quoted_string
181182
%type<string> sl_item
182183
%type<string> xperm_item
183184
%type<sl> arg_list
@@ -484,16 +485,20 @@ strings:
484485
sl_item { $$ = sl_from_str_consume($1); }
485486
;
486487

487-
sl_item:
488+
string_or_quoted_string:
488489
STRING
489490
|
491+
QUOTED_STRING
492+
;
493+
494+
sl_item:
495+
string_or_quoted_string
496+
|
490497
DASH STRING { $$ = xmalloc(sizeof(char) * (strlen($2) + 2));
491498
$$[0] = '-';
492499
$$[1] = '\0';
493500
strcat($$, $2);
494501
free($2);}
495-
|
496-
QUOTED_STRING
497502
;
498503

499504
comma_string_list:
@@ -869,9 +874,9 @@ tunable_block:
869874
;
870875

871876
genfscon:
872-
GENFSCON STRING STRING genfscon_context { free($2); free($3); }
877+
GENFSCON STRING string_or_quoted_string genfscon_context { free($2); free($3); }
873878
|
874-
GENFSCON NUM_STRING STRING genfscon_context { free($2); free($3); }
879+
GENFSCON NUM_STRING string_or_quoted_string genfscon_context { free($2); free($3); }
875880
;
876881

877882
genfscon_context:

tests/sample_policy_files/uncommon.te

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ portcon udp 7007 gen_context(system_u:object_r:afs_bos_port_t,s0,s1:c0.c225)
2020
portcon udp 7007-7008 gen_context(system_u:object_r:afs_bos_port_t,s0)
2121
fs_use_trans devtmpfs gen_context(system_u:object_r:device_t,s0);
2222
genfscon sysfs /devices/system/cpu/online gen_context(system_u:object_r:cpu_online_t,s0)
23+
genfscon cgroup "/system.slice" -d gen_context(system_u:object_r:cgroup_system_slice_t,s0)
2324
fs_use_xattr btrfs gen_context(system_u:object_r:fs_t,s0);
2425
fs_use_task eventpollfs gen_context(system_u:object_r:fs_t,s0);
2526

0 commit comments

Comments
 (0)