]> git.ipfire.org Git - thirdparty/shadow.git/log
thirdparty/shadow.git
4 years agolibsubid_init: don't print messages on error 343/head
Serge Hallyn [Sun, 23 May 2021 13:03:10 +0000 (08:03 -0500)] 
libsubid_init: don't print messages on error

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #340 from hallyn/2021-05-16/subidrange
Serge Hallyn [Sat, 22 May 2021 23:16:43 +0000 (18:16 -0500)] 
Merge pull request #340 from hallyn/2021-05-16/subidrange

Don't return owner in list_owner_ranges API call.

4 years agonss/libsubid: simplify the ranges variable for list_owner_ranges 340/head
Serge Hallyn [Sat, 22 May 2021 17:16:50 +0000 (12:16 -0500)] 
nss/libsubid: simplify the ranges variable for list_owner_ranges

Following alexey-tikhonov's suggestion.

Since we've dropped the 'owner' field in the data returned for
get_subid_ranges, we can just return a single allocated array of
simple structs.  This means we can return a ** instead of ***, and
we can get rid of the subid_free_ranges() helper, since the caller
can just free() the returned data.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #342 from hallyn/2021-05-22/subuidzero
Serge Hallyn [Sat, 22 May 2021 16:43:23 +0000 (11:43 -0500)] 
Merge pull request #342 from hallyn/2021-05-22/subuidzero

Fix useradd with SUB_UID_COUNT=0

4 years agoFix useradd with SUB_UID_COUNT=0 342/head
Serge Hallyn [Sat, 22 May 2021 16:42:02 +0000 (11:42 -0500)] 
Fix useradd with SUB_UID_COUNT=0

Closes #298

Fix useradd when SUB_UID_COUNT=0 in login.defs.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #341 from hallyn/2021-05-17/fail
Serge Hallyn [Mon, 17 May 2021 13:49:31 +0000 (08:49 -0500)] 
Merge pull request #341 from hallyn/2021-05-17/fail

libsubid_init: return false if out of memory

4 years agolibsubid_init: return false if out of memory 341/head
Serge Hallyn [Mon, 17 May 2021 13:48:03 +0000 (08:48 -0500)] 
libsubid_init: return false if out of memory

The rest of the run isn't likely to get much better, is it?

Thanks to Alexey for pointing this out.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
Cc: Alexey Tikhonov <atikhono@redhat.com>
4 years agoDon't return owner in list_owner_ranges API call.
Serge Hallyn [Mon, 17 May 2021 02:47:05 +0000 (21:47 -0500)] 
Don't return owner in list_owner_ranges API call.

Closes: 339
struct subordinate_range is pretty closely tied to the existing
subid code and /etc/subuid format, so it includes an owner.  Dropping
that or even renaming it is more painful than I'd first thought.
So introduce a 'struct subid_range' which is only the start and
count, leaving 'struct subordinate_range' as the owner, start and
count.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #335 from hallyn/2021-05-08/stderr
Serge Hallyn [Mon, 17 May 2021 02:44:22 +0000 (21:44 -0500)] 
Merge pull request #335 from hallyn/2021-05-08/stderr

[WIP] libsubid: don't print error messages on stderr by default

4 years agolibsubid: don't print error messages on stderr by default 335/head
Serge Hallyn [Sat, 8 May 2021 22:42:14 +0000 (17:42 -0500)] 
libsubid: don't print error messages on stderr by default

Closes #325

Add a new subid_init() function which can be used to specify the
stream on which error messages should be printed.  (If you want to
get fancy you can redirect that to memory :)  If subid_init() is
not called, use stderr.  If NULL is passed, then /dev/null will
be used.

This patch also fixes up the 'Prog', which previously had to be
defined by any program linking against libsubid.  Now, by default
in libsubid it will show (subid).  Once subid_init() is called,
it will use the first variable passed to subid_init().

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #333 from ikerexxe/hmac_crypto_algo
Serge Hallyn [Sat, 8 May 2021 21:35:05 +0000 (16:35 -0500)] 
Merge pull request #333 from ikerexxe/hmac_crypto_algo

login.defs: include HMAC_CRYPTO_ALGO key

4 years agoMerge pull request #323 from cgzones/selinux
Serge Hallyn [Fri, 7 May 2021 13:32:01 +0000 (08:32 -0500)] 
Merge pull request #323 from cgzones/selinux

