[apparmor] [patch 05/26] cleanup/fix escape sequences in the backend and add support for \d

John Johansen john.johansen at canonical.com
Tue Apr 15 21:57:37 UTC 2014


On 04/15/2014 12:33 PM, Seth Arnold wrote:
> On Tue, Apr 15, 2014 at 04:11:06AM -0700, John Johansen wrote:
>> new version
>> - address Seth's feedback
>> - add missing strn_escseq tests
>> - expand strn_escseq to take a 3rd parameter to allow specifying chars to
>>   convert straight across. . eg "+" will cause it to convert \+ as +
>> - fix libapparmor/parse.y failed escape pass through to match processunqoted
>>
>> ---
>>
>> cleanup/fix escape sequences processing
>>
>> Unify escape sequence processing into a set of library fns.
>>
>> Fix the octal escape sequence that was broken, so that short escapes \0,
>> \00 \xa, didn't work and actually resulted in some encoding bugs.
>>
>> Also we were missing support for the decimal # conversion \d123
>>
>> Incorporate and update Steve Beattie's unit tests of escape sequences
>> patch
>>
>> Signed-off-by: John Johansen <john.johansen at canonical.com>
> 
> Acked-by: Seth Arnold <seth.arnold at canonical.com>
> 
> ... With the caveat that I really dislike #if 0 blocks of code; if
> returning -1 rather than '\\' is the right answer, we should stick with
> it and remove the now-needless code block.
> 
It is at least in how it is used now. Originally this was being used in parse.y
to passthrough through a trailing \.  Instead we have a pure is this an escape
sequence fn, and have wrapper code that gets to do with things that look like
escape sequences but aren't.

> Thanks
> 
>> +	char c = *(*pos)++;
>> +	switch(c) {
>> +#if 0
>> +	case '\0':
>> +		(*pos)--;
>> +		return '\\';
>> +#endif
>> +	case '\\':
>> +		return '\\';
> 
> 
> 




More information about the AppArmor mailing list