]> git.ipfire.org Git - thirdparty/shadow.git/log
thirdparty/shadow.git
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>
3 years agoadd alpine edge CI build
Serge Hallyn [Mon, 27 Dec 2021 19:56:55 +0000 (13:56 -0600)] 
add alpine edge CI build

Mainly to get a musl build in there.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoRemove HAVE_MEMSET ifdefs 480/head
Alejandro Colomar [Mon, 27 Dec 2021 19:50:06 +0000 (20:50 +0100)] 
Remove HAVE_MEMSET ifdefs

memset(3) has been in standard C since C89.  It is also in
POSIX.1-2001, in SVr4, and in 4.3BSD (see memset(3) and memset(3p)).
We can assume that this function is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove HAVE_MEMCPY ifdefs
Alejandro Colomar [Mon, 27 Dec 2021 19:50:06 +0000 (20:50 +0100)] 
Remove HAVE_MEMCPY ifdefs

memcpy(3) has been in standard C since C89.  It is also in
POSIX.1-2001, in SVr4, and in 4.3BSD (see memcpy(3) and memcpy(3p)).
We can assume that this function is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove HAVE_GETGROUPS ifdefs 479/head
Alejandro Colomar [Mon, 27 Dec 2021 19:50:06 +0000 (20:50 +0100)] 
Remove HAVE_GETGROUPS ifdefs

getgroups(2) has been in POSIX since POSIX.1-2001.  It is also in
in SVr4 and in 4.3BSD (see getgroups(2) and getgroups(3p)).
We can assume that this function is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoRemove HAVE_STRFTIME ifdefs 477/head
Alejandro Colomar [Mon, 27 Dec 2021 19:50:06 +0000 (20:50 +0100)] 
Remove HAVE_STRFTIME ifdefs

strftime(3) has been in standard C since C89.  It is also in
POSIX.1-2001, and in SVr4 (see strftime(3) and strftime(3p)).
We can assume that this function is always available.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoMerge pull request #476 from hallyn/2021-12-27/impish
Serge Hallyn [Mon, 27 Dec 2021 19:26:11 +0000 (13:26 -0600)] 
Merge pull request #476 from hallyn/2021-12-27/impish

add ubuntu impish build

3 years agoadd ubuntu impish build 476/head
Serge Hallyn [Mon, 27 Dec 2021 19:21:24 +0000 (13:21 -0600)] 
add ubuntu impish build

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoMerge pull request #474 from atsampson/subidprogname
Serge Hallyn [Mon, 27 Dec 2021 18:46:34 +0000 (12:46 -0600)] 
Merge pull request #474 from atsampson/subidprogname

Default value for progname/logfd, and set progname in subid_init too

3 years agolib: provide default values for shadow_progname/shadow_logfd 474/head
Adam Sampson [Sun, 26 Dec 2021 18:21:09 +0000 (18:21 +0000)] 
lib: provide default values for shadow_progname/shadow_logfd

3 years agolibsubid: use log_set_progname in subid_init
Adam Sampson [Sun, 26 Dec 2021 18:16:10 +0000 (18:16 +0000)] 
libsubid: use log_set_progname in subid_init

The static Prog variable here is no longer used, so remove it.

3 years agoMerge pull request #467 from alejandro-colomar/date_to_str
Serge Hallyn [Mon, 27 Dec 2021 15:53:00 +0000 (09:53 -0600)] 
Merge pull request #467 from alejandro-colomar/date_to_str

Have a single definition of date_to_str()

3 years agoMerge pull request #473 from hallyn/2021-12-26/srht
Serge Hallyn [Mon, 27 Dec 2021 15:40:19 +0000 (09:40 -0600)] 
Merge pull request #473 from hallyn/2021-12-26/srht

Test sr.ht CI integration

3 years agofix newuidmap testcase 473/head
Serge Hallyn [Sun, 26 Dec 2021 19:46:50 +0000 (13:46 -0600)] 
fix newuidmap testcase

