mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
parser: fix xattr match encoding so optional xattr is distinct
Make sure we can support optional xattrs distinct from optional xattr values in the encoding. Currently all xattrs specified are required to be present even if there value is not specified. However under the old encoding there was no way to distinguish if the presence of the xattr vs. the xattr having a null length value. Fix this so that if we decide to support optional xattrs it is possible without having to change the abi. Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
parent
2416faac54
commit
e13af5dc96
1 changed files with 14 additions and 0 deletions
|
@ -542,6 +542,20 @@ static int process_profile_name_xmatch(Profile *prof)
|
|||
*/
|
||||
int len;
|
||||
tbuf.clear();
|
||||
/* prepend \x00 to every value. This is
|
||||
* done to separate the existance of the
|
||||
* xattr from a null value match.
|
||||
*
|
||||
* if an xattr exists, a single \x00 will
|
||||
* be done before matching any of the
|
||||
* xattr_value data.
|
||||
*
|
||||
* the pattern for a required xattr
|
||||
* \x00{value_match}\x-1
|
||||
* optional xattr (null alternation)
|
||||
* {\x00{value_match},}\x-1
|
||||
*/
|
||||
tbuf.append("\\x00");
|
||||
convert_aaregex_to_pcre(xattr_value, 0,
|
||||
glob_null, tbuf,
|
||||
&len);
|
||||
|
|
Loading…
Add table
Reference in a new issue