]> git.ipfire.org Git - thirdparty/shadow.git/log
thirdparty/shadow.git
3 years agolibmisc: use /dev/urandom as a generic fallback for read_random_bytes()
Xi Ruoyao [Mon, 13 Jun 2022 08:44:14 +0000 (16:44 +0800)] 
libmisc: use /dev/urandom as a generic fallback for read_random_bytes()

On systems with Linux kernel < 3.17, getentropy() and getrandom() may
exist but return ENOSYS.  Use /dev/urandom as a fallback to avoid a hard
requirement on Linux kernel version.

Fixes #512.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
3 years agoCI: update actions version
Iker Pedrosa [Wed, 1 Jun 2022 11:22:22 +0000 (13:22 +0200)] 
CI: update actions version

CodeQL Action v1 is being deprecated and v2 needs to be used instead.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoCI: enable CodeQL analyzer
Iker Pedrosa [Mon, 9 May 2022 14:06:38 +0000 (16:06 +0200)] 
CI: enable CodeQL analyzer

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoCI: create Github workflow to install dependencies
Iker Pedrosa [Mon, 9 May 2022 14:17:57 +0000 (16:17 +0200)] 
CI: create Github workflow to install dependencies

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoComplete Ukrainian translation
Yuri Chornoivan [Sat, 21 May 2022 17:49:25 +0000 (20:49 +0300)] 
Complete Ukrainian translation

3 years agoUpdate Ukrainian translation
Yuri Chornoivan [Fri, 20 May 2022 18:46:54 +0000 (21:46 +0300)] 
Update Ukrainian translation

3 years agoAdd Ukrainian translation for man pages
Yuri Chornoivan [Thu, 19 May 2022 19:01:55 +0000 (22:01 +0300)] 
Add Ukrainian translation for man pages

3 years agoInitialize local variables
Iker Pedrosa [Mon, 16 May 2022 15:24:58 +0000 (17:24 +0200)] 
Initialize local variables

CWE-457 by CodeQL.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoAdd header guards
Iker Pedrosa [Tue, 10 May 2022 13:26:15 +0000 (15:26 +0200)] 
Add header guards

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoRemove commented out code and FIXMEs
Iker Pedrosa [Tue, 10 May 2022 13:01:21 +0000 (15:01 +0200)] 
Remove commented out code and FIXMEs

In order to remove some of the FIXMEs it was necessary to change the
code and call getulong() instead of getlong().

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoRemove redeclared variable
Iker Pedrosa [Tue, 10 May 2022 11:23:07 +0000 (13:23 +0200)] 
Remove redeclared variable

No need to redeclare a variable with the same name and type. Just keep
the one with the biggest scope.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoUpdate Ukrainian translation
Yuri Chornoivan [Mon, 16 May 2022 16:38:39 +0000 (19:38 +0300)] 
Update Ukrainian translation

3 years agotests: replace egrep -> grep -E
Sam James [Sun, 15 May 2022 01:37:11 +0000 (01:37 +0000)] 
tests: replace egrep -> grep -E

"egrep" is an obsolete alias for grep -E and newer greps will warn on usage
of egrep, so let's just swap it out.

Signed-off-by: Sam James <sam@gentoo.org>
3 years agoconfigure: replace obsolete autoconf macros
Christian Göttsche [Mon, 9 May 2022 16:36:02 +0000 (18:36 +0200)] 
configure: replace obsolete autoconf macros

Replace
 AC_HELP_STRING by AS_HELP_STRING,
 AC_GNU_SOURCE by AC_USE_SYSTEM_EXTENSIONS,
 AC_TRY_COMPILE by AC_COMPILE_IFELSE and
 AM_PROG_LIBTOOL by LT_INIT.

See https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html

3 years agosrc: correct "badname" option
Iker Pedrosa [Wed, 4 May 2022 07:33:59 +0000 (09:33 +0200)] 
src: correct "badname" option

Change "badnames" to "badname" as this is the accepted option name.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoman: correct "badname" option
Iker Pedrosa [Wed, 27 Apr 2022 14:59:03 +0000 (16:59 +0200)] 
man: correct "badname" option

