]> git.ipfire.org Git - thirdparty/shadow.git/log
thirdparty/shadow.git
25 hours agopasswd: add UPN validation support master
Iker Pedrosa [Tue, 2 Jun 2026 13:18:31 +0000 (15:18 +0200)] 
passwd: add UPN validation support

Add User Principal Name (UPN) validation to allow passwd command to
accept usernames in user@domain.com format. Currently, passwd will
accept both traditional usernames and UPN format.

Fixes: 326889ca (2024-10-22; "Fix coverity unbound buffer issues")
Closes: <https://github.com/shadow-maint/shadow/issues/1626>
Reported-by: @nooreldeenmansour
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
25 hours agotests: add unit tests for UPN validation
Iker Pedrosa [Tue, 2 Jun 2026 13:01:36 +0000 (15:01 +0200)] 
tests: add unit tests for UPN validation

Add comprehensive unit tests for is_valid_upn() function in
`tests/unit/test_chkname.c` covering:
- Valid UPN formats (user@domain.com)
- Invalid structures (missing @, multiple @)
- Domain validation (RFC compliance)
- Boundary limits (253/254 char domains, 63+ char labels)

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
25 hours agolib/chkname.*: Add UPN validation support
Iker Pedrosa [Tue, 2 Jun 2026 11:15:42 +0000 (13:15 +0200)] 
lib/chkname.*: Add UPN validation support

Add is_valid_upn() function to validate User Principal Name format.  UPN
validation splits on @ and validates the prefix using existing username
rules and suffix part using RFC 1035/1123 compliant domain name
validation.

Link: <https://datatracker.ietf.org/doc/html/rfc1035#section-2.3.1>
Co-authored-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Co-authored-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
30 hours agodoc/contributions/: Add guidelines severely restricting use of AI for contributing
Alejandro Colomar [Fri, 26 Dec 2025 17:34:02 +0000 (18:34 +0100)] 
doc/contributions/: Add guidelines severely restricting use of AI for contributing

This policy has been derived from Gentoo.  I added a requirement that
use of AI is disclosed.  And changes resulting from said use should be
disclosed in detail.  Also, I left a note saying we'll reject
non-negligible use of AI, which is a bit of an escape allowing us to
just say "too much".

Link: <https://arstechnica.com/ai/2025/07/study-finds-ai-tools-made-open-source-software-developers-19-percent-slower/>
Link: <https://petri.com/ai-coding-tools-rising-software-defects/>
Link: <https://ia.acs.org.au/article/2024/ai-coding-tools-may-produce-worse-software-.html>
Link: <https://carbonate.dev/blog/posts/the-ai-code-quality-crisis>
Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
30 hours agosrc/login_nopam.c: from_match(): Use strrspn_() instead of its pattern
Alejandro Colomar [Sun, 1 Mar 2026 21:34:00 +0000 (22:34 +0100)] 
src/login_nopam.c: from_match(): Use strrspn_() instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
30 hours agolib/string/strspn/: strr[c]spn(): Return the length counting from the end
Alejandro Colomar [Sun, 1 Mar 2026 21:27:33 +0000 (22:27 +0100)] 
lib/string/strspn/: strr[c]spn(): Return the length counting from the end

Instead of returning the offset from the start of the string, return the
length of the span counting from the end.

This makes the name of the function more representative of its behavior,
and also makes the functions more useful: one can use them as booleans
to determine whether a string ends in a set of characters or not.

if (strrspn(s, "xyz"))  // Does 's' end in any chars of "xyz"?

Currently, the only uses of strr[c]spn() are for implementing
stpr[c]spn(), so we had to update those too.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
43 hours agoUpdate translations after pre-release 4.20.0-rc1
Serge Hallyn [Wed, 17 Jun 2026 20:01:36 +0000 (15:01 -0500)] 
Update translations after pre-release

Signed-off-by: Serge Hallyn <serge@hallyn.com>
43 hours ago(pre-)Release 4.20.0-rc1
Serge Hallyn [Wed, 17 Jun 2026 15:17:01 +0000 (10:17 -0500)] 
(pre-)Release 4.20.0-rc1

First pre-release of 4.20.0, 'Ibores'.

Also bump the libsubid major version, because we have introduced
the deterministic subid calculation mode.

43 hours agoUpdate translations
Serge Hallyn [Wed, 17 Jun 2026 19:23:53 +0000 (14:23 -0500)] 
Update translations

make -C po
make -C man/po update-po

Signed-off-by: Serge Hallyn <serge@hallyn.com>
43 hours agoman/po: keep tmpdir out of po files
Serge Hallyn [Wed, 17 Jun 2026 18:55:07 +0000 (13:55 -0500)] 
man/po: keep tmpdir out of po files

When we pass every filename to the itstool call as $tmpdir/$base.out,
the file:line listed in the .po includes the $tmpdir.  That means
every update-po changes every .po.

Instead, cd to $tmpdir and pass in the basenames.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
2 days agoUpdated po/ro.po file based upon .pot file from 2025-12-30
Remus-Gabriel Chelu [Sat, 13 Jun 2026 18:55:32 +0000 (20:55 +0200)] 
Updated po/ro.po file based upon .pot file from 2025-12-30

Signed-off-by: Remus-Gabriel Chelu <remusgabriel.chelu@disroot.org>
2 days agoMake man/po update-po more robust
Serge Hallyn [Tue, 16 Jun 2026 17:35:03 +0000 (12:35 -0500)] 
Make man/po update-po more robust

There were some inconsistencies in how remove-potcdate was named.
It exists as po/remove-potcdate.sin.  The man/po tried to copy that
in, but it referred to it as remove-potcdate.sed.

