mirror of
https://github.com/topjohnwu/selinux.git
synced 2024-12-15 07:28:35 +00:00
policycoreutils: sepolgen: audit2allow is mistakakenly not allowing valid module names
module names must begin with a letter, optionally followed by letters, numbers, "-", "_", "."\n' some of these were being denied. Signed-off-by: Eric Paris <eparis@redhat.com> Signed-off-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
adbd558c1c
commit
b1331909a0
@ -104,7 +104,7 @@ class AuditToPolicy:
|
||||
if name:
|
||||
options.requires = True
|
||||
if not module.is_valid_name(name):
|
||||
sys.stderr.write("only letters and numbers allowed in module names\n")
|
||||
sys.stderr.write('error: module names must begin with a letter, optionally followed by letters, numbers, "-", "_", "."\n')
|
||||
sys.exit(2)
|
||||
|
||||
# Make -M and -o conflict
|
||||
|
@ -37,8 +37,8 @@ import shutil
|
||||
def is_valid_name(modname):
|
||||
"""Check that a module name is valid.
|
||||
"""
|
||||
m = re.findall("[^a-zA-Z0-9]", modname)
|
||||
if len(m) == 0:
|
||||
m = re.findall("[^a-zA-Z0-9_\-\.]", modname)
|
||||
if len(m) == 0 and modname[0].isalpha():
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user