machined: Allow user ids in open_shell for machine-dbus

Previously "machinectl shell --uid=1000 <container>" resulted in a
sucessful drop into a shell in the respective target machine. After
commit a9e9288288 this is no longer the
case.

This fixes the above breaking change brought in commit a9e9288288
This commit is contained in:
cidkidnix
2026-07-16 11:58:15 +01:00
committed by Luca Boccassi
parent 07a9d1f929
commit 93212e2910
+1 -1
View File
@@ -391,7 +391,7 @@ int bus_machine_method_open_shell(sd_bus_message *message, void *userdata, sd_bu
return r;
user = isempty(user) ? "root" : user;
if (!valid_user_group_name(user, VALID_USER_RELAX))
if (!valid_user_group_name(user, VALID_USER_RELAX | VALID_USER_ALLOW_NUMERIC))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid user name '%s'", user);
/* Ensure only root can shell into the root namespace. This is to avoid unprivileged users registering