Change "badnames" to "badname" as this is the accepted option name.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agopo: update translation files
Iker Pedrosa [Wed, 27 Apr 2022 14:53:39 +0000 (16:53 +0200)] 
po: update translation files

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoSuggest badname if name has special characters
Iker Pedrosa [Tue, 26 Apr 2022 14:45:04 +0000 (16:45 +0200)] 
Suggest badname if name has special characters

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2076819

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agopasswd: erase password copy on all error branches
Christian Göttsche [Mon, 25 Apr 2022 10:17:40 +0000 (12:17 +0200)] 
passwd: erase password copy on all error branches

3 years agousermod: fix alphabetical order in help message
Matheus Marques [Sun, 24 Apr 2022 19:16:58 +0000 (16:16 -0300)] 
usermod: fix alphabetical order in help message

3 years agoWork around git safe.directory enforcement
Serge Hallyn [Mon, 25 Apr 2022 15:42:41 +0000 (10:42 -0500)] 
Work around git safe.directory enforcement

Git wants to ensure that you do not read .git owned by other users.
But we fetch+build as 'build' user, and run tests as root user.  Those
tests calculate git topdir using git rev-parse --show-toplevel, which
git now fails.

Setting safe.directory, seems wrong.  Let's just use bash to figure
out the top dir.

3 years agochpasswd: add IS_CRYPT_METHOD
juyin [Sat, 2 Apr 2022 03:48:51 +0000 (11:48 +0800)] 
chpasswd: add IS_CRYPT_METHOD

Use macro IS_CRYPT_METHOD instead of ’strcmp(crypt_method, xx)==0’ to make the code more cleanup

3 years agorefactor get_salt function
juyin [Fri, 1 Apr 2022 01:26:29 +0000 (09:26 +0800)] 
refactor get_salt function

refactor get_salt function to make it easier to read.

3 years agochpasswd: fix function problem with -R parameter
juyin [Thu, 31 Mar 2022 08:48:52 +0000 (16:48 +0800)] 
chpasswd: fix function problem with -R parameter

Generating salt value depends on /dev/urandom. But after the
function process_root_flag changed the root directory, It does
not exist.

So, generate salt value before changeing the directory.

Fixes: #514
3 years agochpasswd: add get_salt for generating salt value
juyin [Thu, 31 Mar 2022 08:45:19 +0000 (16:45 +0800)] 
chpasswd: add get_salt for generating salt value

The function that generates the salt value is extracted separately, and it is more convenient to modify it later.

3 years agolibmisc: add check fopen return value in read_random_bytes()
juyin [Wed, 30 Mar 2022 11:21:32 +0000 (19:21 +0800)] 
libmisc: add check fopen return value in read_random_bytes()

Returns null when fopen fails. Then, using fread with a null pointer will cause a segfault.

Signed-off-by: Yan Zhu <zhuyan34@huawei.com>
3 years agoHandle ERANGE error correctly
Niko [Tue, 1 Mar 2022 13:43:07 +0000 (14:43 +0100)] 
Handle ERANGE error correctly

The reentrant functions getgrgid_r, getgrnam_r, getpwnam_r, etc. all return an error code instead of setting errno. Adapt the error check accordingly.

3 years agoAUTHORS: improve markdown output
Iker Pedrosa [Tue, 15 Mar 2022 08:29:04 +0000 (09:29 +0100)] 
AUTHORS: improve markdown output

The markdown output for the maintainers, authors and contributors list
was wrapped in a single line and it was difficult to read. I've created
an unordered list to get a better output. On top of that I've also added
myself as a maintainer.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoChange to strncat
Steve Grubb [Fri, 18 Mar 2022 19:35:02 +0000 (15:35 -0400)] 
Change to strncat

ut_line is declared as a nonstring in bits/utmp.h. It might not be NUL
terminated. Limit how much it copies to the size of the array.

3 years agoFix code comment
ed neville [Sat, 12 Mar 2022 08:22:31 +0000 (08:22 +0000)] 
Fix code comment

Improving check around pw_dir which may be NULL

3 years agoCI: add fedora to build
Iker Pedrosa [Fri, 11 Mar 2022 14:38:13 +0000 (15:38 +0100)] 
CI: add fedora to build

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoFix syntax error in usermod man source.
Adam Sampson [Mon, 7 Mar 2022 23:51:18 +0000 (23:51 +0000)] 
Fix syntax error in usermod man source.

