[PATCH 16/74] Fix label substituion to work with the equiv path of

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

File equivalance was not being handled correctly if the equivalence was to /

   This patch looks good to me. acked.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.15 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlJpJyMACgkQrlYvE4MpobPKAQCfZe5FNcG0h/VJ3Jn3AHIKMjAJ
iOgAoM4qXXnTQSClash12LvNwPV4mJjI
=9Bhr
-----END PGP SIGNATURE-----
>From 5ab203209ef51db127b8d598bd36de52ca6fe232 Mon Sep 17 00:00:00 2001
From: Dan Walsh <dwalsh@xxxxxxxxxx>
Date: Wed, 9 Oct 2013 16:20:31 -0400
Subject: [PATCH 16/74] Fix label substituion to work with the equiv path of
 "/"

Software collections are setting up equiv directories to the root directory.
---
 libselinux/src/label.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libselinux/src/label.c b/libselinux/src/label.c
index e629082..0e971ab 100644
--- a/libselinux/src/label.c
+++ b/libselinux/src/label.c
@@ -43,12 +43,18 @@ static void selabel_subs_fini(struct selabel_sub *ptr)
 static char *selabel_sub(struct selabel_sub *ptr, const char *src)
 {
 	char *dst = NULL;
+	int len;
 
 	while (ptr) {
 		if (strncmp(src, ptr->src, ptr->slen) == 0 ) {
 			if (src[ptr->slen] == '/' || 
 			    src[ptr->slen] == 0) {
-				if (asprintf(&dst, "%s%s", ptr->dst, &src[ptr->slen]) < 0)
+				if ((src[ptr->slen] == '/') && 
+				    (strcmp(ptr->dst, "/") == 0))
+					len = ptr->slen + 1;
+				else
+					len = ptr->slen;
+				if (asprintf(&dst, "%s%s", ptr->dst, &src[len]) < 0)
 					return NULL;
 				return dst;
 			}
-- 
1.8.3.1


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux