Commit Graph

2732 Commits

Author SHA1 Message Date
Jeremy Whiting
f397e32638 Fix CI by testing Ubuntu 22.04 instead of 21.10.
Since Ubuntu 21.10 has gone out of support it no longer works for
testing with CI. Instead use 22.04 which is still supported.
2022-08-06 10:54:26 -05:00
Masatake YAMATO
18b8095a8d tests: add a case for testing -F option of useradd
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2022-08-01 15:45:10 +02:00
Masatake YAMATO
3f7a72e967 useradd: add -F option for updating /etc/sub[ig]id for system accounts
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2022-08-01 15:45:10 +02:00
Masatake YAMATO
fb96d3f84d useradd: make the option specstr passed to getopt_long extensible
It was hard to extend the option specification string passed to
getopt_long as the third argument.

The origian code had a branch with WITH_SELINUX ifdef condition. If
one wants to add one more option char with another ifdef condition
like ENABLE_SUBIDS to the spec, the one must enumerate the specs for
all combinations of the conditions:

*  WITH_SELINUX &&  ENABLE_SUBIDS
*  WITH_SELINUX && !ENABLE_SUBIDS
* !WITH_SELINUX &&  ENABLE_SUBIDS
* !WITH_SELINUX && !ENABLE_SUBIDS

With this change, you can append an option char to the spec.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2022-08-01 15:45:10 +02:00
Iker Pedrosa
3ec32f9975 subordinateio: also compare the owner ID
IDs already populate /etc/subuid and /etc/subgid files so it's necessary
not only to check for the owner name but also for the owner ID of a
given range.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2093311

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-07-20 09:29:31 -05:00
Masatake YAMATO
62d99ee3fc man (useradd): add a note about -r option and /etc/subuid and subgid
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2022-07-15 09:42:21 +02:00
Alexander Zhang
ad4ab16559 Fix typo 2022-07-08 09:34:40 +02:00
Serge Hallyn
1bf5868e33 fix Changelog typo
Spotted by cgzones.
2022-07-05 08:49:15 -05:00
Serge Hallyn
f1a922f3b3 Update changelog
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2022-07-04 14:30:09 -05:00
Xi Ruoyao
274e786be9 libmisc: use /dev/urandom as a generic fallback for read_random_bytes()
On systems with Linux kernel < 3.17, getentropy() and getrandom() may
exist but return ENOSYS.  Use /dev/urandom as a fallback to avoid a hard
requirement on Linux kernel version.

Fixes #512.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2022-06-19 09:16:38 -05:00
Iker Pedrosa
6688f1c1eb CI: update actions version
CodeQL Action v1 is being deprecated and v2 needs to be used instead.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-06-12 10:08:30 -05:00
Iker Pedrosa
1f84142915 CI: enable CodeQL analyzer
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-24 10:55:32 -05:00
Iker Pedrosa
f4d5705e4a CI: create Github workflow to install dependencies
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-24 10:55:32 -05:00
Yuri Chornoivan
f4cf8fe51c Complete Ukrainian translation 2022-05-24 07:52:36 -05:00
Yuri Chornoivan
a83533d97d Update Ukrainian translation 2022-05-24 07:52:36 -05:00
Yuri Chornoivan
b372b8a3be Add Ukrainian translation for man pages 2022-05-24 07:52:36 -05:00
Iker Pedrosa
3b89b71680 Initialize local variables
CWE-457 by CodeQL.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-24 07:49:11 -05:00
Iker Pedrosa
0c7ded471f Add header guards
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-24 07:49:11 -05:00
Iker Pedrosa
0b51cde162 Remove commented out code and FIXMEs
In order to remove some of the FIXMEs it was necessary to change the
code and call getulong() instead of getlong().

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-24 07:49:11 -05:00
Iker Pedrosa
23baa40d9d Remove redeclared variable
No need to redeclare a variable with the same name and type. Just keep
the one with the biggest scope.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-24 07:49:11 -05:00
Yuri Chornoivan
3e183c2f5a Update Ukrainian translation 2022-05-19 13:34:14 -05:00
Sam James
29309f5913 tests: replace egrep -> grep -E
"egrep" is an obsolete alias for grep -E and newer greps will warn on usage
of egrep, so let's just swap it out.

Signed-off-by: Sam James <sam@gentoo.org>
2022-05-15 17:36:08 -05:00
Christian Göttsche
48ceff86de configure: replace obsolete autoconf macros
Replace
 AC_HELP_STRING by AS_HELP_STRING,
 AC_GNU_SOURCE by AC_USE_SYSTEM_EXTENSIONS,
 AC_TRY_COMPILE by AC_COMPILE_IFELSE and
 AM_PROG_LIBTOOL by LT_INIT.

