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:
Dan Walsh 2011-08-30 04:52:18 -04:00 committed by Eric Paris
parent adbd558c1c
commit b1331909a0
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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