Signed-off-by: Adam Sampson <ats@offog.org>
3 years agoImprove groupadd and useradd manpage
Markus Hiereth [Mon, 7 Mar 2022 00:48:22 +0000 (18:48 -0600)] 
Improve groupadd and useradd manpage

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoupdate useradd homepage
Markus Hiereth [Mon, 7 Mar 2022 00:37:39 +0000 (18:37 -0600)] 
update useradd homepage

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoManpage improvements for usermod
Markus Hiereth [Mon, 7 Mar 2022 00:12:13 +0000 (18:12 -0600)] 
Manpage improvements for usermod

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoImprove groups and id manpages
Markus Hiereth [Sun, 6 Mar 2022 23:59:41 +0000 (17:59 -0600)] 
Improve groups and id manpages

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoImprove pwck manpage
Markus Hiereth [Sun, 6 Mar 2022 23:53:02 +0000 (17:53 -0600)] 
Improve pwck manpage

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
3 years agofix PAM service files --without-selinux
Ali Riza KESKIN [Fri, 4 Mar 2022 11:48:54 +0000 (11:48 +0000)] 
fix PAM service files --without-selinux

Make pam_selinux.so optional in environments where the module isn't provided.

3 years agoconfigure.ac: Default to max group name length of 32
Jami Kettunen [Fri, 18 Feb 2022 05:20:20 +0000 (07:20 +0200)] 
configure.ac: Default to max group name length of 32

This used to be 16 for historical reasons but these days basically every
distro configures --with-group-name-max-length=32 to make it match the
max Linux username length, make it default.

Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com>
3 years agoUpdate Spanish translation
feer9 [Mon, 14 Feb 2022 20:19:42 +0000 (17:19 -0300)] 
Update Spanish translation

3 years agoUpdate Spanish translation
Fernando [Mon, 14 Feb 2022 00:43:23 +0000 (21:43 -0300)] 
Update Spanish translation

I changed the order of some words to be easier to understand

3 years agoconfigure.ac: fix occurance of with-pam (should be with-libpam)
Serge Hallyn [Fri, 4 Feb 2022 18:28:18 +0000 (12:28 -0600)] 
configure.ac: fix occurance of with-pam (should be with-libpam)

Closes #500

Reported-by: dpa-github@aegee.org
Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agopo/fr.po: Fix a few typos
Balint Reczey [Wed, 26 Jan 2022 16:53:28 +0000 (17:53 +0100)] 
po/fr.po: Fix a few typos

3 years agoUpdated French translations
bubu [Wed, 26 Jan 2022 16:36:44 +0000 (17:36 +0100)] 
Updated French translations

Proofread by the debian-l10n-french mailing list contributors.

Link: https://bugs.debian.org/1004242
3 years agoMake libsubid more easily usable from C++
Alois Wohlschlager [Wed, 19 Jan 2022 10:39:53 +0000 (11:39 +0100)] 
Make libsubid more easily usable from C++

C++ requires extern "C" linkage specification to call functions from a C
library. Enclose the function definitions in subid.h in an extern "C"
block if compiling in C++ mode to achieve this.

Signed-off-by: Alois Wohlschlager <alois1@gmx-topmail.de>
3 years agouseradd: modify check ID range for system users
Iker Pedrosa [Tue, 4 Jan 2022 12:06:00 +0000 (13:06 +0100)] 
useradd: modify check ID range for system users

useradd warns that a system user ID less than SYS_UID_MIN is outside the
expected range, even though that ID has been specifically selected with
the "-u" option.

In my opinion all the user ID's below SYS_UID_MAX are for the system,
thus I change the condition to take that into account.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2004911

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agonss: get shadow_logfd with log_get_logfd()
Iker Pedrosa [Mon, 10 Jan 2022 14:30:28 +0000 (15:30 +0100)] 
nss: get shadow_logfd with log_get_logfd()

If /etc/nsswitch.conf doesn't exist podman crashes because shadow_logfd
is NULL. In order to avoid that load the log file descriptor with the
log_get_logfd() helper function.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2038811

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoUse 'void' instead of 'RETSIGTYPE'. Use 'sighandler_t' too.
Alejandro Colomar [Thu, 30 Dec 2021 15:36:18 +0000 (16:36 +0100)] 
Use 'void' instead of 'RETSIGTYPE'.  Use 'sighandler_t' too.

