]> git.ipfire.org Git - thirdparty/shadow.git/log
thirdparty/shadow.git
7 weeks agorelease 4.17.4 4.17.4
Serge Hallyn [Wed, 19 Mar 2025 18:58:04 +0000 (13:58 -0500)] 
release 4.17.4

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2 months agotests/unit/test_xasprintf.c: Fix sign-mismatch diagnostic
Alejandro Colomar [Sun, 9 Feb 2025 13:10:55 +0000 (14:10 +0100)] 
tests/unit/test_xasprintf.c: Fix sign-mismatch diagnostic

Add a signed wrapper around mock() which returns a signed integer.
This makes it possible to compare the return value with literal -1.

Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agosrc/lastlog.c: Use ssizeof() to avoid a -Wsign-compare diagnostic
Alejandro Colomar [Sun, 9 Feb 2025 11:45:11 +0000 (12:45 +0100)] 
src/lastlog.c: Use ssizeof() to avoid a -Wsign-compare diagnostic

Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/sizeof.h: ssizeof(): Add signed variant of sizeof
Alejandro Colomar [Sun, 9 Feb 2025 11:44:34 +0000 (12:44 +0100)] 
lib/sizeof.h: ssizeof(): Add signed variant of sizeof

Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoautogen.sh: Promote -Wsign-compare to an error
Alejandro Colomar [Sun, 9 Feb 2025 11:37:02 +0000 (12:37 +0100)] 
autogen.sh: Promote -Wsign-compare to an error

It is usually a sign of deep errors.  We really want to avoid them.

Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/fs/readlink/: readlinknul(): Use ssize_t to simplify
Alejandro Colomar [Sun, 9 Feb 2025 11:23:46 +0000 (12:23 +0100)] 
lib/fs/readlink/: readlinknul(): Use ssize_t to simplify

Consistently using a signed type allows us to avoid sign-mismatch
diagnostics, while keeping the code simple.  It feels weird to
accept a ssize_t instead of a size_t, but it's a matter of getting
used to it.

Another way to achieve this with a single 'len' variable and no casts
would be to compare against SIZE_MAX, but that's less readable than -1.
Or one could write a SIZE_C() macro a la UINT64_C(), and compare the
size_t against SIZE_C(-1), but that's still suboptimal (regarding
readability) compared to consistently using signed size types.

Fixes: b9d00b64a19f (2024-12-09; "lib/fs/readlink/readlinknul.h: readlinknul(): Silence warning")
Acked-by: Serge Hallyn <serge@hallyn.com>
Cc: Martin Uecker <uecker@tugraz.at>
Cc: "Robert C. Seacord" <rcseacord@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agodoc/: Remove list of distributions
Michael Vetter [Mon, 10 Feb 2025 16:43:05 +0000 (17:43 +0100)] 
doc/: Remove list of distributions

Since c8e8557803f3 (2025-01-21; "ci: add openSUSE Tumbleweed") we also
run openSUSE in CI. Since the set may grow let's not list each of them
in the documentation.

2 months agolib/commonio.c: Rely on the POSIX.1-2008 behavior of realpath(3)
Alejandro Colomar [Sat, 22 Feb 2025 23:22:13 +0000 (00:22 +0100)] 
lib/commonio.c: Rely on the POSIX.1-2008 behavior of realpath(3)

Link: <https://github.com/shadow-maint/shadow/pull/1222#discussion_r1966612238>
Link: <https://stackoverflow.com/questions/60802732/are-realpath-portability-concerns-obsolete>
Reported-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agosrc/: update group audit messages
Iker Pedrosa [Fri, 24 Jan 2025 13:19:04 +0000 (14:19 +0100)] 
src/: update group audit messages

Auditing has been broken for a long time upstream and Fedora had some
downstream patches that fixed it, upstreaming that content to fix the
problem for everybody.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/: audit function for groups
Iker Pedrosa [Fri, 24 Jan 2025 13:09:02 +0000 (14:09 +0100)] 
lib/: audit function for groups

Link: https://github.com/linux-audit/audit-documentation/wiki/SPEC-User-Account-Lifecycle-Events
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/, src/: update audit messages
Iker Pedrosa [Fri, 24 Jan 2025 13:13:27 +0000 (14:13 +0100)] 
lib/, src/: update audit messages

Auditing has been broken for a long time upstream and Fedora had some
downstream patches that fixed it, upstreaming that content to fix the
problem for everybody.

The audit of a user is performed through the AUDIT_USER_* macros.
Similarly, the audit of a group is performed through the AUDIT_GRP_*
macros. Part of the audit performed for groups was incorrectly labeled
as a user, and therefore some changes needed to be made to label them
correctly.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
2 months agosrc/chfn.c: copy_field(): Rename local variable
Alejandro Colomar [Mon, 17 Feb 2025 14:33:46 +0000 (15:33 +0100)] 
src/chfn.c: copy_field(): Rename local variable

This makes it more obvious what that pointer is.

Tested-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agosrc/chfn.c: Add local variable to refer to the separated field
Alejandro Colomar [Mon, 17 Feb 2025 12:44:55 +0000 (13:44 +0100)] 
src/chfn.c: Add local variable to refer to the separated field