Just copy it in as remove-potcdate.sed.  I think we can do better
than this, but for now this should make update-po more robust.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
8 days agolib/nss.c: Move '\n' check earlier
Alejandro Colomar [Tue, 3 Mar 2026 11:29:56 +0000 (12:29 +0100)] 
lib/nss.c: Move '\n' check earlier

If a line doesn't have a '\n', this is a problem, and the line should be
rejected, immediately.

Also, remove the '\n' during the check (with stpsep()), because we don't
want it there when handling the string.

Link: <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_387>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/nss.c: Fix error handling
Alejandro Colomar [Tue, 3 Mar 2026 15:14:50 +0000 (16:14 +0100)] 
lib/nss.c: Fix error handling

This error message didn't make much sense.  After inspecting the commit
in which it was introduced, it seems the intention was to diagnose if
the line was empty after ignoring white space.  It was incorrectly
written then, so fix it now.

Rewrite it in the following way:

-  If there's not a '\n', the entire line is bogus.  Fail, and report an
   appropriate diagnostic.

-  Then, break the string at the first white space, as we were doing
   before.  No error handling is appropriate here.

-  Then, diagnose if the remaining string is empty.

Fixes: 8492dee6 (2021-04-16; "subids: support nsswitch")
Link: <https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/V1_chap03.html#tag_03_387>
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/nss.c: Fix incorrect handling of white space
Alejandro Colomar [Tue, 3 Mar 2026 14:33:34 +0000 (15:33 +0100)] 
lib/nss.c: Fix incorrect handling of white space

Having trailing white space in a line doesn't remove the need for
a trailing '\n'.  Let's fail if a line doesn't have it, regardless of
how much trailing white space there is.

Fixes: 8492dee6 (2021-04-16; "subids: support nsswitch")
Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/: Merge "lib/string/ctype/*" files even further
Alejandro Colomar [Fri, 13 Mar 2026 00:16:26 +0000 (01:16 +0100)] 
lib/: Merge "lib/string/ctype/*" files even further

Most of these are just one-liners, so they fit in less files, and that
makes them even easier to compare all at once.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/string/ctype/strisascii.*: Don't special-case ""
Alejandro Colomar [Sat, 3 Jan 2026 13:37:43 +0000 (14:37 +0100)] 
lib/string/ctype/strisascii.*: Don't special-case ""

It is not intuitive or clear what the right behavior should be for an
empty string.  If we define these APIs as "return true if all characters
in the string belong to the specified character set", then an empty
string should return true.  On the other hand, if you ask me if an empty
string is a numeric string, I might naively say no.

It is irrelevant whether we return true or false for an empty string.
All of the callers already handle correctly the case of an empty string.

This makes the implementation simpler, using the argument only once.
This allows implementing these as macros.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/fields.c: valid_field(): Check empty string before strisprint_c()
Alejandro Colomar [Sat, 3 Jan 2026 13:33:44 +0000 (14:33 +0100)] 
lib/fields.c: valid_field(): Check empty string before strisprint_c()

This allows us to not depend on whether strisprint_c("") returns true or
false.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/string/ctype/strchrisascii.h: Use strpbrk(3) to simplify
Alejandro Colomar [Fri, 2 Jan 2026 23:37:18 +0000 (00:37 +0100)] 
lib/string/ctype/strchrisascii.h: Use strpbrk(3) to simplify

This compacts it into a one-liner, more similar to the strisascii_c()
functions.

Since we only use the argument once, we can even turn this into a macro.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/: stris*(): Rename C-locale APIs with a _c suffix
Alejandro Colomar [Fri, 2 Jan 2026 20:46:31 +0000 (21:46 +0100)] 
lib/: stris*(): Rename C-locale APIs with a _c suffix

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/string/ctype/strisascii.h: Compact definitions
Alejandro Colomar [Fri, 2 Jan 2026 20:40:57 +0000 (21:40 +0100)] 
lib/string/ctype/strisascii.h: Compact definitions

By being closer together, I find them more readable.  The pattern and
the differences are easier to spot.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/string/ctype/strisascii.h: strisprint(): Simplify implementation
Alejandro Colomar [Fri, 2 Jan 2026 20:37:55 +0000 (21:37 +0100)] 
lib/string/ctype/strisascii.h: strisprint(): Simplify implementation

This also makes it consistent with strisdigit().

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/: Merge directories "lib/string/ctype/*" into unified files
Alejandro Colomar [Fri, 2 Jan 2026 12:57:19 +0000 (13:57 +0100)] 
lib/: Merge directories "lib/string/ctype/*" into unified files

The APIs defined under each of those subdirs are too similar and related
that it makes more sense to define them in the same files.  (BTW, we
only had one API per subdir, except in one subdir that had two APIs, so
in the end, we have almost the same separation.)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/, src/: Use isascii_c() functions instead of isascii(3)
Alejandro Colomar [Fri, 2 Jan 2026 20:29:27 +0000 (21:29 +0100)] 
lib/, src/: Use isascii_c() functions instead of isascii(3)

We want to use the C locale.

Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 days agolib/string/ctype/isascii.[ch]: is*_c(): Add APIs
Alejandro Colomar [Fri, 2 Jan 2026 20:15:24 +0000 (21:15 +0100)] 
lib/string/ctype/isascii.[ch]: is*_c(): Add APIs

These are like the isascii(3) family of APIs, but use the C locale, as
the _c suffix hints.

These macros behave well with non-casted input, unlike isascii(3).