C89 and POSIX.1-2001 define signal(2) as returning a pointer to a
function returning 'void'.  K&R C signal(2) signature is obsolete.
Use 'void' directly.

Also, instead of writing the function pointer type explicitly, use
POSIX's 'sighandler_t'.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove AC_HEADER_TIME and TIME_WITH_SYS_TIME checks
Alejandro Colomar [Thu, 30 Dec 2021 15:12:15 +0000 (16:12 +0100)] 
Remove AC_HEADER_TIME and TIME_WITH_SYS_TIME checks

Systems on which <sys/time.h> conflicted with <time.h> are obsolete.

This macro has been marked as obsolete by autoconf documentation.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoautoconf: Remove check for struct stat.st_rdev
Alejandro Colomar [Thu, 30 Dec 2021 15:04:38 +0000 (16:04 +0100)] 
autoconf: Remove check for struct stat.st_rdev

It is defined by POSIX.1-2001.  Let's assume it always exists.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoautoconf: Remove AC_C_CONST
Alejandro Colomar [Thu, 30 Dec 2021 14:52:04 +0000 (15:52 +0100)] 
autoconf: Remove AC_C_CONST

All current compilers support C89's 'const' keyword.
Autoconf declares this macro as obsolescent.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove AC_HEADER_STAT and STAT_MACROS_BROKEN
Alejandro Colomar [Thu, 30 Dec 2021 14:47:22 +0000 (15:47 +0100)] 
Remove AC_HEADER_STAT and STAT_MACROS_BROKEN

As autoconf documentation says, this macro is obsolescent, as no
current systems have the bug in S_ISDIR, S_ISREG, etc..
The affected systems were Tektronix UTekV, Amdahl UTS, and
Motorola System V/88.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoautoconf: Remove AC_ISC_POSIX
Alejandro Colomar [Thu, 30 Dec 2021 14:32:17 +0000 (15:32 +0100)] 
autoconf: Remove AC_ISC_POSIX

INTERACTIVE Systems Corporation Unix is no longer sold, and Sun
said (long ago) that it would drop support for it on 2006-07-23.
So this macro has been obsolete for more than a decade.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoautoconf: Remove AC_TYPE_MODE_T
Alejandro Colomar [Thu, 30 Dec 2021 14:15:50 +0000 (15:15 +0100)] 
autoconf: Remove AC_TYPE_MODE_T

'mode_t' is defined by POSIX.1-2001 in <sys/types.h>.
It's unlikely to be missing.

See mode_t(3).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoautoconf: Remove AC_TYPE_PID_T
Alejandro Colomar [Thu, 30 Dec 2021 14:15:50 +0000 (15:15 +0100)] 
autoconf: Remove AC_TYPE_PID_T

'pid_t' is defined by POSIX.1-2001 in <sys/types.h>.
It's unlikely to be missing.

See pid_t(3).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoautoconf: Remove AC_TYPE_OFF_T
Alejandro Colomar [Thu, 30 Dec 2021 14:15:50 +0000 (15:15 +0100)] 
autoconf: Remove AC_TYPE_OFF_T

'off_t' is defined by POSIX.1-2001 in <sys/types.h>.
It's unlikely to be missing.

See off_t(3).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoautoconf: Remove AC_TYPE_UID_T
Alejandro Colomar [Thu, 30 Dec 2021 14:15:50 +0000 (15:15 +0100)] 
autoconf: Remove AC_TYPE_UID_T

'uid_t' is defined by POSIX.1-2001 in <sys/types.h>.
It's unlikely to be missing.

See uid_t(3).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove unused autoconf check: ruserok(3)
Alejandro Colomar [Thu, 30 Dec 2021 14:10:01 +0000 (15:10 +0100)] 
Remove unused autoconf check: ruserok(3)

The macro HAVE_RUSEROK is not being used anywhere.

As the Linux manual page says, ruserok(3) is present on the BDSs, Solaris, and many other systems.  This function appeared in 4.2BSD.  So we probably can rely on its existence.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove unused autoconf check: getaddrinfo(3)
Alejandro Colomar [Thu, 30 Dec 2021 14:05:47 +0000 (15:05 +0100)] 
Remove unused autoconf check: getaddrinfo(3)