See https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Obsolete-Macros.html
2022-05-10 09:55:18 +02:00
Iker Pedrosa
45d6746219 src: correct "badname" option
Change "badnames" to "badname" as this is the accepted option name.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-06 10:13:51 -05:00
Iker Pedrosa
edf5ea7974 man: correct "badname" option
Change "badnames" to "badname" as this is the accepted option name.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-06 10:13:51 -05:00
Iker Pedrosa
b62d02f38f po: update translation files
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-06 10:13:51 -05:00
Iker Pedrosa
0593b330d8 Suggest badname if name has special characters
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2076819

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-05-06 10:13:51 -05:00
Christian Göttsche
58b6e97a9e passwd: erase password copy on all error branches 2022-04-30 13:19:14 -05:00
Matheus Marques
edca359022 usermod: fix alphabetical order in help message 2022-04-25 21:33:11 -05:00
Serge Hallyn
5a7ed86fba Work around git safe.directory enforcement
Git wants to ensure that you do not read .git owned by other users.
But we fetch+build as 'build' user, and run tests as root user.  Those
tests calculate git topdir using git rev-parse --show-toplevel, which
git now fails.

Setting safe.directory, seems wrong.  Let's just use bash to figure
out the top dir.
2022-04-25 10:52:29 -05:00
juyin
9cdb5251b6 chpasswd: add IS_CRYPT_METHOD
Use macro IS_CRYPT_METHOD instead of ’strcmp(crypt_method, xx)==0’ to make the code more cleanup
2022-04-03 21:07:09 -05:00
juyin
3c1e5fcf16 refactor get_salt function
refactor get_salt function to make it easier to read.
2022-04-03 21:07:09 -05:00
juyin
3732cf72d6 chpasswd: fix function problem with -R parameter
Generating salt value depends on /dev/urandom. But after the
function process_root_flag changed the root directory, It does
not exist.

So, generate salt value before changeing the directory.

Fixes: #514
2022-04-03 21:07:09 -05:00
juyin
a026154c6f chpasswd: add get_salt for generating salt value
The function that generates the salt value is extracted separately, and it is more convenient to modify it later.
2022-04-03 21:07:09 -05:00
juyin
a43d0b95c4 libmisc: add check fopen return value in read_random_bytes()
Returns null when fopen fails. Then, using fread with a null pointer will cause a segfault.

Signed-off-by: Yan Zhu <zhuyan34@huawei.com>
2022-04-03 21:07:09 -05:00
Niko
e9bf727253 Handle ERANGE error correctly
The reentrant functions getgrgid_r, getgrnam_r, getpwnam_r, etc. all return an error code instead of setting errno. Adapt the error check accordingly.
2022-03-18 20:24:10 -05:00
Iker Pedrosa
57cd14f194 AUTHORS: improve markdown output
The markdown output for the maintainers, authors and contributors list
was wrapped in a single line and it was difficult to read. I've created
an unordered list to get a better output. On top of that I've also added
myself as a maintainer.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-03-18 16:10:51 -05:00
Steve Grubb
4f393a5f9f Change to strncat
ut_line is declared as a nonstring in bits/utmp.h. It might not be NUL
terminated. Limit how much it copies to the size of the array.
2022-03-18 16:02:01 -05:00
ed neville
b7bbf1beb8 Fix code comment
Improving check around pw_dir which may be NULL
2022-03-13 09:06:36 -05:00
Iker Pedrosa
d2da05aa1b CI: add fedora to build
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
2022-03-11 12:40:47 -06:00
Adam Sampson
c9015a7e58 Fix syntax error in usermod man source.
Signed-off-by: Adam Sampson <ats@offog.org>
2022-03-07 19:39:49 -06:00
Markus Hiereth
3a091d5def Improve groupadd and useradd manpage
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2022-03-06 18:48:22 -06:00
Markus Hiereth
5f88f2cca7 update useradd homepage
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2022-03-06 18:37:39 -06:00
Markus Hiereth
2f30d235c2 Manpage improvements for usermod
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2022-03-06 18:12:13 -06:00
Markus Hiereth
10b2e1e7c5 Improve groups and id manpages
Signed-off-by: Serge Hallyn <serge@hallyn.com>
2022-03-06 18:00:20 -06:00
Markus Hiereth
b3ce696f36 Improve pwck manpage
Signed-off-by: Serge Hallyn <shallyn@cisco.com>
2022-03-06 17:53:02 -06:00
Ali Riza KESKIN
212d20c80e fix PAM service files --without-selinux
Make pam_selinux.so optional in environments where the module isn't provided.
2022-03-04 08:51:20 -06:00
Jami Kettunen
1882c66bda configure.ac: Default to max group name length of 32
This used to be 16 for historical reasons but these days basically every
distro configures --with-group-name-max-length=32 to make it match the
max Linux username length, make it default.

Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com>
2022-02-23 08:10:56 -06:00
feer9
8abe637468 Update Spanish translation 2022-02-20 03:35:19 -06:00
Fernando
db90ccc199 Update Spanish translation
I changed the order of some words to be easier to understand
2022-02-20 03:35:19 -06:00