Blame SOURCES/acl-2.2.51-getfacl-segv.patch

766e90
From fb071c302b8cad8837bc1e57407dc3ffa14d3f99 Mon Sep 17 00:00:00 2001
766e90
From: Kamil Dudka <kdudka@redhat.com>
766e90
Date: Thu, 31 Oct 2013 19:24:35 +0100
766e90
Subject: [PATCH] libacl: fix SIGSEGV of getfacl -e on overly long group name
766e90
766e90
We simply make sure that at least one tab is used for indentation.
766e90
---
766e90
 libacl/__acl_to_any_text.c |    5 +++++
766e90
 test/root/getfacl.test     |   17 +++++++++++++++++
766e90
 2 files changed, 22 insertions(+), 0 deletions(-)
766e90
 create mode 100644 test/root/getfacl.test
766e90
766e90
diff --git a/libacl/__acl_to_any_text.c b/libacl/__acl_to_any_text.c
766e90
index a4f9c34..1d10e81 100644
766e90
--- a/libacl/__acl_to_any_text.c
766e90
+++ b/libacl/__acl_to_any_text.c
766e90
@@ -247,6 +247,11 @@ acl_entry_to_any_str(const acl_entry_t entry_d, char *text_p, ssize_t size,
766e90
 		    options & TEXT_ALL_EFFECTIVE) {
766e90
 			x = (options & TEXT_SMART_INDENT) ?
766e90
 				((text_p - orig_text_p)/8) : TABS-1;
766e90
+
766e90
+			/* use at least one tab for indentation */
766e90
+			if (x > (TABS-1))
766e90
+				x = (TABS-1);
766e90
+
766e90
 			strncpy(text_p, tabs+x, size);
766e90
 			ADVANCE(TABS-x);
766e90
 
766e90
diff --git a/test/root/getfacl.test b/test/root/getfacl.test
766e90
new file mode 100644
766e90
index 0000000..f84e25d
766e90
--- /dev/null
766e90
+++ b/test/root/getfacl.test
766e90
@@ -0,0 +1,17 @@
766e90
+Make sure that getfacl always adds at least one space between the permissions
766e90
+in an acl entry and the effective permissions comment.
766e90
+
766e90
+	$ umask 022
766e90
+	$ mkdir d
766e90
+	$ groupadd loooooooooooooooooooooooonggroup
766e90
+	$ setfacl -dm group:loooooooooooooooooooooooonggroup:rwx d
766e90
+	$ getfacl -cde d
766e90
+	> user::rwx
766e90
+	> group::r-x	#effective:r-x
766e90
+	> group:loooooooooooooooooooooooonggroup:rwx	#effective:rwx
766e90
+	> mask::rwx
766e90
+	> other::r-x
766e90
+	>
766e90
+
766e90
+	$ groupdel loooooooooooooooooooooooonggroup
766e90
+	$ rm -r d
766e90
-- 
766e90
1.7.1
766e90