The isascii_c() and iscntrl_c() implementations are different from the
rest because they must return true for '\0'.

Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
10 days agofix: memory leak: free path/rel in shadowtcb_remove()
Artem Semenov [Mon, 1 Jun 2026 12:57:04 +0000 (15:57 +0300)] 
fix: memory leak: free path/rel in shadowtcb_remove()

In function shadowtcb_remove() (lib/tcbfuncs.c), memory allocated
for 'path' and 'rel' pointers was not released, causing a memory leak.
Added explicit free(path) and free(rel) calls before returning.

Signed-off-by: Artem Semenov <savoptik@altlinux.org>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
10 days agolib/, src/, tests/: Use LOGIN_NAME_MAX instead of sysconf(_SC_LOGIN_NAME_MAX)
Alejandro Colomar [Sat, 6 Jun 2026 23:01:37 +0000 (01:01 +0200)] 
lib/, src/, tests/: Use LOGIN_NAME_MAX instead of sysconf(_SC_LOGIN_NAME_MAX)

This provides safer guarantees.  We should be conservative in what we
accept.

Closes: <https://github.com/shadow-maint/shadow/issues/1636>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 weeks agoTests: Add two users with same UID using -o flag
aborah-sudo [Wed, 3 Jun 2026 05:39:03 +0000 (11:09 +0530)] 
Tests: Add two users with same UID using -o flag

This is the transformation to Python of the test located in
`tests/usertools/01/04_useradd_add_user_with_existing_UID_with_-o.test`
which checks that `useradd` add two users with same UID using -o flag

3 weeks agoMerge branch '2026-05-23/alx-sec' into testmaster2
Serge Hallyn [Mon, 25 May 2026 13:17:24 +0000 (08:17 -0500)] 
Merge branch '2026-05-23/alx-sec' into testmaster2

Update SECURITY.md by adding alx@kernel.org, who should have been there
long ago, and retiring Christian.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
3 weeks agoSECURITY.md: Retire Christian Brauner
Serge Hallyn [Mon, 25 May 2026 13:07:59 +0000 (08:07 -0500)] 
SECURITY.md: Retire Christian Brauner

Thanks for your help!

Signed-off-by: Serge Hallyn <serge@hallyn.com>
Cc: Christian Brauner <christian@brauner.io>
3 weeks agoAdd alx to SECURITY.md
Serge Hallyn [Sat, 23 May 2026 14:41:52 +0000 (09:41 -0500)] 
Add alx to SECURITY.md

While I'm add it, sort by first name for easy finding, and expand
my key fingerprint.  Note (verify) that it has not changed.

Signed-off-by: Serge E. Hallyn <serge@hallyn.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
4 weeks agolib: apply linux specific pid_t format consistently
Tobias Deiminger [Thu, 7 May 2026 20:47:24 +0000 (22:47 +0200)] 
lib: apply linux specific pid_t format consistently

Also change previously existing linux specific format for pid_t to %d.

Signed-off-by: Tobias Deiminger <tobias.deiminger@linutronix.de>
4 weeks agoautogen.sh: turn format issues into compiler errors
Tobias Deiminger [Thu, 7 May 2026 19:50:59 +0000 (21:50 +0200)] 
autogen.sh: turn format issues into compiler errors

This protects against undefined behavior from wrongly used conversion
specifiers.

Note: snprintf unit test intentionally uses an empty format string to
test, well, the empt format string. Thus override format-zero-length for
it.

Signed-off-by: Tobias Deiminger <tobias.deiminger@linutronix.de>
fix format error

4 weeks agolib: simplify check_status and different_namespace interface
Tobias Deiminger [Wed, 6 May 2026 12:39:39 +0000 (14:39 +0200)] 
lib: simplify check_status and different_namespace interface

Change the interface of check_status and different_namespace to take pid
and tid instead of a partially constructed path string.

This is simpler and counters bugs like in the previous commit by design.

Signed-off-by: Tobias Deiminger <tobias.deiminger@linutronix.de>
4 weeks agouserdel: fix user busy detection for threads
Tobias Deiminger [Wed, 6 May 2026 12:39:39 +0000 (14:39 +0200)] 
userdel: fix user busy detection for threads

On Linux, userdel/usermod check all /proc/<pid> status files to ensure a
to-be-modified user has no more running tasks, or abort modification
otherwise.

However, the check failed to detect threads running as the user if the
corresponding main thread ran as a different user. The user is deleted
despite still being busy. This is due to passing a wrong value to
check_status. The caller passed "<pid>/task", rather than
"<pid>/task/<tid>". In consequence check_status tried to open
"/proc/<pid>/task/status" - a wrong path that never exists - open fails,
and check_status always returns 0. The correct status file name would
have been "/proc/<pid>/task/<tid>/status" instead.

The bug can only be reproduced by rather exotic code using raw syscalls.
POSIX does not allow threads to have different UIDs.

To fix it, construct the correct path to the tid status file in the
caller, before passing it to check_status.

Reproducer:

  // setuid_thread.c

  #include <pthread.h>
  #include <pwd.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <sys/syscall.h>
  #include <unistd.h>

  static uid_t target_uid;

  static void *user_thread(void *arg)
  {
          syscall(SYS_setuid, (long)target_uid);
          for (;;) {
                  printf("thread running as uid %d (pid=%d)\n", (int)target_uid,
                         (int)getpid());
                  sleep(5);
          }
          return NULL;
  }

  int main(int argc, char *argv[])
  {
          if (argc < 2) {
                  fprintf(stderr, "Usage: %s <username>\n", argv[0]);
                  return 1;
          }

          struct passwd *pw = getpwnam(argv[1]);
          if (!pw) {
                  fprintf(stderr, "user not found: %s\n", argv[1]);
                  return 1;
          }
          target_uid = pw->pw_uid;

          pthread_t tid;
          pthread_create(&tid, NULL, user_thread, NULL);
          sleep(60);
          return 0;
  }

