2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 10:07:12 +00:00

parser: split newline and end of rule handling into separate rules

Split the newline processing into a separate rule block so that it can
be shared with states that need to process newlines without processing
end of rule conditions.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/569
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
This commit is contained in:
John Johansen 2020-06-12 02:05:35 -07:00
parent 1a4288886b
commit fffca2ffa0

View File

@ -476,6 +476,7 @@ GT >
\\\n { DUMP_PREPROCESS; current_lineno++ ; } \\\n { DUMP_PREPROCESS; current_lineno++ ; }
\r?\n { \r?\n {
/* don't use shared rule because we need POP() here */
DUMP_PREPROCESS; DUMP_PREPROCESS;
current_lineno++; current_lineno++;
POP(); POP();
@ -702,8 +703,10 @@ include/{WS} {
POP_NODUMP(); POP_NODUMP();
RETURN_TOKEN(TOK_END_OF_RULE); RETURN_TOKEN(TOK_END_OF_RULE);
} }
}
\r?\n { <INITIAL,NETWORK_MODE,RLIMIT_MODE,CHANGE_PROFILE_MODE,MOUNT_MODE,DBUS_MODE,SIGNAL_MODE,PTRACE_MODE,UNIX_MODE,ABI_MODE>{
\r?\n {
DUMP_PREPROCESS; DUMP_PREPROCESS;
current_lineno++; current_lineno++;
} }