summaryrefslogtreecommitdiffstats
path: root/login-utils/newgrp.c
Commit message (Collapse)AuthorAgeFilesLines
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* newgrp: use errexec()Karel Zak2018-02-011-4/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: cosmetics, remove argument from usage(FILE*)Ruediger Meier2017-06-261-7/+8
| | | | | | | | | | | | | | This patch is trivial and changes nothing, because we were always using usage(stdout) Now all our usage() functions look very similar. If wanted we could auto-generate another big cosmetical patch to remove all the useless "FILE *out" constants and use printf and puts rather than their f* friends. Such patch could be automatically synchronized with the translation project (newlines!) to not make the translators sick. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* newgrp: use libc explicit_bzero() when it is availableSami Kerola2017-01-161-0/+6
| | | | | | | This currently new function will be part of glibc 2.25. Reference: https://sourceware.org/git/?p=glibc.git;a=commit;h=ea1bd74defcf9d5291d14972e63105168ca9eb4f Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* newgrp: rename memset_s()Ruediger Meier2016-02-291-2/+2
| | | | | | It's already defined in OSX standard c library. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* scriptreplay/newgrp: use signed int to store return of getopt_longFilipe Brandenburger2016-01-071-1/+1
| | | | Signed-off-by: Filipe Brandenburger <filbranden@google.com>
* textual: add a docstring to most of the utilitiesBenno Schulenberg2015-01-061-0/+4
| | | | | | | | | This adds a concise description of a tool to its usage text. A first form of this patch was proposed by Steven Honeyman (see http://www.spinics.net/lists/util-linux-ng/msg09994.html). Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* newgrp: set function arguments read-only when possibleSami Kerola2015-01-051-3/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* newgrp: move shell determination closer where it is usedSami Kerola2015-01-051-5/+3Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* newgrp: simplify if else clausesSami Kerola2015-01-051-7/+4Star
| | | | | | | | The 'if' clauses that have termination as either of the control flow results will never need 'else'. Making the termination to happen true flow is enough. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: update deprecation bannersSami Kerola2014-10-011-9/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: use a somewhat clearer and more standard failure messageBenno Schulenberg2014-10-011-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: share crypt() error message in sulogin and newgrpSami Kerola2014-09-191-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* newgrp: avoid use of obsolete getpass() functionSami Kerola2014-09-191-1/+47
| | | | | | | | | Read a password from user with termios, and once the password data is no longer needed ensure it gets overwrote before unallocating memory. Reference: http://man7.org/linux/man-pages/man3/getpass.3.html Reference: https://www.securecoding.cert.org/confluence/display/seccode/MSC06-C.+Beware+of+compiler+optimizations Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* newgrp: use libc function to read gshadow if it is availableSami Kerola2014-09-191-0/+11
| | | | | | | The glib versionf of getsgnam() is using /etc/nsswitch.conf, allowing the group passwords to come from external database. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* newgrp: use xstrdup to check allocation succeededSami Kerola2013-04-051-1/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* translation: unify exec error messagesSami Kerola2013-02-061-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: spell and encode the name of Arkadiusz Miƛkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* newgrp: more robust crypt() usageKarel Zak2013-02-011-3/+7
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* login-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* docs: add deprecation commentsSami Kerola2012-03-181-0/+9
| | | | | | | Markup deprecation to command header to avoid people wasting time in fixing these utilities. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* login: (and chsh) make pw_shell usage more robustKarel Zak2012-02-021-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* newgrp: fix possible FILE leak on errorKarel Zak2012-02-011-2/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* newgrp: fix coding styleSami Kerola2011-11-291-113/+119
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* newgrp: add version and help optionsSami Kerola2011-11-231-0/+29
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: provide alternatives for err, errx, warn and warnxFabian Groffen2011-02-141-1/+0Star
| | | | | | | | Solaris lacks err, errx, warn and warnx. This also means the err.h header doesn't exist. Removed err.h include from all files, and included err.h from c.h instead if it exists, otherwise alternatives are provided. Signed-off-by: Fabian Groffen <grobian@gentoo.org>
* build-sys: improve check for cryptFabian Groffen2011-01-171-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | Check for crypt.h existence, and use it if available over using unistd.h for which a certain feature level has to be set to export a definition for crypt. On Solaris this set causes a standards conflict in the headers, because at the time of this check C99 mode is already enabled, which implies certain standards non-compatible with _XOPEN_SOURCE. 92 #define _XOPEN_SOURCE 93 #include <unistd.h> configure:16259: gcc -std=gnu99 -c -g -O2 conftest.c >&5 In file included from /usr/include/unistd.h:18, from conftest.c:93: /prefix/gentoo/usr/lib/gcc/i386-pc-solaris2.10/4.4.5/include-fixed/sys/feature_tests.h:341:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications" configure.ac: improve crypt check login-utils/my_crypt.h: replace old GNU_LIBRARY check with autoconf define for crypt.h [kzak@redhat.com: - remove my_crypt.h] Signed-off-by: Fabian Groffen <grobian@gentoo.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* newgrp: Use err() and EXIT_*Marek Polacek2010-12-021-28/+19Star
| | | | | | | | Use err() or errx() where appropriate. Also use EXIT_* macros instead of 0/1. All error messages shall start with lowercase. Signed-off-by: Marek Polacek <mmpolacek@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* newgrp: use c.h, remove tailing whitespaceKarel Zak2009-10-161-11/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* newgrp: add support for /etc/gshadowKarel Zak2007-03-211-7/+43
| | | | | | | | | | | The original newgrp command doesn't expect group pasword in /etc/gshadow although almost all distributions use this file (and the gpasswd command). The newgrp from util-linux is deprecated and better is use shadow-utils only. Unfortunately, shadow-utils are broken too (see RH version where is bugfix). In this case it's better fix util-linux version at least... Signed-off-by: Karel Zak <kzak@redhat.com>
* newgrp: check result from getgrnam() more carefullyKarel Zak2007-03-211-1/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.13-pre1 tarball.Karel Zak2006-12-071-0/+1
|
* Imported from util-linux-2.11b tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.10s tarball.Karel Zak2006-12-071-0/+1
|
* Imported from util-linux-2.9v tarball.Karel Zak2006-12-071-8/+17
|
* Imported from util-linux-2.8 tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.7.1 tarball.Karel Zak2006-12-071-0/+1
|
* Imported from util-linux-2.2 tarball.Karel Zak2006-12-071-0/+95