Subject: bug#7320: id and groups may lie

From: Jim Meyering <[email-masked]>
Date: Fri, 27 Apr 2012 19:53:53 +0200

Jim Meyering wrote:

> Jim Meyering wrote:
>
>> Marc W. Mengel wrote:
>>> The other test case is to make a copy of "id" and make it
>>> setuid to some user (i.e. mysql) and run it; it will show
>>> itself as having mysql's primary group, even though it doesn't.
>>
>> Oh!  Yes, that will work.  Thanks.
>> With that, I'll add a test like this:
>>
>> New:
>>     $ sudo src/setuidgid -g 3 root src/id -G
>>     3
>>
>> Old:
>>     $ sudo src/setuidgid -g 3 root id -G
>>     3 0
>
> Here's the new test that I'll merge into the actual fix:
>
>>>From d11303c1e643d31aea70e15f79ecf8b55038446a Mon Sep 17 00:00:00 2001
> From: Jim Meyering <[email-masked]>
> Date: Fri, 27 Apr 2012 18:44:08 +0200
> Subject: [PATCH] tests: add a test for the just-fixed id/groups bug
>
> * tests/misc/id-setgid: New file.
> * tests/Makefile.am (TESTS): Add it.
> ---
>  tests/Makefile.am    |    1 +
>  tests/misc/id-setgid |   34 ++++++++++++++++++++++++++++++++++

Nearly missed it.  I'd added a new root-only test
without listing it in the root_tests list.
Once we depend on GNU make, we should be able to automate this.

Folding this in:

>From 7418ab4c137d5fb608ea9cd974aabf5f6a76445e Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email-masked]>
Date: Fri, 27 Apr 2012 19:51:54 +0200
Subject: [PATCH] tests: fix syntax-check failure

* tests/Makefile.am (root_tests): It's a root-only test,
so add it here, too.
---
 tests/Makefile.am |    1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index cd1fc5c..72717e3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -36,6 +36,7 @@ root_tests =					\
   ls/nameless-uid				\
   misc/chcon					\
   misc/chroot-credentials			\
+  misc/id-setgid				\
   misc/selinux					\
   misc/truncate-owned-by-other			\
   mkdir/writable-under-readonly			\
--
1.7.10.365.g7cacb