Tested-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agosrc/chfn.c: Use stpsep() instead of its pattern
Alejandro Colomar [Mon, 17 Feb 2025 12:40:02 +0000 (13:40 +0100)] 
src/chfn.c: Use stpsep() instead of its pattern

Tested-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agosrc/chfn.c: Partially revert "lib/, src/: Use strsep(3) instead of its pattern"
Alejandro Colomar [Mon, 17 Feb 2025 12:23:37 +0000 (13:23 +0100)] 
src/chfn.c: Partially revert "lib/, src/: Use strsep(3) instead of its pattern"

This partially reverts commit 16cb664865541162c504a6f5ef5ca4b38b5e0c9a.

I'll try to reintroduce this change more carefully.
For now, let's revert to a known-good state.

The problem was due to accidentally ignoring the effects of the 'break'
on the 'cp' variable.

Fixes: 16cb66486554 (2024-07-01; "lib/, src/: Use strsep(3) instead of its pattern")
Closes: <https://github.com/shadow-maint/shadow/issues/1210>
Link: <https://github.com/shadow-maint/shadow/pull/1213>
Link: <https://github.com/shadow-maint/shadow/pull/1212>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Suggested-by: Chris Hofstaedtler <zeha@debian.org>
Tested-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoconfigure.ac: be deterministic about passwd location
Chris Hofstaedtler [Mon, 24 Feb 2025 21:50:01 +0000 (22:50 +0100)] 
configure.ac: be deterministic about passwd location

Statically set PASSWD_PROGRAM depending on exec_prefix, and not by where
the passwd program was at configure time.

Depending on the specific build situation before, this may or may not
change the embedded passwd program path. Also configure.ac sets
exec_prefix=/ for prefix=/usr, so this might be a bit confusing, but
at least deterministic.

Closes: #1224
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2 months agolib/getdate.y: Ignore time-zone information and use UTC
Alejandro Colomar [Mon, 17 Feb 2025 23:41:56 +0000 (00:41 +0100)] 
lib/getdate.y: Ignore time-zone information and use UTC

There is exactly one caller of this function, and it wants a date, not a
time.  It is useless to be able to parse local dates, because we
ultimately store a UTC date.  To avoid confusion, unconditionally use
UTC.  Since this code had important bugs regarding offset, we can safely
assume that no existing users rely on being able to use their local
date (this never worked correctly).

Also, the code parsing time zones is quite bad, for today's standards.

Link: <https://github.com/shadow-maint/shadow/issues/1202>
Link: <https://github.com/shadow-maint/shadow/issues/1209>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Tim Parenti <tim@timtimeonline.com>
Reported-by: Lee Garrett <lgarrett@rocketjump.eu>
Cc: Gus Kenion <https://github.com/kenion>
Cc: Michael Vetter <jubalh@iodoru.org>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoconfigure.ac: stop checking for utmp location
Chris Hofstaedtler [Mon, 24 Feb 2025 22:48:28 +0000 (23:48 +0100)] 
configure.ac: stop checking for utmp location

Nothing seems to use it.

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
2 months agoRevert "lib/, src/: Use local time for human-readable dates"
Alejandro Colomar [Fri, 14 Feb 2025 20:25:01 +0000 (21:25 +0100)] 
Revert "lib/, src/: Use local time for human-readable dates"

This reverts commit 3f5b4b56268269fefed55aa106f382037297d663.

The dates are stored as UTC, and are stored as a number of days since
Epoch.  We don't have enough precision to translate it into local time.
Using local time has caused endless issues in users.

This patch is not enough for fixing this issue completely, since
printing a date without time-zone information means that the date is a
local date, but what we're printing is a UTC date.  A future patch
should add time-zone information to the date.

For now, let's revert this change that has caused so many issues.

Fixes: 3f5b4b562682 (2024-08-01; "lib/, src/: Use local time for human-readable dates")
Link: <https://github.com/ansible/ansible/blob/devel/test/integration/targets/user/tasks/test_expires.yml#L2-L20>
Link: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1095430>
Link: <https://lists.iana.org/hyperkitty/list/tz@iana.org/message/ENE5IFV3GAH6WK22UJ6YU57D6TQINSP5/>
Link: <https://github.com/shadow-maint/shadow/issues/1202>
Link: <https://github.com/shadow-maint/shadow/issues/1057>
Link: <https://github.com/shadow-maint/shadow/issues/939>
Link: <https://github.com/shadow-maint/shadow/pull/1058>
Link: <https://github.com/shadow-maint/shadow/pull/1059#issuecomment-2309888519>
Link: <https://github.com/shadow-maint/shadow/pull/952>
Link: <https://github.com/shadow-maint/shadow/pull/942>
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Gus Kenion <https://github.com/kenion>
Reported-by: Alejandro Colomar <alx@kernel.org>
Reported-by: Michael Vetter <jubalh@iodoru.org>
Reported-by: Lee Garrett <lgarrett@rocketjump.eu>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Cc: Tim Parenti <tim@timtimeonline.com>
Cc: "Serge E. Hallyn" <serge@hallyn.com>
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoRelease 4.17.3 4.17.3
Serge Hallyn [Mon, 24 Feb 2025 13:55:18 +0000 (07:55 -0600)] 
Release 4.17.3

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2 months agochsh: do not warn about blank shell
Chris Hofstaedtler [Mon, 17 Feb 2025 23:54:30 +0000 (00:54 +0100)] 
chsh: do not warn about blank shell