Execute in a shell

  gcc setuid_thread.c -o setuid_thread
  sudo useradd --no-create-home testuser
  sudo ./setuid_thread testuser &
  sudo userdel testuser

Behavior without fix:
No output, testuser is deleted.

Behavior with fix:
Output "userdel: user testuser is currently used by process 178863".
testuser is not deleted.

Signed-off-by: Tobias Deiminger <tobias.deiminger@linutronix.de>
5 weeks agolib/string/README: Document stprintf(,0,)
Alejandro Colomar [Wed, 13 May 2026 13:00:50 +0000 (15:00 +0200)] 
lib/string/README: Document stprintf(,0,)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/salt.c: Use stprintf() instead of snprintf(3)
Alejandro Colomar [Sat, 8 Feb 2025 15:36:26 +0000 (16:36 +0100)] 
lib/salt.c: Use stprintf() instead of snprintf(3)

Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/string/strcpy/: stpecpy(): Use strtcpy() instead of its pattern
Alejandro Colomar [Mon, 21 Jul 2025 14:56:34 +0000 (16:56 +0200)] 
lib/string/strcpy/: stpecpy(): Use strtcpy() instead of its pattern

Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/string/: seprintf(), stpecpy(): Add missing const
Alejandro Colomar [Sun, 16 Mar 2025 20:56:25 +0000 (21:56 +0100)] 
lib/string/: seprintf(), stpecpy(): Add missing const

Reported-by: Christopher Bazley <chris.bazley.wg14@gmail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/, po/, src/: Rename stpeprintf() => seprintf()
Alejandro Colomar [Mon, 10 Feb 2025 14:06:34 +0000 (15:06 +0100)] 
lib/, po/, src/: Rename stpeprintf() => seprintf()

The old name was too complex, and is inconsistent with all other
sprintf(3)-based APIs having just one letter for differentiation.
This allows breaking less lines.

The original name was chosen for differentiation with the buggy Plan9
API seprint(2).  However, 9front (the current fork where Plan9 is mainly
developed) has acknowledged the bug.  There's still no decision on
fixing the bug or not, due to the age of their code base, and the
projects depending on their library.  It is under consideration
inventing something like a seprint2(2) in 9front for replacement of
seprint(2), but there's no decision yet either.

Considering that 9front acknowledges their bug, and that they *may*
release a fixed API with a similar name, we may as well claim that our
seprintf() is also a fixed version of Plan9's seprint(2).  It has a
different name, after all (we terminate in 'f').

This commit was partially scripted with

$ find * -type f \
| xargs grep -l stpeprintf \
| xargs sed -i 's/stpeprintf/seprintf/g';

Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/, src/, tests/: Rename snprintf_() => stprintf()
Alejandro Colomar [Sat, 8 Feb 2025 15:30:58 +0000 (16:30 +0100)] 
lib/, src/, tests/: Rename snprintf_() => stprintf()

For consistency with strTcpy(), call it sTprintf().

Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/string/: Compact documentation
Alejandro Colomar [Mon, 10 Feb 2025 13:49:53 +0000 (14:49 +0100)] 
lib/string/: Compact documentation

In the case of [v]snprintf_(), anticipate the rename in the next commit.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/string/: Redesign stpecpy() and stpeprintf()
Alejandro Colomar [Sat, 8 Feb 2025 13:41:16 +0000 (14:41 +0100)] 
lib/string/: Redesign stpecpy() and stpeprintf()

Make them report truncation via errno and NULL.

Instead of having three possible returns (a pointer to the NUL byte, the
end of the array, or NULL), reduce it to two possible ones: one for
success, and one for error.

Use errno, which is a common way to signal the specific error, and thus
treat truncation as any other error.  This simplifies error handling
after these calls.  Also, if one misuses a pointer after truncation, the
results are better if the pointer is NULL: the program will easily
abort.  If we returned 'end', the program could more easily produce a
buffer overrun.

Suggested-by: Douglas McIlroy <douglas.mcilroy@dartmouth.edu>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/string/: vsnprintf_(), strtcpy(): abort() if size==0
Alejandro Colomar [Fri, 5 Dec 2025 11:15:44 +0000 (12:15 +0100)] 
lib/string/: vsnprintf_(), strtcpy(): abort() if size==0

There's nothing better that can be done.

Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/string/sprintf/: snprintf_(): Use ssize_t instead of size_t in $2
Alejandro Colomar [Sat, 8 Feb 2025 15:19:02 +0000 (16:19 +0100)] 
lib/string/sprintf/: snprintf_(): Use ssize_t instead of size_t in $2

vsnprintf(3) returns an int.  By using ssize_t, which is also signed, we
avoid the need for a cast.

Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agolib/string/: vsnprintf_(), strtcpy(): Set errno = E2BIG on truncation
Alejandro Colomar [Sat, 8 Feb 2025 15:13:39 +0000 (16:13 +0100)] 
lib/string/: vsnprintf_(), strtcpy(): Set errno = E2BIG on truncation

Signed-off-by: Alejandro Colomar <alx@kernel.org>
5 weeks agoman/login.defs.5.xml: clarify documentation for multi-component usage
Iker Pedrosa [Tue, 12 May 2026 12:24:35 +0000 (14:24 +0200)] 
man/login.defs.5.xml: clarify documentation for multi-component usage

