mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
namespace-util: don't reset UID/GIDs in namespace_enter() unless we enter a userns
The reset of UID/GID only really makes sense if we enter a userns, hence let#s restrict it to that.
This commit is contained in:
committed by
Mike Yuan
parent
ca97d48bd4
commit
39706728e1
@@ -247,7 +247,10 @@ int namespace_enter(int pidns_fd, int mntns_fd, int netns_fd, int userns_fd, int
|
||||
return -errno;
|
||||
}
|
||||
|
||||
return reset_uid_gid();
|
||||
if (userns_fd >= 0)
|
||||
return reset_uid_gid();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int fd_is_namespace(int fd, NamespaceType type) {
|
||||
@@ -768,4 +771,3 @@ int netns_acquire(void) {
|
||||
|
||||
return pidref_namespace_open_by_type(&pid, NAMESPACE_NET);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user