diff --git a/policycoreutils/audit2allow/audit2allow b/policycoreutils/audit2allow/audit2allow index ffc1f4c9..e9c80f0d 100644 --- a/policycoreutils/audit2allow/audit2allow +++ b/policycoreutils/audit2allow/audit2allow @@ -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 diff --git a/sepolgen/src/sepolgen/module.py b/sepolgen/src/sepolgen/module.py index edd24c6d..5818cecb 100644 --- a/sepolgen/src/sepolgen/module.py +++ b/sepolgen/src/sepolgen/module.py @@ -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