diff options
author | Ondřej Vašík <ovasik@redhat.com> | 2008-04-23 12:38:54 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2008-04-23 17:51:44 +0200 |
commit | 1a5b6e3a50b25f3af9d3b83ccdfc1db518ba09ca (patch) | |
tree | f3dd58aeb9bcdfb57bbd084213b6e006ee25dac4 /src | |
parent | 0a4a938b6bf60903475d85cad399f874f8afe51c (diff) | |
download | coreutils-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.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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")); |