The login.defs configuration file is used by multiple system components
(shadow-utils, PAM, util-linux), but the documentation was unclear about
this reality. This led to confusion about which parameters are relevant
on different system configurations.

Add explanatory paragraph clarifying that login.defs parameters may be
used by shadow-utils, PAM, and other system components, with behaviour
depending on system configuration and enabled authentication mechanisms.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
5 weeks agoTests: Unlock user password
aborah-sudo [Tue, 12 May 2026 02:05:26 +0000 (07:35 +0530)] 
Tests: Unlock user password

This is the transformation to Python of the test located in
`tests/usertools/01/11_usermod_lock_password.test`
which checks that `usermod` can lock user password

5 weeks agoTests: Change user password
aborah-sudo [Fri, 8 May 2026 08:31:53 +0000 (14:01 +0530)] 
Tests: Change user password

This is the transformation to Python of the test located in
`tests/usertools/01/11_usermod_change_password.test`
which checks that `usermod` can change user password

5 weeks agoTests: Rename user who is member of a group
aborah-sudo [Fri, 8 May 2026 08:27:59 +0000 (13:57 +0530)] 
Tests: Rename user who is member of a group

This is the transformation to Python of the test located in
`tests/usertools/01/10_usermod_rename_user_in_group.test`
which checks that `usermod` can rename user who is member of a group

5 weeks agoTests: Add passlib to requirements.txt for proper crypt hash generation
aborah-sudo [Mon, 4 May 2026 08:45:43 +0000 (14:15 +0530)] 
Tests: Add passlib to requirements.txt for proper crypt hash generation

Added passlib dependency for generating valid SHA-512 crypt hashes

6 weeks agoTests: Add a new user with home directory creation
aborah-sudo [Fri, 17 Apr 2026 04:34:49 +0000 (10:04 +0530)] 
Tests: Add a new user with home directory creation

This is the transformation to Python of the test located in
`tests/usertools/01/17_useradd_create_homedir.test`
which checks that `useradd` can add a new user with --create-home

6 weeks agotests: implement login.defs configuration utility
aborah-sudo [Mon, 20 Apr 2026 13:53:18 +0000 (19:23 +0530)] 
tests: implement login.defs configuration utility

Introduce LoginDefsConfig class for /etc/login.defs manipulation.
It supports getting, setting, and removing configuration options
with automatic backup and restoration.

6 weeks agoAdd --disable-syslog configure option
Dmitry Sakhonchik [Tue, 28 Apr 2026 11:29:29 +0000 (14:29 +0300)] 
Add --disable-syslog configure option

It allows build systems like Yocto to disable syslog calls during native builds, preventing log spam on the build host.

Closes: <https://github.com/shadow-maint/shadow/issues/1610>
Signed-off-by: Dmitry Sakhonchik <frezidok1@gmail.com>
6 weeks agoAdd LOGIN_SHELL_FALLBACK to FOREIGNDEFS
Stanislav Brabec [Thu, 30 Apr 2026 04:11:39 +0000 (06:11 +0200)] 
Add LOGIN_SHELL_FALLBACK to FOREIGNDEFS

util-linux-2.42 introduced new variable: LOGIN_SHELL_FALLBACK.
Add it to known login.defs variables.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
6 weeks agopo: Update Georgian translation
NorwayFun [Sun, 19 Apr 2026 08:42:50 +0000 (10:42 +0200)] 
po: Update Georgian translation

7 weeks agouseradd: fix btrfs subvolume creation for single-component basedir
Hadi Chokr [Tue, 28 Apr 2026 10:18:43 +0000 (12:18 +0200)] 
useradd: fix btrfs subvolume creation for single-component basedir

dirname() replaces broken stpcpy index arithmetic that produced an
empty string for single-component paths (e.g. /koolhome), causing
statfs to fail and fall back to a regular directory. Use path in
the error message since dirname() modifies btrfs_check in-place,
making it unusable for logging after the call.

Fixes: c1d36a8acb1d (2019-05-04; "Add support for btrfs subvolumes for user homes")
Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
7 weeks agotests: update newgrp tests to expect GID 1002
Iker Pedrosa [Tue, 14 Apr 2026 11:31:24 +0000 (13:31 +0200)] 
tests: update newgrp tests to expect GID 1002

Update test assertion to expect GID 1002 instead of 1001 to match
the new container environment where a CI user occupies ID 1000.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
7 weeks agotests: update vipw tests to expect ID 1001
Iker Pedrosa [Tue, 14 Apr 2026 11:28:56 +0000 (13:28 +0200)] 
tests: update vipw tests to expect ID 1001

Update test assertions to expect ID 1001 instead of 1000 to match
the new container environment where a CI user occupies ID 1000.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
7 weeks agotests: update usermod tests to expect ID 1001
Iker Pedrosa [Tue, 14 Apr 2026 11:28:03 +0000 (13:28 +0200)] 
tests: update usermod tests to expect ID 1001

Update test assertions to expect ID 1001 instead of 1000 to match
the new container environment where a CI user occupies ID 1000.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
7 weeks agotests: update groupadd tests to expect GID 1001
Iker Pedrosa [Tue, 14 Apr 2026 11:25:31 +0000 (13:25 +0200)] 
tests: update groupadd tests to expect GID 1001

Update test assertions to expect GID 1001 instead of 1000 to match
the new container environment where a CI user occupies ID 1000.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
7 weeks agotests: update useradd tests to expect ID 1001
Iker Pedrosa [Tue, 14 Apr 2026 11:23:40 +0000 (13:23 +0200)] 
tests: update useradd tests to expect ID 1001

