[bionic] userdel doesn't check for local users

Bug #1950370 reported by Andreas Hasenack
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
shadow (Ubuntu)
Fix Released
Undecided
Unassigned
Bionic
New
Undecided
Unassigned

Bug Description

Before trying to delete a user, userdel checks if the user exists. The problem is that this check is done using getpwnam(), which will query all nss sources from /etc/nsswitch.conf.

If a system has, for example, LDAP enabled, and userdel is called with the name of a user that only exists in LDAP, it will pass that check, and userdel will proceed and try to delete that user, which will obviously fail.

That might not sound like a big deal, but it is. As part of the checks it runs before deleting an user, it checks if there is any running process owned by that user. This means that it will do a getpwnam() call for each running process. On a busy machine, that can be thousands, and each one will trigger an LDAP lookup. Oops.

Upstream fixed this in commit https://github.com/shadow-maint/shadow/commit/2c57c399bf0d2f06dc8a8fed244ec80667a671f1

Focal and later have this upstream version and are not affected.

Changed in shadow (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.