Blame SOURCES/coreutils-8.22-id-groups.patch
|
|
dd59ef |
diff -urNp coreutils-8.4-orig/src/id.c coreutils-8.4/src/id.c
|
|
|
dd59ef |
--- coreutils-8.4-orig/src/id.c 2014-06-26 08:47:28.435047859 +0200
|
|
|
dd59ef |
+++ coreutils-8.4/src/id.c 2014-06-26 08:55:28.352788022 +0200
|
|
|
dd59ef |
@@ -296,8 +296,12 @@ print_full_info (const char *username)
|
|
|
dd59ef |
gid_t *groups;
|
|
|
dd59ef |
int i;
|
|
|
dd59ef |
|
|
|
dd59ef |
- int n_groups = xgetgroups (username, (pwd ? pwd->pw_gid : -1),
|
|
|
dd59ef |
- &groups);
|
|
|
dd59ef |
+ gid_t primary_group;
|
|
|
dd59ef |
+ if (username)
|
|
|
dd59ef |
+ primary_group = pwd ? pwd->pw_gid : -1;
|
|
|
dd59ef |
+ else
|
|
|
dd59ef |
+ primary_group = egid;
|
|
|
dd59ef |
+ int n_groups = xgetgroups (username, primary_group, &groups);
|
|
|
dd59ef |
if (n_groups < 0)
|
|
|
dd59ef |
{
|
|
|
dd59ef |
if (username)
|
|
|
dd59ef |
|
|
|
dd59ef |
diff -urNp coreutils-8.22-orig/tests/id/setgid.sh coreutils-8.22/tests/id/setgid.sh
|
|
|
dd59ef |
--- coreutils-8.22-orig/tests/id/setgid.sh 2014-06-26 08:47:28.750053213 +0200
|
|
|
dd59ef |
+++ coreutils-8.22/tests/id/setgid.sh 2014-06-26 08:51:02.536624404 +0200
|
|
|
dd59ef |
@@ -1,5 +1,5 @@
|
|
|
dd59ef |
#!/bin/sh
|
|
|
dd59ef |
-# Verify that id -G prints the right group when run set-GID.
|
|
|
dd59ef |
+# Verify that id [-G] prints the right group when run set-GID.
|
|
|
dd59ef |
|
|
|
dd59ef |
# Copyright (C) 2012-2013 Free Software Foundation, Inc.
|
|
|
dd59ef |
|
|
|
dd59ef |
@@ -35,4 +35,9 @@ setuidgid -g $gp1 $NON_ROOT_USERNAME env
|
|
|
dd59ef |
compare exp out || fail=1
|
|
|
dd59ef |
# With coreutils-8.16 and earlier, id -G would print both: $gp1 $g
|
|
|
dd59ef |
|
|
|
dd59ef |
+# With coreutils-8.22 and earlier, id would erroneously print groups=$g
|
|
|
dd59ef |
+chroot --user=$NON_ROOT_USERNAME:$gp1 --groups='' / env PATH="$PATH" \
|
|
|
dd59ef |
+ id > out || fail=1
|
|
|
dd59ef |
+grep -F "groups=$gp1" out || fail=1
|
|
|
dd59ef |
+
|
|
|
dd59ef |
Exit $fail
|