2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Remove dead code dealing with unknown user and MODE_INVALIDATE.

The timestamp unlink code does not need the user's struct passwd
pointer, just the user name (which we already have).  Found by
PVS-Studio.
This commit is contained in:
Todd C. Miller
2023-08-21 13:21:51 -06:00
parent df730dec5d
commit 9aaba80a04

View File

@@ -555,18 +555,7 @@ sudoers_policy_deserialize_info(struct sudoers_context *ctx, void *v,
}
ctx->user.pw = sudo_getpwnam(ctx->user.name);
if (ctx->user.pw == NULL) {
/*
* It is not unusual for users to place "sudo -k" in a .logout
* file which can cause sudo to be run during reboot after the
* YP/NIS/NIS+/LDAP/etc daemon has died.
* For all others we will log a proper error later on.
*/
if (ctx->mode == MODE_INVALIDATE) {
sudo_warnx(U_("unknown user %s"), ctx->user.name);
goto bad;
}
} else if (groups != NULL) {
if (ctx->user.pw != NULL && groups != NULL) {
/* sudo_parse_gids() will print a warning on error. */
GETGROUPS_T *gids;
int ngids = sudo_parse_gids(groups, &ctx->user.gid, &gids);