Rebase on upstream commit 32611aea6543 See $ cd SELinuxProject/selinux $ git log --pretty=oneline libsepol-3.2..32611aea6543 -- libsepol
47 lines
1.5 KiB
Diff
47 lines
1.5 KiB
Diff
From ce1025bf9ccd2e34a0c12d9a1d8eee19eb415573 Mon Sep 17 00:00:00 2001
|
|
From: James Carter <jwcart2@gmail.com>
|
|
Date: Tue, 15 Jun 2021 16:31:01 -0400
|
|
Subject: [PATCH] libsepol: Quote paths when generating policy.conf from binary
|
|
policy
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Christian Göttsche <cgzones@googlemail.com> submitted a similar patch
|
|
to quote paths when generating CIL policy from a binary policy.
|
|
|
|
Since genfscon and devicetreecon rules have paths which are allowed
|
|
to contain spaces, always quote the path when writing out these rules.
|
|
|
|
Signed-off-by: James Carter <jwcart2@gmail.com>
|
|
Acked-by: Petr Lautrbach <plautrba@redhat.com>
|
|
---
|
|
libsepol/src/kernel_to_conf.c | 4 ++--
|
|
1 file changed, 2 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/libsepol/src/kernel_to_conf.c b/libsepol/src/kernel_to_conf.c
|
|
index 5db47fe4f567..ffdf179a71f3 100644
|
|
--- a/libsepol/src/kernel_to_conf.c
|
|
+++ b/libsepol/src/kernel_to_conf.c
|
|
@@ -2527,7 +2527,7 @@ static int write_genfscon_rules_to_conf(FILE *out, struct policydb *pdb)
|
|
goto exit;
|
|
}
|
|
|
|
- rc = strs_create_and_add(strs, "genfscon %s %s %s", 3,
|
|
+ rc = strs_create_and_add(strs, "genfscon %s \"%s\" %s", 3,
|
|
fstype, name, ctx);
|
|
free(ctx);
|
|
if (rc != 0) {
|
|
@@ -2992,7 +2992,7 @@ static int write_xen_devicetree_rules_to_conf(FILE *out, struct policydb *pdb)
|
|
goto exit;
|
|
}
|
|
|
|
- sepol_printf(out, "devicetreecon %s %s\n", name, ctx);
|
|
+ sepol_printf(out, "devicetreecon \"%s\" %s\n", name, ctx);
|
|
|
|
free(ctx);
|
|
}
|
|
--
|
|
2.32.0
|
|
|