[apparmor] [patch] [10/38] RE_PATH: allow to match '/'

Christian Boltz apparmor at cboltz.de
Fri Aug 12 20:49:34 UTC 2016


Hello,

RE_PATH expected (simplified) '/.+', however this excludes a plain '/'
that can appear in path rules.

This patch changes the regex so that it also matches '/'.


[ 10-RE_PATH-allow-root.diff ]

=== modified file ./utils/apparmor/regex.py
--- utils/apparmor/regex.py	2016-02-01 21:31:56.427302903 +0100
+++ utils/apparmor/regex.py	2016-01-26 22:22:31.505637218 +0100
@@ -27,7 +27,7 @@
 RE_COMMA_EOL            = '\s*,' + RE_EOL # optional whitespace, comma + RE_EOL
 
 RE_PROFILE_NAME         = '(?P<%s>(\S+|"[^"]+"))'    # string without spaces, or quoted string. %s is the match group name
-RE_PATH                 = '/\S+|"/[^"]+"'  # filename (starting with '/') without spaces, or quoted filename.
+RE_PATH                 = '/\S*|"/[^"]*"'  # filename (starting with '/') without spaces, or quoted filename.
 RE_PROFILE_PATH         = '(?P<%s>(' + RE_PATH + '))'  # quoted or unquoted filename. %s is the match group name
 RE_PROFILE_PATH_OR_VAR  = '(?P<%s>(' + RE_PATH + '|@{\S+}\S*|"@{\S+}[^"]*"))'  # quoted or unquoted filename or variable. %s is the match group name
 




Regards,

Christian Boltz
-- 
>He Mann, isse krasse, erste Wort: "Kyptographie", isse schon falsch.
>Was machst du?
Uuuhhh. Ist in der Listenkasse noch genug Geld für ein Wörterbuch?
[> Ratti und Thorsten Haude in sl-etikette]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20160812/6d37bf9f/attachment.pgp>


More information about the AppArmor mailing list