From: Jim Meyering Date: Wed, 5 Sep 2007 08:57:54 +0000 (+0200) Subject: Adapt to new SELinux behavior: "?" vs. new "unlabeled" X-Git-Tag: v6.9.89~145 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fb836f179d0cb2509aefcf007157e02dd0814b6;p=thirdparty%2Fcoreutils.git Adapt to new SELinux behavior: "?" vs. new "unlabeled" * src/ls.c (gobble_file): Interpret the new "unlabeled" indicator from getfilecon/lgetfilecon the same way we interpret a negative return value: no security context. So we don't print the "+". * tests/selinux: Recognize that "unlabeled" means insufficient support for SELinux, just like "?". --- diff --git a/ChangeLog b/ChangeLog index cf1cffcde9..b8805358ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2007-09-05 Jim Meyering + + Adapt to new SELinux behavior: "?" vs. new "unlabeled" + * src/ls.c (gobble_file): Interpret the new "unlabeled" indicator + from getfilecon/lgetfilecon the same way we interpret a negative + return value: no security context. So we don't print the "+". + * tests/selinux: Recognize that "unlabeled" means insufficient + support for SELinux, just like "?". + 2007-09-03 Jim Meyering Invoke $(AUTOCONF) manually, if needed to get an updated version string. diff --git a/src/ls.c b/src/ls.c index 5eacbad0d4..946e711697 100644 --- a/src/ls.c +++ b/src/ls.c @@ -2651,7 +2651,8 @@ gobble_file (char const *name, enum filetype type, ino_t inode, ? getfilecon (absolute_name, &f->scontext) : lgetfilecon (absolute_name, &f->scontext)); err = (attr_len < 0); - file_has_security_context = (err == 0); + file_has_security_context = + (err == 0 && ! STREQ ("unlabeled", f->scontext)); /* When requesting security context information, don't make ls fail just because the file (even a command line argument) diff --git a/tests/selinux b/tests/selinux index 087658a390..2026a6a985 100644 --- a/tests/selinux +++ b/tests/selinux @@ -1,4 +1,4 @@ -# Is a test expensive? +# Skip this test if there is insufficient SELinux support. # Copyright (C) 2007 Free Software Foundation, Inc. # This program is free software: you can redistribute it and/or modify @@ -14,9 +14,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -test "`ls -Zd .`" = '? .' && - { +case `ls -Zd .` in + '? .'|'unlabeled .') echo "$0: skipping this test; this system (or maybe just" 1>&2 echo " the current file system) lacks SELinux support" 1>&2 (exit 77); exit 77 - } + ;; +esac