SELinux modernizations

4 years agoMerge pull request #334 from brauner/2021-05-06.cap_setfcap
Serge Hallyn [Thu, 6 May 2021 19:45:50 +0000 (14:45 -0500)] 
Merge pull request #334 from brauner/2021-05-06.cap_setfcap

libmisc: retain CAP_SETFCAP when mapping uid 0

4 years agolibmisc: retain setfcap when mapping uid 0 334/head
Christian Brauner [Thu, 6 May 2021 16:59:28 +0000 (18:59 +0200)] 
libmisc: retain setfcap when mapping uid 0

When uid 0 maps host uid 0 into the child userns newer kernels require
CAP_SETFCAP be retained as this allows the caller to create fscaps that
are valid in the ancestor userns. This was a security issue (in very
rare circumstances). So whenever host uid 0 is mapped, retain
CAP_SETFCAP if the caller had it.
Userspace won't need to set CAP_SETFCAP on newuidmap as this is really
only a scenario that real root should be doing which always has
CAP_SETFCAP. And if they don't then they are in a locked-down userns.
(LXC sometimes maps host uid 0 during chown operations in a helper
 userns but will not rely on newuidmap for that. But we don't want to
 risk regressing callers that want to rely on this behavior.)

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
4 years agologin.defs: include HMAC_CRYPTO_ALGO key 333/head
Iker Pedrosa [Thu, 6 May 2021 15:23:33 +0000 (17:23 +0200)] 
login.defs: include HMAC_CRYPTO_ALGO key

Include the new HMAC_CRYPTO_ALGO key that is needed by pam_timestamp to
select the algorithm that is going to be used to calculate the message
authentication code.

pam_timestamp is currently using an embedded algorithm to calculate the
HMAC message, but the idea is to improve this behaviour by relying on
openssl's implementation. On top of that, the ability to change the
algorithm with a simple configuration change allows to simplify the
process of removing unsecure algorithms.

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

4 years agoselinux: only open selabel database once 323/head
Christian Göttsche [Tue, 13 Apr 2021 12:13:11 +0000 (14:13 +0200)] 
selinux: only open selabel database once

Once opened, keep the selabel database open for further lookups.
Register an exit handler to close the database.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
4 years agoset_selinux_file_context(): prepare context for actual file type
Christian Göttsche [Fri, 9 Apr 2021 16:21:00 +0000 (18:21 +0200)] 
set_selinux_file_context(): prepare context for actual file type

Search the SELinux selabel database for the file type to be created.
Not specifying the file mode can cause an incorrect file context to be
returned.

Also prepare contexts in commonio_close() for the generic database
filename, not with the backup suffix appended, to ensure the desired
file context after the final rename.

Closes: #322
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
4 years agoselinux.c: use modern selabel interface instead of deprecated matchpathcon
Christian Göttsche [Fri, 9 Apr 2021 16:20:55 +0000 (18:20 +0200)] 
selinux.c: use modern selabel interface instead of deprecated matchpathcon

matchpathcon(3) is deprecated in favor of selabel_lookup(3).

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
4 years agoselinux.c:reset_selinux_file_context(): do not fail in permissive mode
Christian Göttsche [Fri, 9 Apr 2021 16:20:53 +0000 (18:20 +0200)] 
selinux.c:reset_selinux_file_context(): do not fail in permissive mode

Return 0 on setfscreatecon(3) failure, like set_selinux_file_context().

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
4 years agoselinux.c: do not use deprecated typedef and skip context translation
Christian Göttsche [Fri, 9 Apr 2021 16:20:51 +0000 (18:20 +0200)] 
selinux.c: do not use deprecated typedef and skip context translation

These retrieved contexts are just passed to libselinux functions and not
printed or otherwise made available to the outside, so a context
translation to human readable MCS/MLS labels is not needed.
(see man:setrans.conf(5))

The typedef security_context_t is deprecated, see
https://github.com/SELinuxProject/selinux/commit/9eb9c9327563014ad6a807814e7975424642d5b9

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
4 years agovipw[selinux]: do not use deprecated typedef and skip context translation
Christian Göttsche [Fri, 9 Apr 2021 16:20:49 +0000 (18:20 +0200)] 
vipw[selinux]: do not use deprecated typedef and skip context translation

