summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOndřej Vašík <ovasik@redhat.com>2008-04-23 12:38:54 +0200
committerJim Meyering <meyering@redhat.com>2008-04-23 17:51:44 +0200
commit1a5b6e3a50b25f3af9d3b83ccdfc1db518ba09ca (patch)
treef3dd58aeb9bcdfb57bbd084213b6e006ee25dac4 /src
parent0a4a938b6bf60903475d85cad399f874f8afe51c (diff)
downloadcoreutils-1a5b6e3a50b25f3af9d3b83ccdfc1db518ba09ca.tar.xz
id: do not print SELinux context when invoked with a USERNAME argument
* NEWS: Mention new behaviour. * src/id.c (main): Do not print SELinux context when user is specified. * tests/Makefile.am: Add the new test. * tests/misc/id-context: New file. Test for the fix. Problem reported by Ronny Buchmann in http://bugzilla.redhat.com/443485.
Diffstat (limited to 'src')
-rw-r--r--src/id.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/id.c b/src/id.c
index e4eda4071..92c39fe36 100644
--- a/src/id.c
+++ b/src/id.c
@@ -179,11 +179,11 @@ main (int argc, char **argv)
cannot display context when selinux not enabled or when displaying the id\n\
of a different user"));
- /* If we are on a selinux-enabled kernel, get our context.
- Otherwise, leave the context variable alone - it has
- been initialized known invalid value; if we see this invalid
- value later, we will know we are on a non-selinux kernel. */
- if (selinux_enabled)
+ /* If we are on a selinux-enabled kernel and no user is specified,
+ get our context. Otherwise, leave the context variable alone -
+ it has been initialized known invalid value and will be not
+ displayed in print_full_info() */
+ if (selinux_enabled && argc == optind)
{
if (getcon (&context) && just_context)
error (EXIT_FAILURE, 0, _("can't get process context"));