From: James Carter <jwcart2@gmail.com>
To: selinux@vger.kernel.org
Cc: dburgener@linux.microsoft.com, James Carter <jwcart2@gmail.com>
Subject: [RFC PATCH 7/9] secilc/secil2tree: Add option to write CIL AST after post processing
Date: Thu, 15 Dec 2022 16:34:27 -0500 [thread overview]
Message-ID: <20221215213429.998948-8-jwcart2@gmail.com> (raw)
In-Reply-To: <20221215213429.998948-1-jwcart2@gmail.com>
This will show the resulting CIL AST after deny rules have been
processed.
Signed-off-by: James Carter <jwcart2@gmail.com>
---
secilc/secil2tree.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/secilc/secil2tree.c b/secilc/secil2tree.c
index e5cdf6bd..ff0fc92b 100644
--- a/secilc/secil2tree.c
+++ b/secilc/secil2tree.c
@@ -45,6 +45,7 @@ enum write_ast_phase {
WRITE_AST_PHASE_PARSE = 0,
WRITE_AST_PHASE_BUILD,
WRITE_AST_PHASE_RESOLVE,
+ WRITE_AST_PHASE_POST,
};
static __attribute__((__noreturn__)) void usage(const char *prog)
@@ -58,7 +59,7 @@ static __attribute__((__noreturn__)) void usage(const char *prog)
printf(" Blocks, blockinherits, blockabstracts, and\n");
printf(" in-statements will not be allowed.\n");
printf(" -A, --ast-phase=<phase> write AST of phase <phase>. Phase must be parse, \n");
- printf(" build, or resolve. (default: resolve)\n");
+ printf(" build, resolve, or post. (default: resolve)\n");
printf(" -v, --verbose increment verbosity level\n");
printf(" -h, --help display usage information\n");
exit(1);
@@ -115,6 +116,8 @@ int main(int argc, char *argv[])
write_ast = WRITE_AST_PHASE_BUILD;
} else if (!strcasecmp(optarg, "resolve")) {
write_ast = WRITE_AST_PHASE_RESOLVE;
+ } else if (!strcasecmp(optarg, "post")) {
+ write_ast = WRITE_AST_PHASE_POST;
} else {
fprintf(stderr, "Invalid AST phase: %s\n", optarg);
usage(argv[0]);
@@ -197,6 +200,9 @@ int main(int argc, char *argv[])
case WRITE_AST_PHASE_RESOLVE:
rc = cil_write_resolve_ast(file, db);
break;
+ case WRITE_AST_PHASE_POST:
+ rc = cil_write_post_ast(file, db);
+ break;
}
if (rc != SEPOL_OK) {
--
2.38.1
next prev parent reply other threads:[~2022-12-15 21:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 21:34 [RFC PATCH 0/9] Add CIL Deny Rule James Carter
2022-12-15 21:34 ` [RFC PATCH 1/9] libsepol/cil: Parse and add deny rule to AST, but do not process James Carter
2022-12-15 21:34 ` [RFC PATCH 2/9] libsepol/cil: Add cil_list_is_empty macro James Carter
2022-12-15 21:34 ` [RFC PATCH 3/9] libsepol/cil: Add cil_tree_remove_node function James Carter
2023-02-03 22:54 ` Daniel Burgener
2023-02-08 21:09 ` James Carter
2022-12-15 21:34 ` [RFC PATCH 4/9] libsepol/cil: Process deny rules James Carter
2023-02-03 22:54 ` Daniel Burgener
2023-02-08 21:57 ` James Carter
2022-12-15 21:34 ` [RFC PATCH 5/9] libsepol/cil: Add cil_write_post_ast function James Carter
2022-12-15 21:34 ` [RFC PATCH 6/9] libsepol: Export the " James Carter
2022-12-15 21:34 ` James Carter [this message]
2022-12-15 21:34 ` [RFC PATCH 8/9] secilc/test: Add a deny rule test James Carter
2023-02-03 22:54 ` Daniel Burgener
2023-02-09 14:31 ` James Carter
2022-12-15 21:34 ` [RFC PATCH 9/9] secilc/docs: Add deny rule to CIL documentation James Carter
2023-02-03 22:55 ` Daniel Burgener
2023-02-09 14:39 ` James Carter
2022-12-16 18:51 ` [RFC PATCH 0/9] Add CIL Deny Rule Daniel Burgener
2022-12-16 20:23 ` James Carter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221215213429.998948-8-jwcart2@gmail.com \
--to=jwcart2@gmail.com \
--cc=dburgener@linux.microsoft.com \
--cc=selinux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.