Closes: <https://bugs.debian.org/876542>
Reported-by: 積丹尼 Dan Jacobson <jidanni@jidanni.org>
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/: Use strisdigit() instead of its pattern
Alejandro Colomar [Tue, 10 Dec 2024 15:24:33 +0000 (16:24 +0100)] 
lib/: Use strisdigit() instead of its pattern

Note that the old code in

(1)  lib/strtoday.c:strtoday()
(2)  lib/subordinateio.c:append_uids()

was considering an empty string as if it were a number.
strisdigit() does not consider an empty string to be numeric.

I think it will not affect the behavior in either case, as they should
sooner or later result in an error somewhere.  And it seems (IMO)
surprising to treat empty strings as numeric strings, so let's not do
it.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/string/ctype/strisascii/: strisdigit(): Add function
Alejandro Colomar [Wed, 11 Dec 2024 00:57:29 +0000 (01:57 +0100)] 
lib/string/ctype/strisascii/: strisdigit(): Add function

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/string/: Add comments expanding the letter-soup API names
Alejandro Colomar [Sat, 15 Feb 2025 21:06:30 +0000 (22:06 +0100)] 
lib/string/: Add comments expanding the letter-soup API names

Suggested-by: Serge Hallyn <serge@hallyn.com>
Cc: Chris Bazley <Chris.Bazley@arm.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/basename.c: Basename(): Use stprcspn() instead of its pattern
Alejandro Colomar [Sat, 16 Nov 2024 14:48:23 +0000 (15:48 +0100)] 
lib/basename.c: Basename(): Use stprcspn() instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/string/strspn/, lib/, src/: stprspn(), strrspn_(): Split API into function and...
Alejandro Colomar [Sat, 16 Nov 2024 14:15:32 +0000 (15:15 +0100)] 
lib/string/strspn/, lib/, src/: stprspn(), strrspn_(): Split API into function and macro

This provides a safer and more consistent API.

We had the strrspn(3) function as it was for compatibility with Oracle
Solaris, but let's not repeat their mistake.  Nevertheless, name our
function strrspn_() with a trailing underscore, to differentiate it from
the one in Solaris, since it's slightly different.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/string/strspn/, lib/, src/: Move *spn() APIs to separate subdir
Alejandro Colomar [Sat, 16 Nov 2024 14:03:28 +0000 (15:03 +0100)] 
lib/string/strspn/, lib/, src/: Move *spn() APIs to separate subdir

This provides a better organization.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/string/strchr/: strrcspn(), stprcspn(): Add function and macro
Alejandro Colomar [Sat, 16 Nov 2024 13:33:34 +0000 (14:33 +0100)] 
lib/string/strchr/: strrcspn(), stprcspn(): Add function and macro

These APIs are to strrspn(), like strcspn() is to strspn().
They are like strcspn(3), but search from the end of the string.

The function is meant for internal use, and consistency with libc.
The macro is meant for normal use, since it returns a pointer,
which is what algorithms using this need.

See also strspn(3) and strcspn(3).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agosrc/useradd.c: Use !strcaseeq() instead of its pattern
Alejandro Colomar [Sat, 8 Feb 2025 23:19:34 +0000 (00:19 +0100)] 
src/useradd.c: Use !strcaseeq() instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/, src/: Use strcaseeq() instead of its pattern
Alejandro Colomar [Sat, 8 Feb 2025 23:18:58 +0000 (00:18 +0100)] 
lib/, src/: Use strcaseeq() instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/string/strcmp/: strcaseeq(): Add function
Alejandro Colomar [Wed, 5 Feb 2025 17:42:21 +0000 (18:42 +0100)] 
lib/string/strcmp/: strcaseeq(): Add function

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoman/useradd.8.xml: Document new exit code 19 (E_BAD_NAME)
Marc Haber [Thu, 5 Dec 2024 17:54:17 +0000 (18:54 +0100)] 
man/useradd.8.xml: Document new exit code 19 (E_BAD_NAME)

Link: <https://github.com/shadow-maint/shadow/issues/1103>
Link: <https://github.com/shadow-maint/shadow/pull/1141>
Signed-off-by: Marc 'Zugschlus' Haber <mh+githubvisible@zugschlus.de>
Cc: Chris Hofstaedtler <zeha@debian.org>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agosrc/useradd.c: E_BAD_NAME: Use a different error code for bad login names
Alejandro Colomar [Thu, 5 Dec 2024 16:38:54 +0000 (17:38 +0100)] 
src/useradd.c: E_BAD_NAME: Use a different error code for bad login names

Wrappers like adduser(8) want to do their own stuff if the login name is
bad.  For that, they need to be able to differentiate such an error.

