Apparmor parser fails w/cx rules and CRLF line endings

Bug #1306876 reported by Steve Beattie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
AppArmor
Triaged
Medium
Unassigned

Bug Description

The following profile should not cause the parser to fail:

$ file cx_dos_line_endings_1.sd
cx_dos_line_endings_1.sd: ASCII text, with CRLF line terminators
$ cat -n cx_dos_line_endings_1.sd
     1 #
     2 #=DESCRIPTION cx w/ dos line endings
     3 #=EXRESULT PASS
     4 #
     5 /usr/bin/foo {
     6 /bin/cat cx,
     7 /bin/foo Cx,
     8
     9 unsafe cx /bin/bar,
    10 cx /bin/a,
    11
    12 profile /bin/cat {
    13 /bin/cat mr,
    14 }
    15
    16 profile /bin/a {
    17 /bin/a mr,
    18 /tmp/slurp* rw,
    19 }
    20
    21 }
$../../../apparmor_parser -qQ cx_dos_line_endings_1.sd
AppArmor parser error for cx_dos_line_endings_1.sd in cx_dos_line_endings_1.sd at line 10: syntax error, unexpected TOK_MODE, expecting TOK_END_OF_RULE

Note that the same file with regular unix LF line endings parses okay:

$ file simple_ok_cx_1.sd
simple_ok_cx_1.sd: ASCII text
$ cat -n simple_ok_cx_1.sd
     1 #
     2 #=DESCRIPTION test cx
     3 #=EXRESULT PASS
     4 #
     5 /usr/bin/foo {
     6 /bin/cat cx,
     7 /bin/foo Cx,
     8
     9 unsafe cx /bin/bar,
    10 cx /bin/a,
    11
    12 profile /bin/cat {
    13 /bin/cat mr,
    14 }
    15
    16 profile /bin/a {
    17 /bin/a mr,
    18 /tmp/slurp* rw,
    19 }
    20 }
$ ../../../apparmor_parser -qQ simple_ok_cx_1.sd
$

Tags: aa-parser
Steve Beattie (sbeattie)
Changed in apparmor:
importance: Undecided → Medium
Changed in apparmor:
status: New → Triaged
tags: added: aa-parser
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.