This retrieved context is just passed to libselinux functions and not
printed or otherwise made available to the outside, so a context
translation to human readable MCS/MLS labels is not needed.
(see man:setrans.conf(5))

The typedef security_context_t is deprecated, see
https://github.com/SELinuxProject/selinux/commit/9eb9c9327563014ad6a807814e7975424642d5b9

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
4 years agostruct commonio_db[selinux]: do not use deprecated type security_context_t
Christian Göttsche [Fri, 9 Apr 2021 16:20:41 +0000 (18:20 +0200)] 
struct commonio_db[selinux]: do not use deprecated type security_context_t

The typedef security_context_t is deprecated, see
https://github.com/SELinuxProject/selinux/commit/9eb9c9327563014ad6a807814e7975424642d5b9

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
4 years agoMerge pull request #332 from hallyn/2021-05-04/manpage
Serge Hallyn [Tue, 4 May 2021 19:40:28 +0000 (14:40 -0500)] 
Merge pull request #332 from hallyn/2021-05-04/manpage

manpages: mention NSS in new[ug]idmap manpages

4 years agomanpages: mention NSS in new[ug]idmap manpages 332/head
Serge Hallyn [Tue, 4 May 2021 19:39:26 +0000 (14:39 -0500)] 
manpages: mention NSS in new[ug]idmap manpages

Closes #328

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #330 from hallyn/2021-05-04/subidhinclude
Serge Hallyn [Tue, 4 May 2021 14:22:48 +0000 (09:22 -0500)] 
Merge pull request #330 from hallyn/2021-05-04/subidhinclude

Install subid.h

4 years agoInstall subid.h 330/head
Serge Hallyn [Tue, 4 May 2021 14:21:11 +0000 (09:21 -0500)] 
Install subid.h

Now subid.h gets installed under /usr/include/shadow/subid.h

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #321 from hallyn/2021-04-08/nss
Serge Hallyn [Sat, 17 Apr 2021 02:03:37 +0000 (21:03 -0500)] 
Merge pull request #321 from hallyn/2021-04-08/nss

Subids: support nsswitch

4 years agotests: fix su failures under travis 321/head
Serge Hallyn [Tue, 13 Apr 2021 03:37:23 +0000 (22:37 -0500)] 
tests: fix su failures under travis

HOME has to start as /root since we are testing
that su didn't change it.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agosu/03: export shell = sh
Serge Hallyn [Mon, 12 Apr 2021 03:14:27 +0000 (22:14 -0500)] 
su/03: export shell = sh

Otherwise our su -p uses bash if that is what root was
configured to use, and then fails to read /root/ for
.bash_profile.  This caused an unexpected error message
in /tmp/err, failing the test.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agotest: su -p doesn't set home
Serge Hallyn [Mon, 12 Apr 2021 02:39:31 +0000 (21:39 -0500)] 
test: su -p doesn't set home

with out also doing '-'

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoclean up libsubid headers
Serge Hallyn [Thu, 15 Apr 2021 14:52:29 +0000 (09:52 -0500)] 
clean up libsubid headers

Move libsubid/api.h into libsubid/subid.h, and document the api in subid.h

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agosubids: support nsswitch
Serge Hallyn [Sun, 31 Jan 2021 23:38:20 +0000 (17:38 -0600)] 
subids: support nsswitch

Closes #154

When starting any operation to do with subuid delegation, check
nsswitch for a module to use.  If none is specified, then use
the traditional /etc/subuid and /etc/subgid files.

Currently only one module is supported, and there is no fallback
to the files on errors.  Several possibilities could be considered:

1. in case of connection error, fall back to files
2. in case of unknown user, also fall back to files

etc...

When non-files nss module is used, functions to edit the range
are not supported.  It may make sense to support it, but it also
may make sense to require another tool to be used.

libsubordinateio also uses the nss_ helpers.  This is how for instance
lxc could easily be converted to supporting nsswitch.

Add a set of test cases, including a dummy libsubid_zzz module.  This
hardcodes values such that:

'ubuntu' gets 200000 - 300000
'user1' gets 100000 - 165536
'error' emulates an nss module error
'unknown' emulates a user unknown to the nss module
'conn' emulates a connection error ot the nss module