Closes: <https://github.com/shadow-maint/shadow/issues/1103>
Suggested-by: Chris Hofstaedtler <zeha@debian.org>
Cc: Marc 'Zugschlus' Haber <mh+githubvisible@zugschlus.de>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agosrc/useradd.c: create_home(): Use !streq() instead of its pattern
Alejandro Colomar [Tue, 10 Dec 2024 14:57:58 +0000 (15:57 +0100)] 
src/useradd.c: create_home(): Use !streq() instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/chkname.c: is_valid_name(): Use streq() instead of its pattern
Alejandro Colomar [Mon, 2 Dec 2024 12:23:49 +0000 (13:23 +0100)] 
lib/chkname.c: is_valid_name(): Use streq() instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoconfigure.ac, lib/: Use __has_include(<gshadow.h>) instead of HAVE_GSHADOW_H
Alejandro Colomar [Mon, 27 Jan 2025 12:23:57 +0000 (13:23 +0100)] 
configure.ac, lib/: Use __has_include(<gshadow.h>) instead of HAVE_GSHADOW_H

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoconfigure.ac: Remove unused AC_CHECK_HEADERS() checks
Alejandro Colomar [Tue, 12 Nov 2024 13:48:52 +0000 (14:48 +0100)] 
configure.ac: Remove unused AC_CHECK_HEADERS() checks

$ grep -rE 'HAVE_(UTMP)_H'
$ grep -rE 'HAVE_(TERMIO|SGTTY|SYS_IOCTL|PATHS)_H'
$ grep -rE 'HAVE_(LASTLOG|RPC_KEY_PROT|ACL_LIBACL)_H'
$ grep -rE 'HAVE_(ATTR_LIBATTR|ATTR_ERROR_CONTEXT)_H'
$

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoconfigure.ac, lib/: Use __has_include(<sys/capability.h>) instead of HAVE_SYS_CAPABIL...
Alejandro Colomar [Tue, 12 Nov 2024 13:45:08 +0000 (14:45 +0100)] 
configure.ac, lib/: Use __has_include(<sys/capability.h>) instead of HAVE_SYS_CAPABILITY_H

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/idmapping.c: Unconditionally include <sys/prctl.h>
Alejandro Colomar [Tue, 12 Nov 2024 13:42:12 +0000 (14:42 +0100)] 
lib/idmapping.c: Unconditionally include <sys/prctl.h>

It's a widely available header.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/: Use __has_include(<security/openpam.h>) instead of HAVE_SECURITY_OPENPAM_H
Alejandro Colomar [Tue, 12 Nov 2024 13:39:03 +0000 (14:39 +0100)] 
lib/: Use __has_include(<security/openpam.h>) instead of HAVE_SECURITY_OPENPAM_H

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/: Use __has_include(<security/pam_misc.h>) instead of HAVE_SECURITY_PAM_MISC_H
Alejandro Colomar [Tue, 12 Nov 2024 13:38:10 +0000 (14:38 +0100)] 
lib/: Use __has_include(<security/pam_misc.h>) instead of HAVE_SECURITY_PAM_MISC_H

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoconfigure.ac, lib/: Use __has_include(<sys/random.h>) instead of HAVE_SYS_RANDOM_H
Alejandro Colomar [Tue, 12 Nov 2024 13:34:36 +0000 (14:34 +0100)] 
configure.ac, lib/: Use __has_include(<sys/random.h>) instead of HAVE_SYS_RANDOM_H

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoconfigure.ac, lib/: Use __has_include(<crypt.h>) instead of HAVE_CRYPT_H
Alejandro Colomar [Tue, 12 Nov 2024 13:32:33 +0000 (14:32 +0100)] 
configure.ac, lib/: Use __has_include(<crypt.h>) instead of HAVE_CRYPT_H

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/, src/: motd(): Report errors instead of exiting from library code
Alejandro Colomar [Fri, 15 Nov 2024 22:55:18 +0000 (23:55 +0100)] 
lib/, src/: motd(): Report errors instead of exiting from library code

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/motd.c: motd(): Invert logic to reduce indentation
Alejandro Colomar [Fri, 15 Nov 2024 22:50:57 +0000 (23:50 +0100)] 
lib/motd.c: motd(): Invert logic to reduce indentation

Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/, doc/: Remove pw_auth()'s $3 as dead code
Alejandro Colomar [Thu, 30 Jan 2025 12:19:03 +0000 (13:19 +0100)] 
lib/, src/, doc/: Remove pw_auth()'s $3 as dead code

We don't read the parameter at all.  Remove it.

As a consequence, all the PW_* constants are also removed (as they are
now unused).

Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/pwauth.*: PW_{ADD,CHANGE,DELETE,FTP,REXEC}: Remove dead code
Alejandro Colomar [Wed, 29 Jan 2025 16:21:33 +0000 (17:21 +0100)] 
lib/pwauth.*: PW_{ADD,CHANGE,DELETE,FTP,REXEC}: Remove dead code

These values aren't being set anywhere.

Reviewed-by: Sam James <sam@gentoo.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/, doc/: Remove dead code
Alejandro Colomar [Wed, 29 Jan 2025 15:37:51 +0000 (16:37 +0100)] 
lib/, src/, doc/: Remove dead code

pw_auth()'s $4 was always being specified as NULL.  Remove the
parameter.  Instead, set a local variable to NULL at function entry, and
remove code that never runs (conditional on $4 != NULL).