Update test assertions to expect ID 1001 instead of 1000 to match
the new container environment where a CI user occupies ID 1000.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
7 weeks agotests: add CI user creation to simulate cloud VM environments
Iker Pedrosa [Tue, 14 Apr 2026 11:19:10 +0000 (13:19 +0200)] 
tests: add CI user creation to simulate cloud VM environments

Create a 'ci' user in all distribution-specific ansible roles to
simulate cloud VM environments where ID 1000 is already taken. This
ensures that test users start the ID assignment at 1001, making
container tests consistent with cloud CI environments.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
7 weeks agotests/system/framework/hosts/shadow.py: fix restore when /home is a mount point
Iker Pedrosa [Tue, 14 Apr 2026 10:52:09 +0000 (12:52 +0200)] 
tests/system/framework/hosts/shadow.py: fix restore when /home is a mount point

Handle cases where /home is mounted separately by using selective
cleanup instead of attempting to remove the mount point, which causes
"Device or resource busy" errors in cloud environments.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
8 weeks agoman/useradd.8.xml: Remove trailing spaces from useradd.8.xml
Hadi Chokr [Mon, 20 Apr 2026 10:27:31 +0000 (12:27 +0200)] 
man/useradd.8.xml: Remove trailing spaces from useradd.8.xml

Signed-off-by: Hadi Chokr <hadichokr@icloud.com>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
8 weeks agouseradd(8): fallback to regular dir for BTRFS home on non-BTRFS parent
Hadi Chokr [Tue, 21 Apr 2026 07:18:19 +0000 (09:18 +0200)] 
useradd(8): fallback to regular dir for BTRFS home on non-BTRFS parent

When the --btrfs-subvolume-home option is used but the parent directory
is not on a BTRFS filesystem, useradd previously failed with an error.
This is too strict; instead, fall back to creating a regular directory
and issue a warning.  The subvolume creation is attempted only when the
parent is BTRFS.  Otherwise, a regular directory is created and a
syslog(3) warning is logged.

Fixes: 3e8c105 (2026-01-02; "src/useradd: Support config for creating home dirs as Btrfs subvolumes")
Co-authored-by: Hadi Chokr <hadichokr@icloud.com>
Co-authored-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 weeks agolib/, src/: Move btrfs.c prototypes to lib/btrfs.h
Alejandro Colomar [Wed, 22 Apr 2026 09:21:14 +0000 (11:21 +0200)] 
lib/, src/: Move btrfs.c prototypes to lib/btrfs.h

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 weeks agolib/, src/: Move statfs(2) call out of is_btrfs()
Alejandro Colomar [Wed, 22 Apr 2026 09:14:20 +0000 (11:14 +0200)] 
lib/, src/: Move statfs(2) call out of is_btrfs()

This simplifies the return value of is_btrfs() into a boolean.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
8 weeks agolib/btrfs.c: btrfs_is_subvolume(): Simplify error check
Alejandro Colomar [Wed, 22 Apr 2026 09:02:36 +0000 (11:02 +0200)] 
lib/btrfs.c: btrfs_is_subvolume(): Simplify error check

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agogroupadd: fix system account help text 1609/head
Thomas Schuster [Thu, 9 Apr 2026 12:03:48 +0000 (14:03 +0200)] 
groupadd: fix system account help text

Co-authored-by: Valentin Mücklausch <143010987+Mozzarella32@users.noreply.github.com>
Co-authored-by: Benno Raupach <28948901+braupach@users.noreply.github.com>
2 months agoTests: Add a new user with supplementary groups using default primary group 1586/head
aborah-sudo [Fri, 10 Apr 2026 07:46:07 +0000 (13:16 +0530)] 
Tests: Add a new user with supplementary groups using default primary group

This is the transformation to Python of the test located in
`tests/usertools/01/16_useradd_add_user_to_one_group.test` which checks that
`useradd` can add a new user with specific group

2 months agoTests: Verify user creation fails when UID exceeds maximum allowed value (2^32 - 1)
aborah-sudo [Wed, 8 Apr 2026 11:37:22 +0000 (17:07 +0530)] 
Tests: Verify user creation fails when UID exceeds maximum allowed value (2^32 - 1)

This is the transformation to Python of the test located in
`tests/usertools/01/26_useradd_UID_-1.test`
which checks that `useradd` can not add a new user with specific uid

2 months agoTests: Add a new user with custom primary group and supplementary groups
aborah-sudo [Wed, 8 Apr 2026 10:22:48 +0000 (15:52 +0530)] 
Tests: Add a new user with custom primary group and supplementary groups

This is the transformation to Python of the test located in
`tests/usertools/01/16_useradd_add_user_to_multiple_groups.test`
which checks that `useradd` can add a new user with specific group

2 months agoTests: Verify user creation succeeds with large valid UIDs
aborah-sudo [Tue, 7 Apr 2026 10:20:51 +0000 (15:50 +0530)] 
Tests: Verify user creation succeeds with large valid UIDs

This is the transformation to Python of the test located in
`tests/usertools/01/25_useradd_specified_large_UID2.test`,
which checks that `useradd` can add a new user with large UID

2 months agosubid: setup deterministic_wrap mode
Pat Riehecky [Fri, 13 Mar 2026 14:25:41 +0000 (09:25 -0500)] 
subid: setup deterministic_wrap mode

This adds two new options to /etc/login.defs:
* UNSAFE_SUB_UID_DETERMINISTIC_WRAP
* UNSAFE_SUB_GID_DETERMINISTIC_WRAP