Changes to libsubid:

Change the list_owner_ranges api: return a count instead of making the array
null terminated.

This is a breaking change, so bump the libsubid abi major number.

Rename free_subuid_range and free_subgid_range to ungrant_subuid_range,
because otherwise it's confusing with free_subid_ranges which frees
    memory.

Run libsubid tests in jenkins

Switch argument order in find_subid_owners

Move the db locking into subordinateio.c

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agotry again to fix libmisc sharing problem
Serge Hallyn [Mon, 1 Feb 2021 04:44:09 +0000 (22:44 -0600)] 
try again to fix libmisc sharing problem

Issue #297 reported seeing

*** Warning: Linking the shared library libsubid.la against the
*** static library ../libmisc/libmisc.a is not portable!

which commit b5fb1b38eea2fb0489ed088c82daf6700e72363e was supposed
to fix.  But a few commits later it's back.  So try to fix it
in the way the bug reporter suggested.  This broke builds some
other ways, namely a few missing library specifications, so add
those.

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #314 from sevan/patch-1
Serge Hallyn [Tue, 30 Mar 2021 15:21:17 +0000 (10:21 -0500)] 
Merge pull request #314 from sevan/patch-1

passwd(5): Note the use of an ampersand in the comment field

4 years agoman: include lastlog file caveat (#313)
Iker Pedrosa [Mon, 29 Mar 2021 03:26:28 +0000 (05:26 +0200)] 
man: include lastlog file caveat (#313)

man/lastlog.8.xml: add another point to the caveats section regarding
the handling of the lastlog file by external tools.

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

4 years agologin & su: Treat an empty passwd field as invalid (#315)
Haelwenn Monnier [Mon, 29 Mar 2021 03:16:03 +0000 (05:16 +0200)] 
login & su: Treat an empty passwd field as invalid (#315)

* login & su: Treat an empty passwd field as invalid

Otherwise it's treated like the “require no password” clause while it probably
should be treated like a normal su that can't validate anyway.

A similar change should be done for USE_PAM.

* su & login: Introduce PREVENT_NO_AUTH

4 years agoMerge pull request #303 from breard-r/yescrypt
Serge Hallyn [Mon, 29 Mar 2021 03:13:56 +0000 (22:13 -0500)] 
Merge pull request #303 from breard-r/yescrypt

Add yescrypt support

4 years agoNote the use of an ampersand in the comment field 314/head
Sevan Janiyan [Fri, 12 Mar 2021 23:56:38 +0000 (23:56 +0000)] 
Note the use of an ampersand in the comment field

4 years agoMerge pull request #308 from martijndegouw/relaxgidcheck
Serge Hallyn [Tue, 2 Mar 2021 18:42:25 +0000 (12:42 -0600)] 
Merge pull request #308 from martijndegouw/relaxgidcheck

newuidmap,newgidmap: Relax gid checking to allow running under alternative group ID

4 years agoMerge pull request #310 from ikerexxe/upstream_man_clarifications
Serge Hallyn [Mon, 1 Mar 2021 16:02:44 +0000 (10:02 -0600)] 
Merge pull request #310 from ikerexxe/upstream_man_clarifications

Man clarifications

4 years agoMerge pull request #311 from ikerexxe/upstream_userdel_clarification
Serge Hallyn [Mon, 1 Mar 2021 15:59:14 +0000 (09:59 -0600)] 
Merge pull request #311 from ikerexxe/upstream_userdel_clarification

userdel: clarify "-f" usage

4 years agouserdel: clarify "-f" usage 311/head
ikerexxe [Tue, 23 Feb 2021 11:21:42 +0000 (12:21 +0100)] 
userdel: clarify "-f" usage

src/userdel.c: clarify the examples for "-f" option

4 years agoman: usermod clarification 310/head
ikerexxe [Tue, 2 Feb 2021 10:27:17 +0000 (11:27 +0100)] 
man: usermod clarification

man/usermod.8.xml: specify what happens when the current home directory
doesn't exist if using -d and -m options. Moreover, specify what happens
when the group ownership is changed and the uid's don't match in -u and
-g options.

4 years agoman: useradd clarification
ikerexxe [Tue, 2 Feb 2021 10:25:03 +0000 (11:25 +0100)] 
man: useradd clarification

man/useradd.8.xml: specify the SELinux requirements for -m option.

4 years agoman: shadow clarification
ikerexxe [Tue, 2 Feb 2021 10:21:12 +0000 (11:21 +0100)] 
man: shadow clarification

man/shadow.5.xml: indicate the exact time and timezone for the dates.
Moreover, clarify that when the password expires the user won't be able
to login.

4 years agoman: groupadd and groupmod clarification
ikerexxe [Tue, 2 Feb 2021 10:19:58 +0000 (11:19 +0100)] 
man: groupadd and groupmod clarification

man/groupadd.8.xml: clarify the exit values meaning.
man/groupmod.8.xml: clarify the E_GID_IN_USE value meaning.

4 years agoMerge pull request #307 from glysbaysb/usermod-shell-path
Serge Hallyn [Mon, 8 Feb 2021 16:03:11 +0000 (10:03 -0600)] 
Merge pull request #307 from glysbaysb/usermod-shell-path

usermod: check if shell is know

4 years agoAdd tests for group checking in newuidmap/newgidmap 308/head
Martijn de Gouw [Mon, 8 Feb 2021 12:20:04 +0000 (13:20 +0100)] 
Add tests for group checking in newuidmap/newgidmap

4 years agonewuidmap,newgidmap: Relax gid checking to allow running under alternative group ID
Martijn de Gouw [Thu, 7 Jan 2021 11:15:25 +0000 (12:15 +0100)] 
newuidmap,newgidmap: Relax gid checking to allow running under alternative group ID

Signed-off-by: Martijn de Gouw <martijn.de.gouw@prodrive-technologies.com>
4 years agousermod expects a path 307/head
Geert Ijewski [Sun, 7 Feb 2021 18:30:05 +0000 (19:30 +0100)] 
usermod expects a path

Closes #307

4 years agousermod: check if shell exists & is executable
Geert Ijewski [Sun, 7 Feb 2021 18:26:55 +0000 (19:26 +0100)] 
usermod: check if shell exists & is executable

4 years agoman: chage clarification
ikerexxe [Tue, 2 Feb 2021 09:24:32 +0000 (10:24 +0100)] 
man: chage clarification

man/chage.1.xml: Indicate that -d option with a value of 0 forces the
user to change his password. Besides, set an example on how to use -E
option. Finally, add a general note to clarify that chage only takes
charge of local users and another note to indicate that it doesn't check
inconsistencies between shadow and passwd files.

4 years agoAdd yescrypt support 303/head
Rodolphe Bréard [Sun, 27 Dec 2020 20:09:25 +0000 (21:09 +0100)] 
Add yescrypt support

4 years agoMerge pull request #306 from hallyn/2021-01-01/nosubids
Serge Hallyn [Fri, 1 Jan 2021 19:10:53 +0000 (13:10 -0600)] 
Merge pull request #306 from hallyn/2021-01-01/nosubids

useradd: don't try to create 0 subuids

4 years agouseradd: don't try to create 0 subuids 306/head
Serge Hallyn [Fri, 1 Jan 2021 19:10:12 +0000 (13:10 -0600)] 
useradd: don't try to create 0 subuids

Closes #289

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #305 from hallyn/2021-01-01/static-dynamic
Serge Hallyn [Fri, 1 Jan 2021 19:05:33 +0000 (13:05 -0600)] 
Merge pull request #305 from hallyn/2021-01-01/static-dynamic

libsubid: move libmisc.a to last LIBADD entry

4 years agolibsubid: move libmisc.a to last LIBADD entry 305/head
Serge Hallyn [Fri, 1 Jan 2021 19:01:54 +0000 (13:01 -0600)] 
libsubid: move libmisc.a to last LIBADD entry

Closes #297

Signed-off-by: Serge Hallyn <serge@hallyn.com>
4 years agoMerge pull request #302 from whzhe51/br_master
Serge Hallyn [Sun, 27 Dec 2020 06:37:46 +0000 (00:37 -0600)] 
Merge pull request #302 from whzhe51/br_master

useradd.c:fix memleaks of grp

4 years agoMerge pull request #301 from whzhe51/br_whzhe
Serge Hallyn [Sun, 27 Dec 2020 06:31:30 +0000 (00:31 -0600)] 
Merge pull request #301 from whzhe51/br_whzhe

useradd.c:fix memleak in get_groups

4 years agoMerge pull request #299 from lnussel/master
Serge Hallyn [Sun, 27 Dec 2020 06:26:47 +0000 (00:26 -0600)] 
Merge pull request #299 from lnussel/master

useradd: use built-in settings by default

4 years agoMerge pull request #296 from ikerexxe/log_exit_code
Serge Hallyn [Sun, 27 Dec 2020 06:18:12 +0000 (00:18 -0600)] 
Merge pull request #296 from ikerexxe/log_exit_code

useradd: log exit code when failing

4 years agoMerge pull request #295 from ikerexxe/newusers_clarification
Serge Hallyn [Sun, 27 Dec 2020 06:16:18 +0000 (00:16 -0600)] 
Merge pull request #295 from ikerexxe/newusers_clarification

newusers: doesn't create parent home directories

4 years agouseradd.c:fix memleak in get_groups 301/head
whzhe [Thu, 17 Dec 2020 08:27:15 +0000 (03:27 -0500)] 
useradd.c:fix memleak in get_groups

Signed-off-by: whzhe <wanghongzhe@huawei.com>
4 years agouseradd.c:fix memleaks of grp 302/head
whzhe51 [Sat, 19 Dec 2020 09:29:06 +0000 (04:29 -0500)] 
useradd.c:fix memleaks of grp
Signed-off-by: whzhe51 <wanghongzhe@huawei.com>
4 years agouseradd: use built-in settings by default 299/head
Ludwig Nussel [Thu, 3 Dec 2020 17:05:59 +0000 (18:05 +0100)] 
useradd: use built-in settings by default

Avoids installing inconsistent settings. The correct ones would be
written as soon as an admin uses useradd -D to modify the defaults.

4 years agouseradd: log exit code when failing 296/head
ikerexxe [Tue, 17 Nov 2020 15:58:40 +0000 (16:58 +0100)] 
useradd: log exit code when failing

src/useradd.c: log exit code when failing

4 years agonewusers: doesn't create parent home directories 295/head
ikerexxe [Tue, 17 Nov 2020 15:46:10 +0000 (16:46 +0100)] 
newusers: doesn't create parent home directories

man/newusers.8.xml: clarify that newusers doesn't create parent
directories of the new user's home directory.

4 years agoMerge pull request #293 from ikerexxe/sync_file_write
Serge Hallyn [Sun, 8 Nov 2020 22:36:36 +0000 (16:36 -0600)] 
Merge pull request #293 from ikerexxe/sync_file_write

commonio: force lock file sync

4 years agoMerge pull request #291 from ikerexxe/covscan_issues
Serge Hallyn [Sun, 8 Nov 2020 22:33:55 +0000 (16:33 -0600)] 
Merge pull request #291 from ikerexxe/covscan_issues

Two covscan issues

4 years agoMerge pull request #290 from jamincollins/master
Serge Hallyn [Sun, 8 Nov 2020 22:29:29 +0000 (16:29 -0600)] 
Merge pull request #290 from jamincollins/master

add parsing support for advertised force long opt

4 years agocommonio: force lock file sync 293/head
ikerexxe [Mon, 2 Nov 2020 16:08:55 +0000 (17:08 +0100)] 
commonio: force lock file sync

lib/commonio.c: after writing to the lock file, force a file sync to
the storage system.

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

4 years agoupdate groupdel man page for the --force option 290/head
Jamin W. Collins [Mon, 2 Nov 2020 00:24:49 +0000 (17:24 -0700)] 
update groupdel man page for the --force option

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
4 years agouseradd: free grp to avoid leak 291/head
ikerexxe [Tue, 27 Oct 2020 10:35:53 +0000 (11:35 +0100)] 
useradd: free grp to avoid leak

covscan issue:
Error: RESOURCE_LEAK (CWE-772): [#def39] [important]
src/useradd.c:728: alloc_fn: Storage is returned from allocation function "get_local_group".
src/useradd.c:728: var_assign: Assigning: "grp" = storage returned from "get_local_group(list)".
src/useradd.c:728: overwrite_var: Overwriting "grp" in "grp = get_local_group(list)" leaks the storage that "grp" points to.
726|     * GID values, otherwise the string is looked up as is.
727|     */
728|->  grp = get_local_group (list);
729|
730|    /*

4 years agonewgrp: delete dead code
ikerexxe [Tue, 27 Oct 2020 10:33:46 +0000 (11:33 +0100)] 
newgrp: delete dead code

covscan issue:
Error: CLANG_WARNING: [#def31]
src/newgrp.c:448:2: warning: Value stored to 'gid' is never read [deadcode.DeadStores]
gid = getgid ();

4 years agoadd parsing support for advertised force long opt
Jamin W. Collins [Sat, 17 Oct 2020 16:18:30 +0000 (09:18 -0700)] 
add parsing support for advertised force long opt

Existing help output advertises --force as a long opt.

  -f, --force                   delete group even if it is the primary group of a user

But errors when the long opt is used.

groupdel: unrecognized option '--force'

Signed-off-by: Jamin W. Collins <jamin.collins@gmail.com>
4 years agoMerge pull request #288 from whzhe51/br_whzhe
Serge Hallyn [Fri, 16 Oct 2020 14:59:34 +0000 (09:59 -0500)] 
Merge pull request #288 from whzhe51/br_whzhe

xfree: move xfree() function to xmalloc.c

4 years agoxfree: move xfree() function to xmalloc.c 288/head
w00475903 [Tue, 13 Oct 2020 01:29:37 +0000 (21:29 -0400)] 
xfree: move xfree() function to xmalloc.c

Signed-off-by: whzhe <wanghongzhe@huawei.com>
4 years agoMerge pull request #286 from karelzak/defs
Serge Hallyn [Mon, 12 Oct 2020 13:40:50 +0000 (08:40 -0500)] 
Merge pull request #286 from karelzak/defs

getdefs: add foreign (non-shadow-utils) items

4 years agoMerge pull request #285 from masmullin2000/master
Serge Hallyn [Mon, 12 Oct 2020 13:36:33 +0000 (08:36 -0500)] 
Merge pull request #285 from masmullin2000/master

Fix the undefined xfree issue

4 years agogetdefs: add foreign (non-shadow-utils) items 286/head
Karel Zak [Thu, 8 Oct 2020 10:17:30 +0000 (12:17 +0200)] 
getdefs: add foreign (non-shadow-utils) items

The login.defs is shared between more upstream projects (util-linux,
etc.). We need to improve compatibility between the projects do not
report valid, but foreign items.

Addresses: https://github.com/shadow-maint/shadow/issues/276
Signed-off-by: Karel Zak <kzak@redhat.com>
4 years agoUse {} to kep more in line with code style 285/head
Michael Mullin [Sat, 3 Oct 2020 18:23:06 +0000 (14:23 -0400)] 
Use {} to kep more in line with code style

4 years agoFix the undefined xfree issue
Michael Mullin [Sat, 3 Oct 2020 18:19:46 +0000 (14:19 -0400)] 
Fix the undefined xfree issue

4 years agoMerge pull request #282 from ikerexxe/sssd_cache_error
Serge Hallyn [Sat, 3 Oct 2020 00:38:35 +0000 (19:38 -0500)] 
Merge pull request #282 from ikerexxe/sssd_cache_error

lib/sssd: redirect warning message to file

4 years agoMerge pull request #277 from whzhe51/br_whzhe
Serge Hallyn [Sat, 3 Oct 2020 00:37:20 +0000 (19:37 -0500)] 
Merge pull request #277 from whzhe51/br_whzhe

gpasswd.c: fix memory leak in sg_adm

4 years agolib/sssd: redirect warning message to file 282/head
ikerexxe [Fri, 2 Oct 2020 14:09:42 +0000 (16:09 +0200)] 
lib/sssd: redirect warning message to file

Instead of printing warning in stderr print it to file. This way the
user is not spammed with unnecessary messages when updating packages.

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

4 years agoMerge pull request #281 from towerpark/fix-newxidmap-man
Serge Hallyn [Thu, 1 Oct 2020 18:26:11 +0000 (13:26 -0500)] 
Merge pull request #281 from towerpark/fix-newxidmap-man

Fix the inaccurate description about ID range in man new{u,g}idmap

4 years agoFix the inaccurate description about the ID range to be verified against /etc/sub... 281/head
towerpark [Sat, 26 Sep 2020 12:01:01 +0000 (21:01 +0900)] 
Fix the inaccurate description about the ID range to be verified against /etc/sub{u,g}id.

4 years agogpasswd.c: fix memory leak in sg_adm 277/head
w00475903 [Wed, 16 Sep 2020 08:15:06 +0000 (04:15 -0400)] 
gpasswd.c: fix memory leak in sg_adm

Signed-off-by: whzhe <wanghongzhe@huawei.com>
4 years agoMerge pull request #279 from juergenhoetzel/fix-de-translation
Serge Hallyn [Fri, 25 Sep 2020 02:59:58 +0000 (21:59 -0500)] 
Merge pull request #279 from juergenhoetzel/fix-de-translation

Fix incorrect translation (de)

4 years agoMerge pull request #278 from edneville/104_su_waitpid
Serge Hallyn [Fri, 25 Sep 2020 02:58:35 +0000 (21:58 -0500)] 
Merge pull request #278 from edneville/104_su_waitpid

loop until waitpid returns pid_child or error

4 years agoFix incorrect translation (de) 279/head
Juergen Hoetzel [Tue, 22 Sep 2020 14:00:00 +0000 (16:00 +0200)] 
Fix incorrect translation (de)

4 years agoloop until waitpid returns pid_child or error 278/head
ed neville [Sun, 20 Sep 2020 22:02:58 +0000 (23:02 +0100)] 
loop until waitpid returns pid_child or error

closes #104

Signed-off-by: ed neville <ed@s5h.net>
4 years agoRevert "su.c: replace getopt with ad-hoc flag processing"
Serge Hallyn [Fri, 28 Aug 2020 20:16:11 +0000 (15:16 -0500)] 
Revert "su.c: replace getopt with ad-hoc flag processing"

This reverts commit dc732e77347461d18dd6132c429630a4c0f8ca97.

4 years agoRevert "su.c: s/doshell/do_interactive_shell/"
Serge Hallyn [Fri, 28 Aug 2020 20:16:04 +0000 (15:16 -0500)] 
Revert "su.c: s/doshell/do_interactive_shell/"

This reverts commit 6f38f43fdd745fa28b9e100f08bdf8b59b474280.

4 years agoRevert "su.c: implement --exec"
Serge Hallyn [Fri, 28 Aug 2020 20:15:56 +0000 (15:15 -0500)] 
Revert "su.c: implement --exec"

This reverts commit 4047d1fe8edbe5ae952fef17fc09a4105d0de14b.

4 years agoRevert "Update su tests"
Serge Hallyn [Fri, 28 Aug 2020 20:15:47 +0000 (15:15 -0500)] 
Revert "Update su tests"

This reverts commit cf8101aaae51464cbe7e8bf3fe9c03d10c82a8ac.

4 years agoMerge pull request #275 from hallyn/2020-08-27/test-su
Christian Brauner [Fri, 28 Aug 2020 10:13:49 +0000 (12:13 +0200)] 
Merge pull request #275 from hallyn/2020-08-27/test-su

Add tests on top of #254

4 years agoUpdate su tests 275/head
Serge Hallyn [Fri, 28 Aug 2020 04:09:13 +0000 (23:09 -0500)] 
Update su tests

Some of these tests seem wrong.  The assume that

    su -- -c command

should work, whereas -- should mean pass all remaining arguments
along to the command.

Add some new tests based on examples in Issue 253

Signed-off-by: Serge Hallyn <shallyn@cisco.com>
4 years agosu.c: implement --exec
Vito Caputo [Sun, 10 May 2020 01:01:22 +0000 (18:01 -0700)] 
su.c: implement --exec

It's now possible to run commands as other users without shell
interpolation by using "--exec":

Read /etc/shadow as root without specifying user:
```
su --exec /bin/cat -- /etc/shadow
```

Or specify user:
```
su --exec /bin/cat root -- /etc/shadow
```

4 years agosu.c: s/doshell/do_interactive_shell/
Vito Caputo [Sun, 10 May 2020 00:43:14 +0000 (17:43 -0700)] 
su.c: s/doshell/do_interactive_shell/

Mechanical rename distinguishing this variable from intended changes
supporting executing commands without using an interpretive shell
(i.e. no '/bin/sh -c').