The macro HAVE_GETADDRINFO is not being used anywhere.

BTW, the function is defined by POSIX.1-2001 and RFC 2553, so it's likely that it is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove unused autoconf check: sigaction(3)
Alejandro Colomar [Thu, 30 Dec 2021 14:02:02 +0000 (15:02 +0100)] 
Remove unused autoconf check: sigaction(3)

The macro HAVE_SIGACTION is not being used anywhere.

BTW, the function is defined by SVr4 and POSIX.1-2001, so it's likely that it is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove unused autoconf check: gettimeofday(3)
Alejandro Colomar [Thu, 30 Dec 2021 13:56:52 +0000 (14:56 +0100)] 
Remove unused autoconf check: gettimeofday(3)

The macro HAVE_GETTIMEOFDAY is not being used anywhere.

BTW, the function is defined by SVr4, 4.3BSD, and POSIX.1-2001, so
it's likely that it is always available.

POSIX.1-2008 marks it as obsolete, but only because
clock_gettime(2) provides more precission.  Since gettimeofday(3)
is in use by many big projects, and it has no obvious dangers,
it's likely that it will continue to exist even if it's outside of
the POSIX standard.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove unused autoconf check: gethostname(3)
Alejandro Colomar [Thu, 30 Dec 2021 13:50:04 +0000 (14:50 +0100)] 
Remove unused autoconf check: gethostname(3)

The macro HAVE_GETHOSTNAME is not being used anywhere.

BTW, the function is defined by SVr4, 4.4BSD, and POSIX.1-2001, so
it's likely that it is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove unused autoconf check: dlopen(3)
Alejandro Colomar [Thu, 30 Dec 2021 13:43:46 +0000 (14:43 +0100)] 
Remove unused autoconf check: dlopen(3)

BTW, it was unnecessary, since POSIX.1-2001 defines the function.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove unused autoconf check: strchr(3)
Alejandro Colomar [Thu, 30 Dec 2021 13:37:27 +0000 (14:37 +0100)] 
Remove unused autoconf check: strchr(3)

The only place where the check was used was removed in 4e1afcd66.

BTW, it was unnecessary, since strchr(3) is defined by:
POSIX.1-2001, C89, SVr4, and 4.3BSD.  Enough to rely on it.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove AC_HEADER_SYS_WAIT
Alejandro Colomar [Thu, 30 Dec 2021 13:25:49 +0000 (14:25 +0100)] 
Remove AC_HEADER_SYS_WAIT

GNU autoconf documentation marks this macro as obsolescent, as
current systems are compatible with POSIX.

Simplify code to unconditionally include <sys/wait.h>, and don't
redefine WIFEXITSTATUS() and WIFEXITED(), since they are mandated
by POSIX.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove old compatibility DIRECT macro.
Alejandro Colomar [Thu, 30 Dec 2021 13:13:36 +0000 (14:13 +0100)] 
Remove old compatibility DIRECT macro.

Use struct dirent directly.  See parent commit.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove AC_HEADER_DIRENT
Alejandro Colomar [Thu, 30 Dec 2021 13:09:29 +0000 (14:09 +0100)] 
Remove AC_HEADER_DIRENT

POSIX.1-2001 defines 'struct dirent' in <dirent.h>.  It replaces
the old 'struct direct' found in BSDs.  All of the systems that I
checked (including FreeBSD, NetBSD, and OpenBSD), now provide
<dirent.h> with 'struct dirent', as mandated by POSIX.

Since autoconf first checks <dirent.h> and only if it's missing it
checks other header files, it's clear that it will always find
<dirent.h>, so let's simplify.

GNU autoconf documentation declares this macro as obsolescent, and
acknowledges that all current systems with directory libraries
have <dirent.h>:
<https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Particular-Headers.html>

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoMerge pull request #487 from cgzones/misc_warnings
Serge Hallyn [Mon, 3 Jan 2022 15:45:12 +0000 (09:45 -0600)] 
Merge pull request #487 from cgzones/misc_warnings

Resolve several compiler warnings

3 years agoMerge pull request #481 from alejandro-colomar/STDC_HEADERS
Serge Hallyn [Mon, 3 Jan 2022 15:37:06 +0000 (09:37 -0600)] 
Merge pull request #481 from alejandro-colomar/STDC_HEADERS