Deterministic subordinate ID allocation ties each user's subid range
directly to their UID, giving consistent, reproducible ranges across all
hosts without a shared database.  This property breaks down when the
subordinate ID space is exhausted.

With a UID space that on Linux extends to 2^32-1 and the traditional
per-user subid allocation of 2^16 ranges, a site with a large UID
population could exhaust the subordinate ID space before all user UIDs
are allocated.

UNSAFE_SUB_UID_DETERMINISTIC_WRAP and UNSAFE_SUB_GID_DETERMINISTIC_WRAP
provide an explicit opt-in to modulo (ring-buffer) wrapping as a
predictable last resort.  This preserves the deterministic allocation
at the risk of subid overlap.

The UNSAFE_ prefix and the required explicit opt-in are intentional.

Overlapping ranges break namespace isolation and can allow container
escapes and privilege escalation between users whose ranges collide.

These options are appropriate only when all of the following hold:
  - Strict subid determinism is require
  - The active UID population on the host is small and well-known
  - The administrator regularly audits the UID distribution and confirms
    no two active users produce overlapping computed ranges

Do not enable these options on hosts with an uncontrolled user population.

Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
2 months agosubid: Define settings for deterministic wrap subid ranges
Pat Riehecky [Mon, 30 Mar 2026 18:27:45 +0000 (13:27 -0500)] 
subid: Define settings for deterministic wrap subid ranges

They are not active at this commit, but they are documented.

Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
2 months agosubid: Add deterministic subid ranges
Pat Riehecky [Mon, 16 Mar 2026 13:21:30 +0000 (08:21 -0500)] 
subid: Add deterministic subid ranges

This adds two new options to /etc/login.defs:
* SUB_UID_DETERMINISTIC
* SUB_GID_DETERMINISTIC

In a lab where users are created ad hoc subids might drift
from one host to the other. If there is a shared home area,
this drift can create some frustration.

Creating subids deterministically provides one type of solution
to this problem. Use of nonconsecutive UIDs will result in blocks
of unused subids.

The manpages provide documentation on how these can be used.

Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
2 months agosubid: Define settings for deterministic subid ranges
Pat Riehecky [Mon, 30 Mar 2026 18:24:37 +0000 (13:24 -0500)] 
subid: Define settings for deterministic subid ranges

They are not active at this commit, but they are documented.

Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
2 months agosubid: Move linear allocation into its own function
Pat Riehecky [Mon, 16 Mar 2026 13:18:36 +0000 (08:18 -0500)] 
subid: Move linear allocation into its own function

Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
2 months agolib/: find_new_sub_[ug]ids(): Remove redundant checks
Alejandro Colomar [Sun, 15 Mar 2026 14:57:43 +0000 (15:57 +0100)] 
lib/: find_new_sub_[ug]ids(): Remove redundant checks

find_free_range() already checks this, and does it better.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/subordinateio.c: find_free_range(): Validate input more carefully
Alejandro Colomar [Sun, 15 Mar 2026 14:55:30 +0000 (15:55 +0100)] 
lib/subordinateio.c: find_free_range(): Validate input more carefully

Cc: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/: find_free_range(): Set errno on error
Alejandro Colomar [Sun, 15 Mar 2026 14:34:09 +0000 (15:34 +0100)] 
lib/: find_free_range(): Set errno on error

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/subordinateio.c: find_free_range(): Use id_t instead of u_long
Alejandro Colomar [Sun, 15 Mar 2026 14:31:09 +0000 (15:31 +0100)] 
lib/subordinateio.c: find_free_range(): Use id_t instead of u_long

It's the natural type for this API, and it's also more
consistent with its wrappers.

Let's also use literal -1 for the error code, which is safer than
unsigned constants, as -1 is sign-extended to fit whatever unsigned type
we're using.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoautogen.sh: CFLAGS: Add -Werror=overflow
Alejandro Colomar [Sun, 15 Mar 2026 18:46:49 +0000 (19:46 +0100)] 
autogen.sh: CFLAGS: Add -Werror=overflow

This helped find a bug, and doesn't seem to have any false positives
here, so let's use it.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoautogen.sh: CFLAGS: Remove -Werror=sign-compare
Alejandro Colomar [Sun, 15 Mar 2026 15:19:31 +0000 (16:19 +0100)] 
autogen.sh: CFLAGS: Remove -Werror=sign-compare

GCC has issues with literal -1.

Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119011>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/, src/: find_new_sub_[ug]ids(): Report errors through errno
Alejandro Colomar [Sun, 15 Mar 2026 14:09:18 +0000 (15:09 +0100)] 
lib/, src/: find_new_sub_[ug]ids(): Report errors through errno

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agolib/: find_new_sub_*ids(): Remove dead assertions
Alejandro Colomar [Sun, 15 Mar 2026 13:05:21 +0000 (14:05 +0100)] 
lib/: find_new_sub_*ids(): Remove dead assertions

The input to these functions is always an address (&x); that's
guaranteed to be non-null.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agologin: Delete creds if pam_open_session fails
Tobias Stoeckmann [Tue, 24 Mar 2026 14:14:12 +0000 (15:14 +0100)] 
login: Delete creds if pam_open_session fails

Call pam_setcreds if pam_open_session fails. This deletes credentials
which are allocated with a previous pam_setcreds call.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 months agologin: Call pam_close_session only with session
Tobias Stoeckmann [Tue, 24 Mar 2026 14:10:17 +0000 (15:10 +0100)] 
login: Call pam_close_session only with session

If authentication fails, call pam_end without pam_close_session, since
at this point, pam_open_session was never called.

