All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Carter <jwcart2@tycho.nsa.gov>
To: selinux@tycho.nsa.gov
Subject: [PATCH 2/6] libsepol/cil: Store CIL filename in parse tree and AST
Date: Tue, 19 Apr 2016 10:26:01 -0400	[thread overview]
Message-ID: <1461075965-17161-3-git-send-email-jwcart2@tycho.nsa.gov> (raw)
In-Reply-To: <1461075965-17161-1-git-send-email-jwcart2@tycho.nsa.gov>

Use some of the functionality recently added to support high-level
language line marking to track the CIL filename.

The goal is to eventually remove the path field from the tree node
struct and offset the addtion of the hll_line field.

Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
---
 libsepol/cil/src/cil_parser.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/libsepol/cil/src/cil_parser.c b/libsepol/cil/src/cil_parser.c
index 23d1466..bf1c213 100644
--- a/libsepol/cil/src/cil_parser.c
+++ b/libsepol/cil/src/cil_parser.c
@@ -179,6 +179,24 @@ exit:
 	return SEPOL_ERR;
 }
 
+static void add_cil_path(struct cil_tree_node **current, char *path)
+{
+	struct cil_tree_node *node;
+
+	create_node(&node, *current, 0, 0, path, NULL);
+	insert_node(node, *current);
+	*current = node;
+
+	create_node(&node, *current, 0, 0, path, CIL_KEY_SRC_INFO);
+	insert_node(node, *current);
+
+	create_node(&node, *current, 0, 0, path, CIL_KEY_SRC_CIL);
+	insert_node(node, *current);
+
+	create_node(&node, *current, 0, 0, path, path);
+	insert_node(node, *current);
+}
+
 int cil_parser(char *_path, char *buffer, uint32_t size, struct cil_tree **parse_tree)
 {
 
@@ -205,6 +223,8 @@ int cil_parser(char *_path, char *buffer, uint32_t size, struct cil_tree **parse
 	tree = *parse_tree;
 	current = tree->root;
 
+	add_cil_path(&current, path);
+
 	do {
 		cil_lexer_next(&tok);
 		switch (tok.type) {
-- 
2.5.5

  parent reply	other threads:[~2016-04-19 14:24 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-19 14:25 [PATCH 0/6] ibsepol/cil: Add high-level language line marking support James Carter
2016-04-19 14:26 ` [PATCH 1/6] libsepol/cil: " James Carter
2016-04-20 14:42   ` Steve Lawrence
2016-04-20 18:40     ` James Carter
2016-04-19 14:26 ` James Carter [this message]
2016-04-19 14:26 ` [PATCH 3/6] libsepol/cil: Add cil_tree_log() and supporting functions James Carter
2016-04-20 14:47   ` Steve Lawrence
2016-04-20 19:10     ` James Carter
2016-04-19 14:26 ` [PATCH 4/6] libsepol/cil: Replace cil_log() calls with cil_tree_log() James Carter
2016-04-19 14:26 ` [PATCH 5/6] libsepol/cil: Remove path field from cil_tree_node struct James Carter
2016-04-20 14:48   ` Steve Lawrence
2016-04-20 19:36     ` James Carter
2016-04-19 14:26 ` [PATCH 6/6] libsepol: When generating CIL use HLL line mark for neverallows 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=1461075965-17161-3-git-send-email-jwcart2@tycho.nsa.gov \
    --to=jwcart2@tycho.nsa.gov \
    --cc=selinux@tycho.nsa.gov \
    /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.