sleep 2s before running newxidmap - it seems we were sometimes
racing, causing newxidmap to fail.

Make sure to remove /tmp/test-xidmap, for some reason they
were sometimes still there, causing test to fail.

Fix some irregular tabbing.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agolibsubid_zzz (test): fix pointer test
Serge Hallyn [Sun, 26 Dec 2021 17:55:01 +0000 (11:55 -0600)] 
libsubid_zzz (test): fix pointer test

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agorun_some: exit error if there were failed tests
Serge Hallyn [Sun, 7 Nov 2021 23:56:31 +0000 (17:56 -0600)] 
run_some: exit error if there were failed tests

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoremove broken github actions
Serge Hallyn [Sun, 26 Dec 2021 17:51:21 +0000 (11:51 -0600)] 
remove broken github actions

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoadd a .build.yml to build on builds.sr.ht
Serge Hallyn [Sun, 26 Dec 2021 17:45:52 +0000 (11:45 -0600)] 
add a .build.yml to build on builds.sr.ht

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoHave a single definition of date_to_str() 467/head
Alejandro Colomar [Wed, 22 Dec 2021 14:32:17 +0000 (15:32 +0100)] 
Have a single definition of date_to_str()

PARAMETERS:

According to the C2x charter, I reordered the parameters 'size'
and 'buf' from previously existing date_to_str() definitions.

C2x charter:
> 15. Application Programming Interfaces (APIs) should be
> self-documenting when possible.  In particular, the order of
> parameters in function declarations should be arranged such that
> the size of an array appears before the array.  The purpose is to
> allow Variable-Length Array (VLA) notation to be used.  This not
> only makes the code's purpose clearer to human readers, but also
> makes static analysis easier.  Any new APIs added to the Standard
> should take this into consideration.

I used 'long' for the date parameter, as some uses of the function
need to pass a negative value meaning "never".

FUNCTION BODY:

I didn't check '#ifdef HAVE_STRFTIME', which old definitions did,
since strftime(3) is guaranteed by the C89 standard, and all of
the conversion specifiers that we use are also specified by that
standard, so we don't need any extensions at all.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoMerge pull request #472 from atsampson/progname
Serge Hallyn [Sun, 26 Dec 2021 16:02:04 +0000 (10:02 -0600)] 
Merge pull request #472 from atsampson/progname

lib: rename Prog to shadow_progname, with only one definition

3 years agolib: rename Prog to shadow_progname, with only one definition 472/head
Adam Sampson [Sat, 25 Dec 2021 22:41:58 +0000 (22:41 +0000)] 
lib: rename Prog to shadow_progname, with only one definition

The build was failing with duplicate symbol errors with -fno-common.
This is the default in GCC 10 and later, and explicitly enabled in some
distributions to catch problems like this. There were two causes:

- Prog and shadow_logfd were defined in a header file that was included
  in multiple other files. Fix this by defining them once in
  shadowlog.c, and having extern declarations in the header.

- Most of the tools (except id/nologin) also define a Prog variable,
  which is not intended to alias the one in the library. Fix
  this by renaming Prog in the library to shadow_progname, which also
  matches the new accessor functions for it.

3 years agoUpdate licensing info 451/head
Serge Hallyn [Sun, 5 Dec 2021 15:35:27 +0000 (09:35 -0600)] 
Update licensing info

Closes #238

Update all files to list SPDX license shortname.  Most files are
BSD 3 clause license.

The exceptions are:

serge@sl ~/src/shadow$ git grep SPDX-License | grep -v BSD-3-Clause
contrib/atudel:# SPDX-License-Identifier: BSD-4-Clause
lib/tcbfuncs.c: * SPDX-License-Identifier: 0BSD
libmisc/salt.c: * SPDX-License-Identifier: Unlicense
src/login_nopam.c: * SPDX-License-Identifier: Unlicense
src/nologin.c: * SPDX-License-Identifier: BSD-2-Clause
src/vipw.c: * SPDX-License-Identifier: GPL-2.0-or-later

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoMerge pull request #471 from hallyn/2021-12-23/extern
Serge Hallyn [Thu, 23 Dec 2021 21:19:16 +0000 (15:19 -0600)] 
Merge pull request #471 from hallyn/2021-12-23/extern