Reviewed-by: Sam James <sam@gentoo.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agosrc/vipw.c: Restore the original terminal pgrp after editing
Todd C. Miller [Fri, 24 Jan 2025 02:11:09 +0000 (19:11 -0700)] 
src/vipw.c: Restore the original terminal pgrp after editing

This fixes a problem when the shell is not in monitor mode (job control
enabled) which resulted in the terminal pgrp being set to an invalid
value once vipw exited.

Fixes: 7eca1112fbd7 (2019-11-11; "Fix vipw not resuming correctly when suspended")
Closes: <https://github.com/shadow-maint/shadow/issues/1194>
Reported-by: <https://github.com/yonecle>
Tested-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Use agetgroups() instead of its pattern
Alejandro Colomar [Tue, 19 Nov 2024 00:20:56 +0000 (01:20 +0100)] 
lib/, src/: Use agetgroups() instead of its pattern

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/shadow/grp/: agetgroups(): Add function
Alejandro Colomar [Tue, 19 Nov 2024 00:20:56 +0000 (01:20 +0100)] 
lib/shadow/grp/: agetgroups(): Add function

This encapsulates the logic for calling getgroups(3), which requires two
calls plus a malloc(3) call to do it correctly.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agoconfigure.ac, lib/, src/: Use gid_t instead of GETGROUPS_T
Alejandro Colomar [Sat, 16 Nov 2024 12:08:12 +0000 (13:08 +0100)] 
configure.ac, lib/, src/: Use gid_t instead of GETGROUPS_T

Autoconf's NEWS file says

*** AC_FUNC_GETGROUPS and AC_TYPE_GETGROUPS no longer run test programs.
  These macros were testing for OS bugs that we believe are at least
  twenty years in the past.  Most operating systems are now trusted to
  provide an accurate prototype for getgroups in unistd.h, and to
  implement it as specified in POSIX.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/adds.h: addslN(): Use QSORT() instead of its pattern
Alejandro Colomar [Thu, 14 Nov 2024 21:08:01 +0000 (22:08 +0100)] 
lib/adds.h: addslN(): Use QSORT() instead of its pattern

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/search/sort/: QSORT(): Add macro
Alejandro Colomar [Thu, 14 Nov 2024 21:04:21 +0000 (22:04 +0100)] 
lib/search/sort/: QSORT(): Add macro

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/addgrps.c: add_groups(): Remove arbitrary limit
Alejandro Colomar [Fri, 15 Nov 2024 14:11:29 +0000 (15:11 +0100)] 
lib/addgrps.c: add_groups(): Remove arbitrary limit

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Rename variables
Alejandro Colomar [Fri, 15 Nov 2024 14:24:05 +0000 (15:24 +0100)] 
lib/, src/: Rename variables

Since 'list' is used for a comma/colon-separated-value list, grouplist
is incorrect and inconsistent.  grouplist is not a list, but an array.
Use the more common convention of just using plural.  Also, use 'gids'
to distinguish it from other group representations.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/addgrps.c: add_groups(): Reallocate at once
Alejandro Colomar [Thu, 14 Nov 2024 18:58:54 +0000 (19:58 +0100)] 
lib/addgrps.c: add_groups(): Reallocate at once

We can calculate an upper bound of the number of added groups by
counting the number of delimiters in the string (plus one for the
element after the last delimiter).  This avoids reallocating +1 in a
loop.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/string/strchr/: strchrscnt(): Add function
Alejandro Colomar [Thu, 14 Nov 2024 18:54:33 +0000 (19:54 +0100)] 
lib/string/strchr/: strchrscnt(): Add function

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/addgrps.c: add_groups(): Split variable to avoid sign-mismatch diagnostics
Alejandro Colomar [Thu, 14 Nov 2024 18:29:04 +0000 (19:29 +0100)] 
lib/addgrps.c: add_groups(): Split variable to avoid sign-mismatch diagnostics

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Use LSEARCH() instead of its pattern
Alejandro Colomar [Thu, 14 Nov 2024 17:43:40 +0000 (18:43 +0100)] 
lib/, src/: Use LSEARCH() instead of its pattern

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/search/l/: LSEARCH(): Add macro
Alejandro Colomar [Thu, 14 Nov 2024 17:24:46 +0000 (18:24 +0100)] 
lib/search/l/: LSEARCH(): Add macro

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Replace redundant checks by actual error handling
Alejandro Colomar [Thu, 14 Nov 2024 18:22:16 +0000 (19:22 +0100)] 
lib/, src/: Replace redundant checks by actual error handling

setgroups(2) already performs a test to check if the number of groups is
too large.  Don't do that ourselves, and also don't do it for every
iteration.  Just let setgroups(2) do it once.

Instead of our check, let's report errors from setgroups(2).

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Unconditionally call setgroups(2)
Alejandro Colomar [Thu, 14 Nov 2024 18:05:31 +0000 (19:05 +0100)] 
lib/, src/: Unconditionally call setgroups(2)

