Commit Graph

2729 Commits

Author SHA1 Message Date
Alejandro Colomar
4e1afcd662 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>
2021-12-29 02:39:04 +01:00
Serge Hallyn
e668c7e725
Merge pull request #479 from alejandro-colomar/getgroups
Remove HAVE_GETGROUPS ifdefs
2021-12-27 19:12:24 -06:00
Serge Hallyn
9e5a852ee0
Merge pull request #480 from alejandro-colomar/memcpy
Remove HAVE_MEMCPY and HAVE_MEMSET ifdefs
2021-12-27 19:10:48 -06:00
Serge Hallyn
80b52a597f
Merge pull request #477 from alejandro-colomar/strftime
Remove HAVE_STRFTIME ifdefs
2021-12-27 19:10:06 -06:00
Serge Hallyn
d355cb2b16
Merge pull request #478 from hallyn/alpine
add alpine edge CI build
2021-12-27 17:10:21 -06:00
Serge Hallyn
4ce27b5e60 nss test_range: make sure /etc/nsswitch.conf and /etc/subuid exists
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-27 15:47:29 -06:00
Serge Hallyn
62449968fa add alpine edge CI build
Mainly to get a musl build in there.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-27 15:47:26 -06:00
Alejandro Colomar
b7e12ec04e 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>
2021-12-27 21:52:00 +01:00
Alejandro Colomar
047bfc47c6 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>
2021-12-27 21:38:47 +01:00
Alejandro Colomar
913e16ce20 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>
2021-12-27 21:17:50 +01:00
Alejandro Colomar
3e602b58a2 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>
2021-12-27 20:50:13 +01:00
Serge Hallyn
6b341b1e90
Merge pull request #476 from hallyn/2021-12-27/impish
add ubuntu impish build
2021-12-27 13:26:11 -06:00
Serge Hallyn
e751bc67eb add ubuntu impish build
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-27 13:21:24 -06:00
Serge Hallyn
92bd73c657
Merge pull request #474 from atsampson/subidprogname
Default value for progname/logfd, and set progname in subid_init too
2021-12-27 12:46:34 -06:00
Adam Sampson
2b0bdef6f9 lib: provide default values for shadow_progname/shadow_logfd 2021-12-27 16:28:23 +00:00
Adam Sampson
9750fd6819 libsubid: use log_set_progname in subid_init
The static Prog variable here is no longer used, so remove it.
2021-12-27 16:28:23 +00:00
Serge Hallyn
e1b1d187f4
Merge pull request #467 from alejandro-colomar/date_to_str
Have a single definition of date_to_str()
2021-12-27 09:53:00 -06:00
Serge Hallyn
7052a0a2dd
Merge pull request #473 from hallyn/2021-12-26/srht
Test sr.ht CI integration
2021-12-27 09:40:19 -06:00
Serge Hallyn
962c820fba 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>
2021-12-27 09:27:44 -06:00
Serge Hallyn
363eab25f0 libsubid_zzz (test): fix pointer test
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-27 09:26:55 -06:00
Serge Hallyn
4758641b1d run_some: exit error if there were failed tests
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-27 09:26:32 -06:00
Serge Hallyn
f5a7404c7a remove broken github actions
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-27 09:26:32 -06:00
Serge Hallyn
618bafc238 add a .build.yml to build on builds.sr.ht
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-27 09:26:27 -06:00
Alejandro Colomar
355ad6a9e0 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>
2021-12-26 18:55:39 +01:00
Serge Hallyn
d59a090933
Merge pull request #472 from atsampson/progname
lib: rename Prog to shadow_progname, with only one definition
2021-12-26 10:02:04 -06:00
Adam Sampson
0e6fe5e728 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.
2021-12-25 22:41:58 +00:00
Serge Hallyn
f93cf255d4 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>
2021-12-23 19:36:50 -06:00
Serge Hallyn
6761cf2d7e
Merge pull request #471 from hallyn/2021-12-23/extern
Make shadow_logfd and Prog not extern
2021-12-23 15:19:16 -06:00
Serge Hallyn
79157cbad8 Make shadow_logfd and Prog not extern
Closes #444
Closes #465

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-23 15:18:07 -06:00
Serge Hallyn
b8c67c320c
Merge pull request #463 from thesamesam/master
libsubid: fix defining SONAME version
2021-12-19 19:46:55 -06:00
Sam James
e0d66b4be1 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>
2021-12-20 01:37:42 +00:00
Serge Hallyn
868d7b34ea configure.ac and changelog: release 4.9
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-19 14:09:08 -06:00
Serge Hallyn
30e62bc3bd Add README as symlink to README.md
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2021-12-19 14:09:08 -06:00
Serge Hallyn
a630fba34b
Merge pull request #461 from edneville/441_passwd_message
passwd -l should not say that it changes expiry
2021-12-19 11:27:44 -06:00
ed neville
92cb9d7785 passwd -l should not say that it changes expiry
Closes #441
2021-12-17 23:02:02 +00:00
Serge Hallyn
0f31dc5c2c
Merge pull request #458 from edneville/434_usermod_home_dir_trailing_slash
Remove tailing slash on home dir
2021-12-17 08:41:26 -06:00
Serge Hallyn
2a6164cc4a
Merge pull request #455 from alejandro-colomar/master
usermod: Remove special case for ""
2021-12-17 08:33:47 -06:00
ed neville
53763ae6ee Remove tailing slash on home dir
Closes #434

Signed-off-by: ed neville <ed@s5h.net>
2021-12-17 12:23:52 +00:00
Serge Hallyn
a850520981
Merge pull request #456 from stoeckmann/chld
Verify default SIGCHLD handling.
2021-12-15 09:22:19 -06:00
Tobias Stoeckmann
c0e4ccd032 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>
2021-12-15 11:26:51 +01:00
Serge Hallyn
f2e8294bdb
Merge pull request #421 from AZaugg/issue337
Adding new switch -rG to usermod
2021-12-14 08:04:29 -06:00
Alejandro Colomar
e2f1fcca0e 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>
2021-12-14 12:40:09 +01:00
Andy Zaugg
aaaaf21b6f 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
2021-12-13 21:42:48 -08:00
Serge Hallyn
9a9c9231db
Merge pull request #452 from 20100074/fix-typo-in-is
Fixed typo in login.defs
2021-12-10 09:43:12 -06:00
Serge Hallyn
292f59f43d
Merge pull request #453 from ikerexxe/getsubids_h
man: getsubids define -h
2021-12-10 09:37:02 -06:00
Iker Pedrosa
585b6f00f5 man: getsubids define -h
Define -h option behaviour in getsubids man page.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2021-12-10 16:14:13 +01:00
Serge Hallyn
abb879fd4f
Merge pull request #449 from hallyn/2021-11-27/libsubid-symbols
2021 11 27/libsubid symbols
2021-12-07 08:58:03 -06:00
KOSHIKAWA Kenichi
f7c2a54212 fixed typo in login.defs 2021-12-06 01:41:17 +09:00
Serge Hallyn
c628caf174
Merge pull request #408 from bjorn-fischer/ambient_caps
Add support for ambient capabilities
2021-12-05 08:05:06 -06:00
Björn Fischer
6938bab429 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>
2021-12-05 08:03:56 -06:00