Make shadow_logfd and Prog not extern

3 years agoMake shadow_logfd and Prog not extern 471/head
Serge Hallyn [Sun, 28 Nov 2021 23:37:53 +0000 (17:37 -0600)] 
Make shadow_logfd and Prog not extern

Closes #444
Closes #465

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoMerge pull request #463 from thesamesam/master
Serge Hallyn [Mon, 20 Dec 2021 01:46:55 +0000 (19:46 -0600)] 
Merge pull request #463 from thesamesam/master

libsubid: fix defining SONAME version

3 years agolibsubid: fix defining SONAME version 463/head
Sam James [Mon, 20 Dec 2021 01:37:23 +0000 (01:37 +0000)] 
libsubid: fix defining SONAME version

We were overriding this when --enable-shared was passed. We can actually
just dump the conditional logic as libtool will do the right thing for
us here anyway.

Without this patch, libsubid is installed as .0.

Signed-off-by: Sam James <sam@gentoo.org>
3 years agoconfigure.ac and changelog: release 4.9 4.10 v4.10
Serge Hallyn [Sun, 19 Dec 2021 20:06:09 +0000 (14:06 -0600)] 
configure.ac and changelog: release 4.9

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoAdd README as symlink to README.md
Serge Hallyn [Sun, 19 Dec 2021 20:08:27 +0000 (14:08 -0600)] 
Add README as symlink to README.md

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoMerge pull request #461 from edneville/441_passwd_message
Serge Hallyn [Sun, 19 Dec 2021 17:27:44 +0000 (11:27 -0600)] 
Merge pull request #461 from edneville/441_passwd_message

passwd -l should not say that it changes expiry

3 years agopasswd -l should not say that it changes expiry 461/head
ed neville [Fri, 17 Dec 2021 22:59:46 +0000 (22:59 +0000)] 
passwd -l should not say that it changes expiry

Closes #441

3 years agoMerge pull request #458 from edneville/434_usermod_home_dir_trailing_slash
Serge Hallyn [Fri, 17 Dec 2021 14:41:26 +0000 (08:41 -0600)] 
Merge pull request #458 from edneville/434_usermod_home_dir_trailing_slash

Remove tailing slash on home dir

3 years agoMerge pull request #455 from alejandro-colomar/master
Serge Hallyn [Fri, 17 Dec 2021 14:33:47 +0000 (08:33 -0600)] 
Merge pull request #455 from alejandro-colomar/master

usermod: Remove special case for ""

3 years agoRemove tailing slash on home dir 458/head
ed neville [Fri, 17 Dec 2021 11:30:57 +0000 (11:30 +0000)] 
Remove tailing slash on home dir

Closes #434

Signed-off-by: ed neville <ed@s5h.net>
3 years agoMerge pull request #456 from stoeckmann/chld
Serge Hallyn [Wed, 15 Dec 2021 15:22:19 +0000 (09:22 -0600)] 
Merge pull request #456 from stoeckmann/chld

Verify default SIGCHLD handling.

3 years agoVerify default SIGCHLD handling. 456/head
Tobias Stoeckmann [Sat, 23 Oct 2021 13:36:00 +0000 (15:36 +0200)] 
Verify default SIGCHLD handling.

The SIGCHLD handler could have been ignored by parent process.
Make sure that we have default handling activated.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 years agoMerge pull request #421 from AZaugg/issue337
Serge Hallyn [Tue, 14 Dec 2021 14:04:29 +0000 (08:04 -0600)] 
Merge pull request #421 from AZaugg/issue337

Adding new switch -rG to usermod

3 years agousermod: Remove special case for "" 455/head
Alejandro Colomar [Tue, 14 Dec 2021 11:40:06 +0000 (12:40 +0100)] 
usermod: Remove special case for ""

