Skip to contentSkip to conversation

python/sepolgen: accept square brackets in FILENAME token

PATCH New Christian Göttsche 2 participants 4 messages Feb 14, 2022 – Mar 3, 2022 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 python/sepolgen: accept square brackets in FILENAME token

When parsing Reference Policy style files accept square brackets in file names. The FILENAME token is used in the TYPE_TRANSITION grammar rule for the optional name based argument. This name can contain square brackets, e.g. for anonymous inodes like "[io_uring]".

---
 python/sepolgen/src/sepolgen/refparser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
python/sepolgen/src/sepolgen/refparser.py +1 -1
index e611637f..1bb90564 100644
@@ -261,7 +261,7 @@ def t_IDENTIFIER(t):
     return t
 
 def t_FILENAME(t):
-    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :]+\"'
+    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :\[\]]+\"'
     # Handle any keywords
     t.type = reserved.get(t.value,'FILENAME')
     return t
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 python/sepolgen: accept square brackets in FILENAME token

When parsing Reference Policy style files accept square brackets in file names. The FILENAME token is used in the TYPE_TRANSITION grammar rule for the optional name based argument. This name can contain square brackets, e.g. for anonymous inodes like "[io_uring]".

---
added missing signed-off

---
 python/sepolgen/src/sepolgen/refparser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
python/sepolgen/src/sepolgen/refparser.py +1 -1
index e611637f..1bb90564 100644
@@ -261,7 +261,7 @@ def t_IDENTIFIER(t):
     return t
 
 def t_FILENAME(t):
-    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :]+\"'
+    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :\[\]]+\"'
     # Handle any keywords
     t.type = reserved.get(t.value,'FILENAME')
     return t
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#2 lore raw
Quoted 7 lines · Christian Göttsche

When parsing Reference Policy style files accept square brackets in file names. The FILENAME token is used in the TYPE_TRANSITION grammar rule for the optional name based argument. This name can contain square brackets, e.g. for anonymous inodes like "[io_uring]".

Quoted 22 lines

---
added missing signed-off

---
 python/sepolgen/src/sepolgen/refparser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
python/sepolgen/src/sepolgen/refparser.py +1 -2
index e611637f..1bb90564 100644
@@ -261,7 +261,7 @@ def t_IDENTIFIER(t):
     return t
 
 def t_FILENAME(t):
-    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :]+\"'
+    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :\[\]]+\"'
     # Handle any keywords
     t.type = reserved.get(t.value,'FILENAME')
     return t
--

2.34.1

#3 lore raw
Quoted 4 lines · James Carter
Quoted 1 line · Christian Göttsche
Quoted 9 lines
Quoted 6 lines

When parsing Reference Policy style files accept square brackets in file names. The FILENAME token is used in the TYPE_TRANSITION grammar rule for the optional name based argument. This name can contain square brackets, e.g. for anonymous inodes like "[io_uring]".

Merged.
Thanks,
Jim

Quoted 22 lines
Quoted 22 lines

---
added missing signed-off

---
 python/sepolgen/src/sepolgen/refparser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
python/sepolgen/src/sepolgen/refparser.py +1 -2
index e611637f..1bb90564 100644
@@ -261,7 +261,7 @@ def t_IDENTIFIER(t):
     return t
 
 def t_FILENAME(t):
-    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :]+\"'
+    r'\"[a-zA-Z0-9_\-\+\.\$\*~ :\[\]]+\"'
     # Handle any keywords
     t.type = reserved.get(t.value,'FILENAME')
     return t
--

2.34.1