summaryrefslogtreecommitdiff
path: root/src/group-list.c
AgeCommit message (Collapse)Author
2015-01-01maint: update all copyright year number rangesPádraig Brady
Run "make update-copyright" and then... * tests/sample-test: Adjust to use the single most recent year. * tests/du/bind-mount-dir-cycle-v2.sh: Fix case in copyright message, so that year is updated automatically in future.
2014-01-02maint: update all copyright year number rangesBernhard Voelker
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2013-09-21id: add -z, --zero optionBernhard Voelker
* src/group-list.h (print_group_list): Add a parameter for the delimiter of type char. * src/group-list.c (print_group_list): Likewise, and use it instead of a white space character to delimit the group entries. * src/groups.c (main): Pass white space character to print_group_list(). * src/id.c (longopts): Add array element for the new long option. (usage): Document the new option. While at it, fix the alignment of the descriptions to match that of HELP_OPTION_DESCRIPTION. (main): Define the bool flag opt_zero indicating the use of the new option. In the getopt_long loop, handle it. Output an error diagnostic in the case the --zero option has been specified together with the default format. In the case of -gG, pass either a NUL or a white space character to print_group_list() - depending on the above new flag. Likewise change the printing of the final newline character: output a NUL instead if the --zero option has been specified. * doc/coreutils.texi (id invocation): Document the new option. While at it, move the @exitstatus macro down after the macro @primaryAndSupplementaryGroups in order to be consistent with other texinfo documents. (groups invocation): Move @exitstatus down after the macro @primaryAndSupplementaryGroups here, too. * tests/misc/id-zero.sh: Add new test exercising the new option. * tests/local.mk (all_tests): Reference it. * NEWS (New features): Mention the new option. Fixes http://bugs.gnu.org/9987
2013-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2012-05-20id,groups: use gidtostr/uidtostr to avoid castsJim Meyering
* src/id.c (gidtostr, uidtostr): Define macros. (gidtostr_ptr, uidtostr_ptr): Define safer functions. Use gidtostr and uidtostr to print GID and UID without need/risk of casts. * src/group-list.c: Likewise.
2012-04-27id,groups: with no user name, print only real and/or effective IDs,Jim Meyering
... i.e., don't use the getpw* functions. Before this change, running groups or id with no user name argument would include a group name or ID from /etc/passwd. Thus, under unusual circumstances (default group is changed, but has not taken effect for a given session), those programs could print a name or ID that is neither real nor effective. To demonstrate, run this: echo 'for i in 1 2; do id -G; sleep 1.5; done' \ |su -s /bin/sh ftp - & sleep 1; perl -pi -e 's/^(ftp:x:\d+):(\d+)/$1:9876/' /etc/passwd Those id -G commands printed the following: 50 50 9876 With this change, they print this: 50 50 Similarly, running those programs set-GID could make them print one ID too many. * src/group-list.c (print_group_list): When username is NULL, pass egid, not getpwuid(ruid)->pw_gid), to xgetgroups, per the API requirements of xgetgroups callee, mgetgroups. When not using the password database, don't call getpwuid. * NEWS (Bug fixes): Mention it. * tests/misc/id-setgid: New file. * tests/Makefile.am (TESTS): Add it. (root_tests): It's a root-only test, so add it here, too. Originally reported by Brynnen Owen as http://bugs.gnu.org/7320. Raised again by Marc Mengel in http://bugzilla.redhat.com/816708.
2012-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2011-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright".
2010-01-01maint: update all FSF copyright year lists to include 2010Jim Meyering
Use this command: git ls-files | grep -v COPYING \ | xargs env UPDATE_COPYRIGHT_USE_INTERVALS=1 \ build-aux/update-copyright
2009-12-04id: handle systems without getgroups supportEric Blake
If getgroups failed with ENOSYS, mgetgroups would unnecessarily fail, and that provoked id into freeing an uninitialized pointer. Meanwhile, we were not using xalloc_die properly. Both issues are better solved in gnulib, by introducing xgetgroups; this patch uses the new interface. Regression introduced by commit 6a31fd8d7. * gnulib: Update, for mgetgroups improvments. * src/id.c (print_full_info): Adjust caller to die on allocation failure, and no longer worry about ENOSYS. * src/group-list.c (print_group_list): Likewise. * src/setuidgid.c (main): Likewise. * NEWS: Mention the fix. * THANKS: Update. Reported by Scott Harrison.
2009-11-13build: update gnulib, for getgroups improvementsEric Blake
A replacement getgroups is now guaranteed to exist, but it may fail with ENOSYS. mgetgroups is moved to gnulib, and now takes gid_t instead of GETGROUPS_T (but setgroups still needs GETGROUPS_T). * gnulib: Update to latest. * gl/modules/mgetgroups: Delete, moved to gnulib. * gl/m4/mgetgroups.m4: Likewise. * gl/lib/mgetgroups.h: Likewise. * gl/lib/mgetgroups.c: Likewise. * src/group-list.c (print_group_list): Adjust callers. * src/id.c (print_full_info): Likewise.
2009-08-25maint: remove Local Variables: indent-tabs-mode: nil from all sourcesJim Meyering
* src/getlimits.c: Likewise. * src/group-list.c: Likewise. * src/groups.c: Likewise. * src/mktemp.c: Likewise. * src/setuidgid.c: Likewise. * src/stdbuf.c: Likewise. * src/timeout.c: Likewise. * src/truncate.c: Likewise. * gl/lib/mbsalign.c: Likewise. * tests/test-lib.sh: Likewise. * bootstrap: Likewise. * README-hacking: Likewise.
2009-01-16simplify mgetgroups() and avoid -Wsign-compare warningsPádraig Brady
* gl/lib/mgetgroups.c: Avoid -Wsign-compare warning by using unsigned types for the parameters of the new function realloc_groupbuf(). mgetgroups() was refactored to use this function rather than explicitly allocating and copying from automatic storage itself. * src/group-list.c: Use int rather than size_t as variable is used in signed comparisons. * src/id.c: ditto.
2008-10-24group-list: avoid compiler warningEric Blake
* src/group-list.c (print_group_list) [!HAVE_GETGROUPS]: Always return value.
2008-03-16Include <getopt.h> only if used.Jim Meyering
* src/group-list.c: Don't include <getopt.h>. * src/printf.c: Likewise.
2008-02-14groups: don't test printf and putchar calls for failureJim Meyering
They are unnecessary, since we use gnulib's closeout module. * src/group-list.c (print_group): Remove explicit error tests. * src/groups.c (main): Likewise. (write_error): Remove function.
2008-02-13Replace groups.sh with groups.c.James Youngman
* src/groups.c (main): New file, replacing groups.sh. * src/group-list.c, src/group-list.h: New files, factored out of id.c, implementing the functionality that "id" and "groups" have in common. * src/id.c (print_full_info): Avoid a segfault when trying to print an error message if getgroups fails. (print_group_list): Move to group-list.c. (print_group): Likewise. * man/Makefile.am: When building groups.1, obtain the help text from src/groups.c, not src/groups.sh. (noinst_HEADERS): Add group-list.h. (group): Remove rule. (dist_man_MANS): Remove groups.1. * doc/coreutils.texi (groups: Print group names a user is in): Explain why "groups" and "groups $(id -un)" give different results in existing login sessions after you change the group database. (id: Print user identity): Likewise for "id". * po/POTFILES.in: Add src/group-list.c and src/groups.c. * NEWS: mention this. * AUTHORS: Update.