Only two callers of PAM_END benefit from the macro, which is not worth
it. Inlined PAM_END instead.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 months agologin: Call pam_open_session after pam_setcred
Tobias Stoeckmann [Tue, 24 Mar 2026 13:36:14 +0000 (14:36 +0100)] 
login: Call pam_open_session after pam_setcred

According to Linux-PAM's pam_setcred(3) and su implementation,
credentials shall be set before session is opened.

Adjust login to follow this rule, which is also applied by util-linux
login/su and at least gdm (didn't check more implementations).

The current style matches Appendix B of X/Open RFC 86.0 (from 1995).

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2 months agoman/passwd.5.xml: CAVEATS: Add section
Alejandro Colomar [Tue, 31 Mar 2026 12:50:00 +0000 (14:50 +0200)] 
man/passwd.5.xml: CAVEATS: Add section

Document that when reading passwd(5), the C locale should be used.

Cc: Iker Pedrosa <ipedrosa@redhat.com>
Cc: Mantas Mikulėnas <grawity@gmail.com>
Cc: KhaelK-Praetorian <khael.kugler@praetorian.com>
Cc: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoRevert "strchriscntrl: reject C1 control bytes (0x80-0x9F)"
Alejandro Colomar [Wed, 25 Mar 2026 21:00:40 +0000 (22:00 +0100)] 
Revert "strchriscntrl: reject C1 control bytes (0x80-0x9F)"

C1 control bytes are more complicated than that.  They're represented as
two bytes in UTF-8.

Commit 19d725da, has issues, rejecting otherwise valid UTF-8 multi-byte
characters.

We could in theory do correct parsing of UTF, possibly parsing the
multi-byte sequences, or translating to wchar_t.  However, that would
complicate the source code well beyond what I'd be comfortable with.

Instead, let's revert this, and claim no intention to support UTF-8.
If an admin uses a UTF-8 locale while reading /etc/passwd, that's their
own fault.

Reverts: 19d725da (2026-03-13; "strchriscntrl: reject C1 control bytes (0x80-0x9F)")
Fixes: 19d725da (2026-03-13; "strchriscntrl: reject C1 control bytes (0x80-0x9F)")
Closes: <https://github.com/shadow-maint/shadow/issues/1598>
Reported-by: Mantas Mikulėnas <grawity@gmail.com>
Cc: KhaelK-Praetorian <khael.kugler@praetorian.com>
Cc: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
2 months agoTests: Add a new user with a specified large UID
aborah-sudo [Tue, 31 Mar 2026 04:23:42 +0000 (09:53 +0530)] 
Tests: Add a new user with a specified large UID

This is the transformation to Python of the test located in
`tests/usertools/01/15_useradd_specified_large_UID.test` which
checks that `useradd` can add a new user with large UID

2 months agoTests: Add a new user with an invalid UID
aborah-sudo [Tue, 31 Mar 2026 04:16:02 +0000 (09:46 +0530)] 
Tests: Add a new user with an invalid UID

This is the transformation to Python of the test located in
`tests/usertools/01/13_useradd_negative_UID.test`,
`tests/usertools/01/14_useradd_out_of_range_UID.test`
which checks that `useradd` can not add a new user with invalid UID

2 months agoman/po: fix pot file syntax errors after `groupmems` removal
Iker Pedrosa [Wed, 25 Mar 2026 14:04:35 +0000 (15:04 +0100)] 
man/po: fix pot file syntax errors after `groupmems` removal

Regenerate shadow-man-pages.pot to remove orphaned translation entries
and fix embedded temporary paths that were causing `msgmerge` failures
in CI.

Acked-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2 months ago*/: groupmems(8): Remove program
Iker Pedrosa [Wed, 25 Mar 2026 13:37:01 +0000 (14:37 +0100)] 
*/: groupmems(8): Remove program

The utility is redundant for root and effectively broken for regular
users across major distributions, its continued maintenance adds
complexity for little to no benefit.

Closes: https://github.com/shadow-maint/shadow/issues/1343
Acked-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2 months agotest/libsubid: update 01_list_ranges
Pat Riehecky [Fri, 13 Mar 2026 21:04:46 +0000 (16:04 -0500)] 
test/libsubid: update 01_list_ranges

Now that user resolution is required, ensure a resolvable user is used.

Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
2 months agosubid: Remove get_owner_id
Pat Riehecky [Tue, 10 Mar 2026 23:58:33 +0000 (18:58 -0500)] 
subid: Remove get_owner_id

There are no longer any callers for get_owner_id so it can be removed.

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
2 months agosubid: start using SUB_UID_STORE_BY_UID/GID
Pat Riehecky [Wed, 11 Mar 2026 17:28:42 +0000 (12:28 -0500)] 
subid: start using SUB_UID_STORE_BY_UID/GID

This adds two new options to /etc/login.defs:
* SUB_UID_STORE_BY_UID
* SUB_GID_STORE_BY_UID

They default to 'no' but when set 'yes' the subuid/subgid
entries will be written by uid rather than username.

Closes: https://github.com/shadow-maint/shadow/issues/1554
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Pat Riehecky <riehecky@fnal.gov>
2 months agosubid: Define SUB_UID_STORE_BY_UID and SUB_GID_STORE_BY_UID
Pat Riehecky [Tue, 10 Mar 2026 14:51:58 +0000 (09:51 -0500)] 
subid: Define SUB_UID_STORE_BY_UID and SUB_GID_STORE_BY_UID

They are not active within this commit, but they are fully documented

Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Pat Riehecky <riehecky@fnal.gov>