Commit Graph

31 Commits

Author SHA1 Message Date
Sami Kerola 1fd15f04b3 newgrp: set function arguments read-only when possible
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:53:01 +00:00
Sami Kerola 51c52acfb1 newgrp: move shell determination closer where it is used
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-01-05 22:53:01 +00:00
Sami Kerola 477135dfec newgrp: simplify if else clauses
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>
2015-01-05 22:53:01 +00:00
Sami Kerola 7d2600e2d0 docs: update deprecation banners
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:11 +02:00
Benno Schulenberg ee7ea5c85e textual: use a somewhat clearer and more standard failure message
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-10-01 09:37:04 +02:00
Sami Kerola 453fc7165d textual: share crypt() error message in sulogin and newgrp
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-09-19 19:31:03 +01:00
Sami Kerola 8f663a674d newgrp: avoid use of obsolete getpass() function
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>
2014-09-19 19:31:03 +01:00
Sami Kerola c829aebc39 newgrp: use libc function to read gshadow if it is available
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>
2014-09-19 19:31:02 +01:00
Sami Kerola 5fb01f4331 newgrp: use xstrdup to check allocation succeeded
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-04-05 13:55:50 +02:00
Sami Kerola 07ff972eb6 translation: unify exec error messages
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-02-06 11:51:17 +01:00
Benno Schulenberg b50945d4ac textual: spell and encode the name of Arkadiusz Miśkiewicz correctly
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-02-06 11:15:02 +01:00
Karel Zak 19a1ca6c0d newgrp: more robust crypt() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-01 18:00:52 +01:00
Sami Kerola 439cdf1e24 login-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:58:34 +02:00
Sami Kerola ba0c903004 docs: add deprecation comments
Markup deprecation to command header to avoid people wasting time in
fixing these utilities.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:03 +01:00
Karel Zak c6f23b3ba1 login: (and chsh) make pw_shell usage more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-02 14:13:45 +01:00
Karel Zak 1f19513b72 newgrp: fix possible FILE leak on error
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-01 13:37:57 +01:00
Sami Kerola b7cfaaf85b newgrp: fix coding style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-29 17:58:00 +01:00
Sami Kerola e947e27360 newgrp: add version and help options
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2011-11-23 21:37:19 +01:00
Fabian Groffen eb76ca98b0 build-sys: provide alternatives for err, errx, warn and warnx
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>
2011-02-14 17:45:24 +01:00
Fabian Groffen 0aeb57aca3 build-sys: improve check for crypt
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>
2011-01-17 16:32:39 +01:00
Marek Polacek 1fa30199c6 newgrp: Use err() and EXIT_*
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>
2010-12-02 17:15:51 +01:00
Karel Zak ad564eadf9 newgrp: use c.h, remove tailing whitespace
Signed-off-by: Karel Zak <kzak@redhat.com>
2009-10-16 01:38:29 +02:00
Karel Zak 66a9411eb0 newgrp: add support for /etc/gshadow
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>
2007-03-21 23:07:25 +01:00
Karel Zak ac70067ae6 newgrp: check result from getgrnam() more carefully
Signed-off-by: Karel Zak <kzak@redhat.com>
2007-03-21 17:29:20 +01:00
Karel Zak 48d7b13a1e Imported from util-linux-2.13-pre1 tarball. 2006-12-07 00:26:54 +01:00
Karel Zak c07ebfa1e0 Imported from util-linux-2.11b tarball. 2006-12-07 00:25:46 +01:00
Karel Zak 66ee8158b6 Imported from util-linux-2.10s tarball. 2006-12-07 00:25:44 +01:00
Karel Zak 7eda085c41 Imported from util-linux-2.9v tarball. 2006-12-07 00:25:39 +01:00
Karel Zak 2b6fc908bc Imported from util-linux-2.8 tarball. 2006-12-07 00:25:35 +01:00
Karel Zak fd6b7a7ffc Imported from util-linux-2.7.1 tarball. 2006-12-07 00:25:34 +01:00
Karel Zak 6dbe3af945 Imported from util-linux-2.2 tarball. 2006-12-07 00:25:32 +01:00