Call it regardless of having added any groups.  If the group list is the
same that getgroups(3) gave us, setgroups(3) will be a no-op, and it
simplifies the surrounding code, by removing the 'added' variable, and
allowing to call lsearch(3) instead of lfind(3).

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/addgrps.c: add_groups(): Simplify redundant code with a goto
Alejandro Colomar [Thu, 14 Nov 2024 17:45:07 +0000 (18:45 +0100)] 
lib/addgrps.c: add_groups(): Simplify redundant code with a goto

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/addgrps.c: add_groups(): Allocate earlier
Alejandro Colomar [Thu, 14 Nov 2024 17:18:40 +0000 (18:18 +0100)] 
lib/addgrps.c: add_groups(): Allocate earlier

This will allow using lsearch(3).

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/addgrps.c: add_groups(): Remove useless cast
Alejandro Colomar [Thu, 14 Nov 2024 17:14:29 +0000 (18:14 +0100)] 
lib/addgrps.c: add_groups(): Remove useless cast

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Use LFIND() instead of open-coded search loops
Alejandro Colomar [Thu, 14 Nov 2024 14:27:16 +0000 (15:27 +0100)] 
lib/, src/: Use LFIND() instead of open-coded search loops

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/search/l/: LFIND(): Add macro
Alejandro Colomar [Thu, 14 Nov 2024 14:21:00 +0000 (15:21 +0100)] 
lib/search/l/: LFIND(): Add macro

The use of typeof() for the function pointer argument was suggested by
Jorenar.  This improves readability of these complex types.

Co-authored-by: Martin Uecker <uecker@tugraz.at>
Cc: Jorenar <dev@jorenar.com>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/search/cmp/, lib/, tests/: CMP(), cmp_*(): Add macro and functions
Alejandro Colomar [Thu, 14 Nov 2024 14:07:25 +0000 (15:07 +0100)] 
lib/search/cmp/, lib/, tests/: CMP(), cmp_*(): Add macro and functions

These macros are for use with bsearch(3),lfind(3),qsort(3).

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Simplify allocation of buffer
Alejandro Colomar [Thu, 14 Nov 2024 13:39:23 +0000 (14:39 +0100)] 
lib/, src/: Simplify allocation of buffer

getgroups(0, NULL) returns the number of groups, so that we can allocate
at once.  This might fail if there's a race and the number of users
grows while we're allocating, but if that happens, failing is probably a
good thing to do.

There was some comment saying it doesn't work on some systems, but
according to gnulib, that's only NeXTstep 3.2, which we don't support.

Link: <https://www.gnu.org/software/gnulib/manual/html_node/getgroups.html>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Un-spageticize code
Alejandro Colomar [Thu, 14 Nov 2024 12:52:31 +0000 (13:52 +0100)] 
lib/, src/: Un-spageticize code

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Reduce scope of variables
Alejandro Colomar [Thu, 14 Nov 2024 12:47:12 +0000 (13:47 +0100)] 
lib/, src/: Reduce scope of variables

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/gshadow_.h: Fix compatibility with libc's struct sgrp
Alejandro Colomar [Wed, 6 Nov 2024 13:51:06 +0000 (14:51 +0100)] 
lib/gshadow_.h: Fix compatibility with libc's struct sgrp

The name of the first field was different.  Rename for compatiblity with
libc.