Assume C89 is available

3 years agoMerge pull request #488 from cgzones/secure_zero
Serge Hallyn [Mon, 3 Jan 2022 15:31:43 +0000 (09:31 -0600)] 
Merge pull request #488 from cgzones/secure_zero

Ensure memory cleaning

3 years agoEnsure memory cleaning 488/head
Christian Göttsche [Mon, 3 Jan 2022 14:03:34 +0000 (15:03 +0100)] 
Ensure memory cleaning

Compilers are allowed to and do optimize memset(3) calls away for
pointers not accessed in the future. Since the memzero wrappers purpose
is exactly to unconditionally override memory (e.g. for stored
passwords) do not implement via regular memset(3), but via either
memset_s(3), explicit_bzero(3) or a hand written implementation using
volatile pointers.

See https://wiki.sei.cmu.edu/confluence/display/c/MSC06-C.+Beware+of+compiler+optimizations

3 years agoDo not return garbage in run_parts 487/head
Christian Göttsche [Mon, 3 Jan 2022 12:12:31 +0000 (13:12 +0100)] 
Do not return garbage in run_parts

If scandir(3) returns 0, the uninitialized value of execute_result will
be returned.

3 years agoDeclare read-only arguments of run_part(s) const
Christian Göttsche [Mon, 3 Jan 2022 11:31:49 +0000 (12:31 +0100)] 
Declare read-only arguments of run_part(s) const

run_part() and run_parts() do not modify their directory, name and
action arguments.
Also include the header in the implementation to provide the prototypes.