That special case is already handled by the called function: strtoday()
so we can simplify the calling code.

Link: <https://github.com/shadow-maint/shadow/issues/454>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
3 years agoAdding new option -rG to usermod 421/head
Andy Zaugg [Thu, 23 Sep 2021 03:29:09 +0000 (20:29 -0700)] 
Adding new option -rG to usermod

Adding a new switch -rG, which provides a similar feature set to
-aG, allowing a person to list exactly what groups to remove a
user from.

https://github.com/shadow-maint/shadow/issues/337

3 years agoMerge pull request #452 from 20100074/fix-typo-in-is
Serge Hallyn [Fri, 10 Dec 2021 15:43:12 +0000 (09:43 -0600)] 
Merge pull request #452 from 20100074/fix-typo-in-is

Fixed typo in login.defs

3 years agoMerge pull request #453 from ikerexxe/getsubids_h
Serge Hallyn [Fri, 10 Dec 2021 15:37:02 +0000 (09:37 -0600)] 
Merge pull request #453 from ikerexxe/getsubids_h

man: getsubids define -h

3 years agoman: getsubids define -h 453/head
Iker Pedrosa [Fri, 10 Dec 2021 15:14:13 +0000 (16:14 +0100)] 
man: getsubids define -h

Define -h option behaviour in getsubids man page.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 years agoMerge pull request #449 from hallyn/2021-11-27/libsubid-symbols
Serge Hallyn [Tue, 7 Dec 2021 14:58:03 +0000 (08:58 -0600)] 
Merge pull request #449 from hallyn/2021-11-27/libsubid-symbols

2021 11 27/libsubid symbols

3 years agofixed typo in login.defs 452/head
KOSHIKAWA Kenichi [Sun, 5 Dec 2021 16:41:17 +0000 (01:41 +0900)] 
fixed typo in login.defs

3 years agoMerge pull request #408 from bjorn-fischer/ambient_caps
Serge Hallyn [Sun, 5 Dec 2021 14:05:06 +0000 (08:05 -0600)] 
Merge pull request #408 from bjorn-fischer/ambient_caps

Add support for ambient capabilities

3 years agoCall pam_end() after fork in child code path 408/head
Björn Fischer [Wed, 8 Sep 2021 13:03:36 +0000 (15:03 +0200)] 
Call pam_end() after fork in child code path

This conforms to PAM documentation and it is needed to support
ambient capabilities with PAM + libcap-2.58+.

Signed-off-by: Björn Fischer <bf@CeBiTec.Uni-Bielefeld.DE>
3 years agoShow libsubid api version in subid.h 449/head
Serge Hallyn [Sun, 5 Dec 2021 13:57:39 +0000 (07:57 -0600)] 
Show libsubid api version in subid.h

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 years agoMerge pull request #231 from gjzkrug/useradd-maildir-fix
Serge Hallyn [Sun, 5 Dec 2021 04:26:51 +0000 (22:26 -0600)] 
Merge pull request #231 from gjzkrug/useradd-maildir-fix

Removed hard-coded default mail spool in useradd

3 years agoMerge pull request #450 from lnussel/master
Serge Hallyn [Sun, 5 Dec 2021 04:21:37 +0000 (22:21 -0600)] 
Merge pull request #450 from lnussel/master

useradd: assume uid 0 == root as fallback

3 years agoUpdate email address for Julie Haugh
Serge Hallyn [Sun, 5 Dec 2021 04:20:23 +0000 (22:20 -0600)] 
Update email address for Julie Haugh

3 years agouseradd: assume uid 0 == root as fallback 450/head
Ludwig Nussel [Tue, 30 Nov 2021 16:14:14 +0000 (17:14 +0100)] 
useradd: assume uid 0 == root as fallback

In absence of /etc/passwd, eg when bootstrapping a chroot, resolving
uid 0 to a name may not work. Therefore just assume "root".