$ diff -wU10 \
<(grepc sgrp . | sed_rm_ccomments) \
<(grepc sgrp /usr/include/ | sed_rm_ccomments);
--- /dev/fd/63 2024-11-06 14:49:03.287204461 +0100
+++ /dev/fd/62 2024-11-06 14:49:03.287204461 +0100
@@ -1,6 +1,7 @@
-./lib/gshadow_.h:struct sgrp {
- char *sg_name;
+/usr/include/gshadow.h:struct sgrp
+  {
+    char *sg_namp;
char *sg_passwd;
char **sg_adm;
char **sg_mem;
 };

This originates from a typo in this project, which was later copied by
glibc, and so the typo was set in stone.  The typo was eventually fixed
in shadow, but glibc had already set the name in stone, so we should
just learn to live with it.

$ grep -rn -C3 sg_name ChangeLog
1607-
1608-2011-07-30  Nicolas François  <nicolas.francois@centraliens.net>
1609-
1610: * src/chgpasswd.c: Fix typo sp -> sg. sg_namp -> sg_name
1611- * src/chgpasswd.c: Always update the group file when SHADOWGRP is
1612- not enabled.
1613-

This is a scripted change:

$ find lib* src -type f \
| xargs sed -i 's/\<sg_name\>/sg_namp/g';

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agoconfigure.ac, lib/gshadow.c: Presume working shadow group support in libc
Alejandro Colomar [Wed, 6 Nov 2024 12:07:29 +0000 (13:07 +0100)] 
configure.ac, lib/gshadow.c: Presume working shadow group support in libc

This check was testing a specific bug in a prehistoric libc version.
Red Hat 3 is long dead, and it doesn't make sense to test for that
specific bug.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/: Include <gshadow.h> if it's available
Alejandro Colomar [Wed, 6 Nov 2024 13:19:12 +0000 (14:19 +0100)] 
lib/: Include <gshadow.h> if it's available

The existing code was assuming that libc's <shadow.h> includes
<gshadow.h>.  That's not true.

alx@debian:~$ find /usr/include/shadow.h
/usr/include/shadow.h
alx@debian:~$ find /usr/include/gshadow.h
/usr/include/gshadow.h
alx@debian:~$ grep include.*gshadow /usr/include/shadow.h
alx@debian:~$

As a result, we were unconditionally including our own "gshadow_.h".

Fix that incorrect assumption, and do the following instead:

-  Include unconditionally our own "gshadow_.h".
-  Make our "gshadow_.h" include <gshadow.h> if it exists,
   and only provide the declarations otherwise.

While at it, fix the include guard to be consistent with the project.

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agoconfigure.ac, lib/: Assume initgroups(3) exists
Alejandro Colomar [Sat, 16 Nov 2024 13:02:08 +0000 (14:02 +0100)] 
configure.ac, lib/: Assume initgroups(3) exists

It's available in every system I checked: glibc,musl,{Free,Net,Open}BSD.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agoconfigure.ac, lib/, src/: Assume setgroups(2) exists
Alejandro Colomar [Sat, 16 Nov 2024 12:23:54 +0000 (13:23 +0100)] 
configure.ac, lib/, src/: Assume setgroups(2) exists

It's available in every system I checked: glibc,musl,{Free,Net,Open}BSD.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agolib/, src/: Turn error counters into flags
Tobias Stoeckmann [Mon, 20 Jan 2025 18:39:12 +0000 (19:39 +0100)] 
lib/, src/: Turn error counters into flags

If we are not interested in the amount of errors but only if errors
exist, use a flag instead of a counter. This eliminates the chance of
signed integer overflows and better reflects the meaning of variable.

Keeping variable name and basically copied from src/faillog.c.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agodoc: fix typo
Michael Vetter [Tue, 21 Jan 2025 14:38:47 +0000 (15:38 +0100)] 
doc: fix typo

3 months agosrc/gpasswd: Use correct preprocessor definition
Tobias Stoeckmann [Sun, 19 Jan 2025 20:28:25 +0000 (21:28 +0100)] 
src/gpasswd: Use correct preprocessor definition

Use PASS_MAX + 1 instead of BUFSIZ to clarify where this size comes
from. Technically, PASS_MAX is BUFSIZ - 1 so this is a no-op change.

Just make sure that the size of pass stays in sync with agetpass.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agosrc/gpasswd: Clear password in more cases
Tobias Stoeckmann [Sun, 19 Jan 2025 20:27:50 +0000 (21:27 +0100)] 
src/gpasswd: Clear password in more cases

If encryption of password fails, clear the memory before exiting.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agolib/encrypt.c: Do not exit in error case
Tobias Stoeckmann [Sun, 19 Jan 2025 20:23:54 +0000 (21:23 +0100)] 
lib/encrypt.c: Do not exit in error case

If crypt fails, pw_encrypt calls exit. This has the consequence that the
plaintext password is not cleared.

A valid password can fail if the underlying library does not support it.
One such example is SHA512, for which the password must not be longer
than 256 characters on musl. A password longer than this with glibc
works, so it is actually possible that a user, running passwd, tries to
enter the old password but the musl-based passwd binary simply exits.
Let passwd clear the password before exiting.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agoci: add openSUSE Tumbleweed
Michael Vetter [Mon, 20 Jan 2025 10:13:54 +0000 (11:13 +0100)] 
ci: add openSUSE Tumbleweed

Add an ansible task for openSUSE which will use the
configure options used by the official openSUSE package.

Signed-off-by: Michael Vetter <jubalh@iodoru.org>
3 months agoman/useradd.8.xml: wfix
Markus Hiereth [Wed, 8 Jan 2025 21:43:45 +0000 (22:43 +0100)] 
man/useradd.8.xml: wfix

Closes: Debian Bug <https://bugs.debian.org/1005253>
Cc: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agosrc/login_nopam.c: list_match(): Use iteration instead of recursion
Tobias Stoeckmann [Thu, 16 Jan 2025 20:09:54 +0000 (21:09 +0100)] 
src/login_nopam.c: list_match(): Use iteration instead of recursion

The recursive nature of list_match() triggered regression during
refactoring.  In Linux-PAM, the same code exists which could lead to
stack overflow because <access.conf> could be arbitrarily long.

Use an iterative approach for easier refactoring, to support long
lines in the future and to stay in sync with Linux-PAM.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agosrc/login_nopam.c: list_match(): Remove local variable
Alejandro Colomar [Sat, 18 Jan 2025 18:30:12 +0000 (19:30 +0100)] 
src/login_nopam.c: list_match(): Remove local variable

Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agosrc/login_nopam.c: list_match(): Move code around
Alejandro Colomar [Thu, 16 Jan 2025 21:30:56 +0000 (22:30 +0100)] 
src/login_nopam.c: list_match(): Move code around

This is just a no-op refactor in preparation for the following commits.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agosrc/login_nopam.c: list_match(): '(match)' is always true here
Alejandro Colomar [Thu, 16 Jan 2025 23:14:54 +0000 (00:14 +0100)] 
src/login_nopam.c: list_match(): '(match)' is always true here

Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agosrc/login_nopam.c: list_match(): Add superfluous else
Alejandro Colomar [Thu, 16 Jan 2025 21:25:31 +0000 (22:25 +0100)] 
src/login_nopam.c: list_match(): Add superfluous else

This is just a no-op refactor in preparation for the following commits.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agosrc/login_nopam.c: list_match(): Refactor conditional
Alejandro Colomar [Sat, 18 Jan 2025 19:16:24 +0000 (20:16 +0100)] 
src/login_nopam.c: list_match(): Refactor conditional

This is just a no-op refactor in preparation for the following commits.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
3 months agoman/passwd.1.xml: -P disables PAM support
Tobias Stoeckmann [Tue, 14 Jan 2025 20:57:09 +0000 (21:57 +0100)] 
man/passwd.1.xml: -P disables PAM support

If passwd is called with -P, then PAM handling is disabled
(src/passwd.c line 749). The manual page claims that host files would
be used, which is not true.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agochage: Drop PAM support
Tobias Stoeckmann [Tue, 14 Jan 2025 16:42:21 +0000 (17:42 +0100)] 
chage: Drop PAM support

The PAM support was only enabled with configure option
--enable-account-tools-setuid. The other account tools would use PAM
then to verify that the user is granted elevated permissions for
actions which normally only root can do.

In chage, however, any non-root user who does not specify the -l
command line option is denied access in check_perms. The check for
being root or not is done with getuid, so non-root users cannot
change user account's aging information in any possible way since
more than 18 years by now.

It's safe to say that nobody misses this non-existing feature. Biggest
benefit is to get chage out of the ACCT_TOOLS_SETUID group of tools.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agosrc/newusers.c: Turn nusers into size_t
Tobias Stoeckmann [Sun, 12 Jan 2025 18:21:09 +0000 (19:21 +0100)] 
src/newusers.c: Turn nusers into size_t

The nusers variable could, in theory, overflow and trigger an out of
boundary access if a huge amount of entries is added. Realistically,
this is not possible with current systems because way too much data
would be involved.

But let's better be safe than sorry and use correct data types.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agosrc/: Make line number overflows less likely
Tobias Stoeckmann [Sun, 12 Jan 2025 18:19:39 +0000 (19:19 +0100)] 
src/: Make line number overflows less likely

Huge files could trigger signed integer overflows if enough lines are
within the file. Use intmax_t which is at least 64 bit to move this
event far into the future.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agoman/: Install suauth.5 only if feature exists
Tobias Stoeckmann [Sun, 12 Jan 2025 17:45:13 +0000 (18:45 +0100)] 
man/: Install suauth.5 only if feature exists

Support for /etc/suauth only exists if su is installed without
PAM support. If su is not installed (--without-su) or if PAM
support is enabled (default), do not install suauth.5 manual
page.

The SU_ACCESS preprocessor definition is used to decide if
feature exists or not. See links for more details.

Link: https://github.com/shadow-maint/shadow/blob/65723c3c4704fde4cc8c94299123d3eeca81aadf/src/su.c#L558-L581
Link: https://github.com/shadow-maint/shadow/blob/65723c3c4704fde4cc8c94299123d3eeca81aadf/configure.ac#L628-L654
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
3 months agoadd and use a login.defs.test with CREATE_HOME set
Serge Hallyn [Sat, 11 Jan 2025 21:35:01 +0000 (15:35 -0600)] 
add and use a login.defs.test with CREATE_HOME set

I suspect this is not a big deal, and most distributions just ship their own
version verbatim like debian/login.defs. But if there is a distro - or even a
person - using this as is from upstream, then we dont' want to break them. So
let's undo this and use an etc/login.defs.test for the testing if needed.

Changelog: 01/13: move etc/login.defs.test to tests/system/etc/login.defs per
                  suggestion.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 months agoRevert "etc/login.defs: enable CREATE_HOME"
Serge Hallyn [Sat, 11 Jan 2025 21:22:59 +0000 (15:22 -0600)] 
Revert "etc/login.defs: enable CREATE_HOME"

This reverts commit dcb6b0f4152c1507a137640fea42401a91f22e2c.

Reported-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
3 months agoCI: run system tests
Iker Pedrosa [Thu, 21 Nov 2024 15:19:18 +0000 (16:19 +0100)] 
CI: run system tests

Run the newly created system tests in CI and collect artifacts.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 months agoetc/login.defs: enable CREATE_HOME
Iker Pedrosa [Fri, 22 Nov 2024 09:28:48 +0000 (10:28 +0100)] 
etc/login.defs: enable CREATE_HOME

In order to have consistent behaviour among all distributions, the same
configuration needs to be shared. That is why we are going to use the
`etc/login.defs` file and enable CREATE_HOME so that the home dir is
created automatically. This is not the default configuration used in all
distributions, but it is the most common one.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
3 months agotests: basic group deletion
Iker Pedrosa [Wed, 20 Nov 2024 09:41:10 +0000 (10:41 +0100)] 
tests: basic group deletion

This is the transformation to Python of the test located in
`tests/grouptools/groupdel/01_groupdel_delete_group/groupdel.test`,
which checks that `groupdel` is able to delete a group.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>