useradd.c:2495:59: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
 2495 |         if (run_parts ("/etc/shadow-maint/useradd-pre.d", (char*)user_name,
      |                                                           ^
useradd.c:2495:24: warning: passing argument 1 of ‘run_parts’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 2495 |         if (run_parts ("/etc/shadow-maint/useradd-pre.d", (char*)user_name,
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from useradd.c:45:
../lib/run_part.h:2:22: note: expected ‘char *’ but argument is of type ‘const char *’
    2 | int run_parts (char *directory, char *name, char *action);
      |                ~~~~~~^~~~~~~~~
useradd.c:2496:25: warning: passing argument 3 of ‘run_parts’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
 2496 |                         "useradd")) {
      |                         ^~~~~~~~~

3 years agoAvoid unused variable warnings when building with PAM
Christian Göttsche [Mon, 3 Jan 2022 11:23:17 +0000 (12:23 +0100)] 
Avoid unused variable warnings when building with PAM

newusers.c:467:15: warning: unused variable ‘cp’ [-Wunused-variable]
  467 |         char *cp;
      |               ^~

newusers.c:611:13: warning: unused variable ‘bad_s’ [-Wunused-variable]
  611 |         int bad_s;
      |             ^~~~~

3 years agoDeclare read-only lookup pointers const
Christian Göttsche [Mon, 3 Jan 2022 11:26:25 +0000 (12:26 +0100)] 
Declare read-only lookup pointers const

pwck.c:587:31: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
  587 |                         spw = (struct spwd *) spw_locate (pwd->pw_name);
      |                               ^

grpck.c:599:31: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
  599 |                         sgr = (struct sgrp *) sgr_locate (grp->gr_name);
      |                               ^

grpck.c:761:23: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
  761 |                 grp = (struct group *) gr_locate (sgr->sg_name);
      |                       ^

3 years agoDeclare variable for string literal const
Christian Göttsche [Mon, 3 Jan 2022 11:19:00 +0000 (12:19 +0100)] 
Declare variable for string literal const

newgidmap.c:87:16: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   87 |         policy = "deny\n";
      |                ^

3 years agoDeclare argument of nss_init const
Christian Göttsche [Mon, 3 Jan 2022 11:49:02 +0000 (12:49 +0100)] 
Declare argument of nss_init const

nss_init() does not modify its path argument, thus declare it const.
Also drop superfluous prototype.

nss.c:54:31: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
   54 |                 nsswitch_path = NSSWITCH;
      |                               ^

3 years agoDo not drop const qualifier for Basename
Christian Göttsche [Mon, 3 Jan 2022 11:17:22 +0000 (12:17 +0100)] 
Do not drop const qualifier for Basename

The private Basename() implementation does not modify its argument, so
a cast to a non-const char pointer is not necessary.

newgrp.c:790:39: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
  790 |         progbase = (char *) Basename ((char *) prog);
      |                                       ^
newgrp.c:790:20: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
  790 |         progbase = (char *) Basename ((char *) prog);
      |                    ^

shell.c:48:70: warning: cast discards ‘const’ qualifier from pointer target type [-Wcast-qual]
   48 |                 (void) snprintf (arg0, sizeof arg0, "-%s", Basename ((char *) file));
      |                                                                      ^

3 years agoUse strict prototypes
Christian Göttsche [Mon, 3 Jan 2022 11:43:01 +0000 (12:43 +0100)] 
Use strict prototypes

Function declarations with no argument declare functions taking an
arbitrary number of arguments. Use the special type void to declare
functions taking no argument.

3 years agoDeclare file local functions static
Christian Göttsche [Mon, 3 Jan 2022 11:41:13 +0000 (12:41 +0100)] 
Declare file local functions static

3 years agoconfigure.ac and changelog: release 4.11.1 v4.11.1
Serge Hallyn [Mon, 3 Jan 2022 03:07:38 +0000 (21:07 -0600)] 
configure.ac and changelog: release 4.11.1

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agobuild: include lib/shadowlog_internal.h in dist tarballs
Sam James [Mon, 3 Jan 2022 02:37:58 +0000 (02:37 +0000)] 
build: include lib/shadowlog_internal.h in dist tarballs

Fixes: #485
Signed-off-by: Sam James <sam@gentoo.org>
3 years agoconfigure.ac and changelog: release 4.11
Serge Hallyn [Mon, 3 Jan 2022 00:59:13 +0000 (18:59 -0600)] 
configure.ac and changelog: release 4.11

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoMerge pull request #451 from hallyn/2021-12-05/license
Serge Hallyn [Mon, 3 Jan 2022 00:38:42 +0000 (18:38 -0600)] 
Merge pull request #451 from hallyn/2021-12-05/license

3 years agoMerge pull request #483 from edneville/317_nofollow
Serge Hallyn [Sun, 2 Jan 2022 16:38:45 +0000 (10:38 -0600)] 
Merge pull request #483 from edneville/317_nofollow

Adding nofollow to opens

3 years agoAdding nofollow to opens 483/head
ed neville [Fri, 31 Dec 2021 22:40:13 +0000 (22:40 +0000)] 
Adding nofollow to opens

3 years agoMerge pull request #460 from edneville/404_userdel_kill
Serge Hallyn [Thu, 30 Dec 2021 23:45:20 +0000 (17:45 -0600)] 
Merge pull request #460 from edneville/404_userdel_kill

script to kill subjects processes

3 years agoscript to kill subjects processes from userdel 460/head
ed neville [Fri, 17 Dec 2021 14:29:48 +0000 (14:29 +0000)] 
script to kill subjects processes from userdel

Closes #404
Closes #317

Signed-off-by: ed neville <ed@s5h.net>
3 years agoMerge pull request #482 from xry111/useradd_segfault_fix
Serge Hallyn [Wed, 29 Dec 2021 18:03:34 +0000 (12:03 -0600)] 
Merge pull request #482 from xry111/useradd_segfault_fix

fix segfault running useradd -D

3 years agofix segfault running useradd -D 482/head
Xi Ruoyao [Wed, 29 Dec 2021 09:06:39 +0000 (17:06 +0800)] 
fix segfault running useradd -D

3 years agoUse isdigit(3) instead of a reimplementation of it 481/head
Alejandro Colomar [Tue, 28 Dec 2021 18:55:09 +0000 (19:55 +0100)] 
Use isdigit(3) instead of a reimplementation of it

C89 defined isdigit as a function that tests for any decimal-digit
character, defining the decimal digits as 0 1 2 3 4 5 6 7 8 9.

I don't own a copy of C89 to check, but check in C17:

7.4.1.5
5.2.1

More specifically:

> In both the source and execution basic character sets, the value
> of each character after 0 in the above list of decimal digits
> shall be one greater than the value of the previous.

And since in ascii(7), the character after '9' is ':', it's highly
unlikely that any implementation will ever accept any
_decimal digit_ other than 0..9.

POSIX simply defers to the ISO C standard.

This is exactly what we wanted from ISDIGIT(c), so just use it.
Non-standard implementations might have been slower or considered
other characters as digits in the past, but let's assume
implementations available today conform to ISO C89.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove definition of ISDIGIT_LOCALE(c)
Alejandro Colomar [Tue, 28 Dec 2021 18:38:58 +0000 (19:38 +0100)] 
Remove definition of ISDIGIT_LOCALE(c)

It wasn't being used at all.  Let's remove it.

Use isdigit(3) directly in comments that referenced it.

Also, in those comments, remove an outdated reference to the fact
that ISDIGIT_LOCALE(c) might evaluate its argument more than once,
which could be true a few commits ago, until
IN_CTYPE_DEFINITION(c) was removed.  Previously, the definition
for ISDIGIT_LOCALE(c) was:

 #if defined (STDC_HEADERS) || (!defined (isascii) && !defined (HAVE_ISASCII))
 # define IN_CTYPE_DOMAIN(c) 1
 #else
 # define IN_CTYPE_DOMAIN(c) isascii(c)
 #endif

 #define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))

Which could evaluate 'c' twice on pre-C89 systems (which I hope
don't exist nowadays).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoUse standard isspace(3), isalpha(3), and isupper(3)
Alejandro Colomar [Tue, 28 Dec 2021 18:33:23 +0000 (19:33 +0100)] 
Use standard isspace(3), isalpha(3), and isupper(3)

Due to the recent removal of IN_CTYPE_DOMAIN(), the uppercase
macros that wrapped these standard calls are now defined to be
equivalent.  Therefore, there's no need for the wrappers, and it
is much more readable to use the standard calls directly.

However, hold on with ISDIGIT*(), since it's not so obvious what
to do with it.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove IN_CTYPE_DOMAIN, which was always true
Alejandro Colomar [Tue, 28 Dec 2021 18:25:18 +0000 (19:25 +0100)] 
Remove IN_CTYPE_DOMAIN, which was always true

The recent removal of STDC_HEADERS made IN_CTYPE_DOMAIN be defined
to 1 unconditionally.  Remove the now unnecessary definition, and
propagate its truthness to expressions where it was used.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoAssume STDC_HEADERS will always be defined
Alejandro Colomar [Tue, 28 Dec 2021 18:19:32 +0000 (19:19 +0100)] 
Assume STDC_HEADERS will always be defined

We're in 2021.  C89 is everywhere; in fact, there are many other
assumptions in the code that wouldn't probably hold on
pre-standard C environments.  Let's simplify and assume that C89
is available.

The specific assumptions are that:
- <string.h>, and <stdlib.h> are available
- strchr(3), strrchr(3), and strtok(3) are available
- isalpha(3), isspace(3), isdigit(3), and isupper(3) are available

I think we can safely assume we have all of those.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoMerge pull request #479 from alejandro-colomar/getgroups
Serge Hallyn [Tue, 28 Dec 2021 01:12:24 +0000 (19:12 -0600)] 
Merge pull request #479 from alejandro-colomar/getgroups

Remove HAVE_GETGROUPS ifdefs

3 years agoMerge pull request #480 from alejandro-colomar/memcpy
Serge Hallyn [Tue, 28 Dec 2021 01:10:48 +0000 (19:10 -0600)] 
Merge pull request #480 from alejandro-colomar/memcpy

Remove HAVE_MEMCPY and HAVE_MEMSET ifdefs

3 years agoMerge pull request #477 from alejandro-colomar/strftime
Serge Hallyn [Tue, 28 Dec 2021 01:10:06 +0000 (19:10 -0600)] 
Merge pull request #477 from alejandro-colomar/strftime

Remove HAVE_STRFTIME ifdefs

3 years agoMerge pull request #478 from hallyn/alpine
Serge Hallyn [Mon, 27 Dec 2021 23:10:21 +0000 (17:10 -0600)] 
Merge pull request #478 from hallyn/alpine

add alpine edge CI build

3 years agonss test_range: make sure /etc/nsswitch.conf and /etc/subuid exists 478/head
Serge Hallyn [Mon, 27 Dec 2021 21:26:27 +0000 (15:26 -0600)] 
nss test_range: make sure /etc/nsswitch.conf and /etc/subuid exists

Signed-off-by: Serge Hallyn <serge@hallyn.com>