Tobias Stoeckmann
e6a5484ced
lib: Eliminate dead code
...
The tz function is only called if ENV_TZ starts with a slash.
If the specified file cannot be read, the code implies that ENV_TZ
would be returned if it does not start with a slash.
Since we know that it DOES start with a slash, the code can be
simplified to state that "TZ=CST6CDT" is returned as a default if
the specified file cannot be read.
Benefit of this change is that strcpy's use case here can be
easier verified.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org >
2024-09-29 12:23:05 +02:00
Tobias Stoeckmann
dd6cddd481
lib/run_part: Adjust style
...
Remove some of these whitespaces.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org >
2024-09-18 14:52:05 +02:00
Tobias Stoeckmann
76c97ed7ec
lib/run_part: Unify error messages
...
At least if they can be assigned directly to a function call.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org >
2024-09-18 14:52:05 +02:00
Tobias Stoeckmann
62bd261fbe
lib: Fix typo
...
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org >
2024-09-18 14:52:05 +02:00
Tobias Stoeckmann
6b4487e173
lib/run_part: Reduce visibility
...
The run_part function is only used in run_part.c itself, so no
need to expose it to other files.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org >
2024-09-18 14:52:05 +02:00
Tobias Stoeckmann
db395130d1
lib/run_part: Unify logging
...
Use shadow_logfd for logging instead of fixed stderr to use
shadow's own logging infrastructure.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org >
2024-09-18 14:52:05 +02:00
Tobias Stoeckmann
3ac50e1d02
lib/run_part: Use correct data types
...
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org >
2024-09-18 14:52:05 +02:00
Tobias Stoeckmann
81078c57fb
Fix typos
...
Typos in comments and configure output, i.e. no functional change.
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org >
2024-09-13 22:27:08 +02:00
Iker Pedrosa
8903b94c86
useradd: fix write_full() return value
...
write_full() returns -1 on error and useradd was checking another value.
Closes: https://github.com/shadow-maint/shadow/issues/1072
Fixes: f45498a6c2 ("libmisc/write_full.c: Improve write_full()")
Reported-by: <https://github.com/brown-midas >
Suggested-by: <https://github.com/brown-midas >
Reviewed-by: Alejandro Colomar <alx@kernel.org >
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-09-13 09:44:51 +02:00
Pino Toscano
b2b37863a6
lib/user_busy.c: Include <utmpx.h>
...
Since:
- utmpx APIs are used in non-Linux code blocks
- <utmpx.h> is already unconditionally included in Linux parts in other
files
then unconditionally include it in this file as well.
Signed-off-by: Pino Toscano <toscano.pino@tiscali.it >
2024-09-12 11:43:39 +02:00
Alejandro Colomar
1f11a5ce5a
src/: Recommend --badname only if it is useful
...
(Review with -w (--ignore-all-space).)
Closes: <https://github.com/shadow-maint/shadow/issues/1067 >
Reported-by: Anselm Schüler <mail@anselmschueler.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-09-01 08:17:11 -05:00
Alejandro Colomar
0663c91f80
src/: Invert logic to improve readability
...
And remove the (now) redundant comments.
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-09-01 08:17:11 -05:00
Alejandro Colomar
1c127bd173
lib/chkname.c: is_valid_{user,group}_name(): Set errno to distinguish the reasons
...
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-09-01 08:17:11 -05:00
Alejandro Colomar
56d52997c3
man/userdel.8.xml: Reword '-f'
...
The previous wording seemed to say that -f implied -r. It doesn't; -f
only skips safety checks, so reword accordingly.
Closes: <https://github.com/shadow-maint/shadow/issues/1062 >
Reported-by: Martin von Wittich <martin.von.wittich@iserv.eu >
Cc: "Serge E. Hallyn" <serge@hallyn.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-09-01 07:45:30 -05:00
Alejandro Colomar
f5806e0511
lib/: Chain free(strzero(s))
...
This reduces the repetition of the argument, which could be error-prone.
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-08-30 21:44:07 -05:00
Alejandro Colomar
dab8de8a72
lib/string/memset/: memzero(), strzero(): Return the pointer
...
This allows chaining with free(3) on the same line.
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-08-30 21:44:07 -05:00
Alejandro Colomar
87a5145719
lib/: Move memzero.[ch] under lib/string/memset/
...
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-08-30 21:44:07 -05:00
Alejandro Colomar
5c0b99c77e
po/es.po: wsfix
...
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-08-22 22:51:57 -05:00
Alejandro Colomar
3dc840a56a
lib/string/strftime.h: STRFTIME(): Tighten macro definition
...
strftime(3) is not a variadic function; there's exactly one argument
after the format string.
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-08-22 22:51:57 -05:00
Alejandro Colomar
60da937c2f
src/chage.c: print_day_as_date(): Handle errors from strfime(3)
...
Just like we do in day_to_str().
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-08-22 22:51:57 -05:00
Alejandro Colomar
6a2e298a5b
src/chage.c: print_day_as_date(): Simplify error handling
...
If localtime_r(3) fails, just print future, as we do in day_to_str().
It should only fail for unrealistic dates, if at all.
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-08-22 22:51:57 -05:00
Alejandro Colomar
683b3caa62
lib/, src/: Use %F instead of %Y-%m-%d with strftime(3)
...
%F is specified by ISO C99. It adds semantic meaning as printing an
ISO 8601 date.
Scripted change:
$ cat ~/tmp/spatch/strftime_F.sp
@@
@@
- "%Y-%m-%d"
+ "%F"
$ find contrib/ lib* src/ -type f \
| xargs spatch --sp-file ~/tmp/spatch/strftime_F.sp --in-place
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-08-22 22:51:57 -05:00
Chris Hofstaedtler
04592e4cc7
Remove references to cppw, cpgr
...
cppw, cpgr were Debian-only tools, which I've dropped in a recent upload.
Upstream should have never had tests for them.
Signed-off-by: Chris Hofstaedtler <zeha@debian.org >
2024-08-12 10:08:45 +02:00
Carles Pina i Estany
e04e493234
Update Catalan translation
2024-08-11 23:22:04 +02:00
Alejandro Colomar
3f5b4b5626
lib/, src/: Use local time for human-readable dates
...
That is, use localtime_r(3) instead of gmtime_r(3).
Closes: <https://github.com/shadow-maint/shadow/issues/1057 >
Reported-by: Gus Kenion <https://github.com/kenion >
Cc: Serge Hallyn <serge@hallyn.com >
Cc: Paul Eggert <eggert@cs.ucla.edu >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-08-01 10:12:44 +02:00
Eisuke Kawashima
f3f501c81c
doc(login.defs): fix type of TTYPERM
2024-07-18 10:21:21 -05:00
Iker Pedrosa
fffa4d3e27
share/containers: remove unused dockerfiles
...
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
28ffa634d8
CI: use Ansible build in Github Action
...
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
4bc0c5b0b8
doc: update documentation to use Ansible build
...
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
f56e79a2b7
share/container-build.sh: update to use Ansible build
...
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
d8fb10f7b7
share/ansible: implement distribution selection
...
Distribution to run can be selected when running `ansible-playbook` by
appending `-e 'distribution=fedora'` to the command.
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
80c4e70da0
share/ansible: convert alpine dockerfile to ansible
...
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
1d6f578f3e
share/ansible: convert debian dockerfile to ansible
...
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
9a53a8aebd
share/ansible: move fedora ci_run to its own file
...
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
36e8015e2b
share/.gitignore: add build-out folder
...
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
df50348a28
share/ansible: create roles
...
Create `build_container` and `ci_run` roles and move the fedora target
to them.
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Iker Pedrosa
9a0cd7a231
share/ansible: convert fedora dockerfile to ansible
...
Using a dockerfile to build, install and test the code can be
problematic as we can't capture the log files to check what failed in
case of failure. This PR converts the fedora dockerfile to Ansible, an
open source IT automation tool. The tool can be used on the developers
and the CI system to check whether a piece of code can be built,
installed and tested.
This is the first patch in a series, where I will convert the existing
PR workflows to use Ansible instead of dockerfiles.
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com >
2024-07-18 10:17:29 -05:00
Chris Hofstaedtler
dfbc0db895
Makefile.am: avoid warning: EXTRA_DIST multiply defined
...
automake complained about duplicate definitions of EXTRA_DIST:
autoreconf: running: automake --add-missing --copy --no-force
Makefile.am:19: warning: EXTRA_DIST multiply defined in condition TRUE ...
Makefile.am:3: ... 'EXTRA_DIST' previously defined here
autoreconf: Leaving directory '.'
Signed-off-by: Chris Hofstaedtler <zeha@debian.org >
2024-07-18 09:21:57 -05:00
Chris Hofstaedtler
11e9627658
tests/libsubid/04_nss: fix setting basedir
...
Align on variable name BUILD_BASE_DIR for overriding the toplevel
directory. This is the same name as accepted by tests/common/config.sh.
Without this, the test libsubid/04_nss fails in Debian's autopkgtests.
Signed-off-by: Chris Hofstaedtler <zeha@debian.org >
2024-07-18 08:52:35 -05:00
Sebastian Gross
34f213211f
man: groupmod: remove misleading -N option
...
The extra paragraph for --users mentions a -N option. groupmod has no -N
option.
Prevent confusion and remove its appearance.
Signed-off-by: Sebastian Gross <sgross@emlix.com >
2024-07-17 15:48:22 +02:00
Sebastian Gross
48b36a03e8
man: group(add|mod): clarify list format
...
The --users list option expect a string of comma separated values.
While this might be obvious to some others it is certainly not for others.
Remove this ambiguity.
Closes #848
Signed-off-by: Sebastian Gross <sgross@emlix.com >
2024-07-17 15:48:22 +02:00
Sebastian Gross
9176206a7c
man: groupmod: fix misleading param
...
--append has no argument in groupmod.c but the man pages states GID as
parameter.
In order to avoid confusion remove it from man page.
Signed-off-by: Sebastian Gross <sgross@emlix.com >
2024-07-17 15:48:22 +02:00
Alejandro Colomar
8a93576ff9
lib/chkname.c: An object cannot expand further than the universe in which it resides
...
If you want a larger object, you'll have to wait at least until the
universe expands so much.
If an implementation doesn't recognize its own limitations, its a bug,
not a feature.
Closes: <https://github.com/shadow-maint/shadow/issues/1052 >
Cc: Tobias Stoeckmann <tobias@stoeckmann.org >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-07-15 15:01:11 +02:00
Alejandro Colomar
63297e836d
lib/atoi/strtoi/, tests/: strto[iu]_(): 1 is an invalid base
...
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-07-11 22:42:58 -05:00
Alejandro Colomar
745281f295
lib/atoi/, *: Split files
2024-07-11 22:42:58 -05:00
Alejandro Colomar
2dda45a390
src/usermod.c: Use id_t for parsing uid_t and gid_t
...
Use a static_assert(3) to make sure that id_t == uid_t == gid_t.
And use uintmax_t to print it, since on Linux they are unsigned types.
Link: <https://github.com/shadow-maint/shadow/pull/951 >
Reviewed-by: Tycho Andersen <tycho@tycho.pizza >
Cc: Serge Hallyn <serge@hallyn.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-07-11 22:42:58 -05:00
Alejandro Colomar
cfb8df4a91
src/usermod.c: Rename identifiers ralated to [ug]id's
...
It was unclear why this code is using ulong. Since these only handle
uid's and gid's, rename the identifiers accordingly, after id_t.
Link: <https://github.com/shadow-maint/shadow/pull/951 >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-07-11 22:42:58 -05:00
Alejandro Colomar
b73c78581c
lib/idmapping.c: get_map_ranges(): Don't exit() from a library function
...
Fixes: ff2baed5db ("idmapping: add more checks for overflow")
Link: <ff2baed5db (r136635300) >
Reported-by: Alejandro Colomar <alx@kernel.org >
Suggested-by: Serge Hallyn <serge@hallyn.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-07-11 22:42:58 -05:00
Alejandro Colomar
c46c6a6e5a
lib/idmapping.c: get_map_ranges(): Simplify iterator variables
...
Merge two iterator variables into one, and reduce its scope.
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-07-11 22:42:58 -05:00
Alejandro Colomar
a184c2b555
lib/idmapping.c: get_map_ranges(): Remove dead code
...
This test is impossible. The limits specified in a2ul() already cover
this.
Link: <ff2baed5db (r136635300) >
Cc: Serge Hallyn <serge@hallyn.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-07-11 22:42:58 -05:00