projects
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5c9c70f
)
core: fix gid when DynamicUser=yes with static User=
author
Yu Watanabe
<watanabe.yu+github@gmail.com>
Thu, 26 Jul 2018 02:42:54 +0000
(11:42 +0900)
committer
Michael Biebl
<biebl@debian.org>
Tue, 25 Sep 2018 14:11:12 +0000
(15:11 +0100)
When DynamicUser=yes and static User= are set, and the user has
different uid and gid, then as the storage socket for the dynamic
user does not contains gid, we need to obtain gid.
Follow-up for
9ec655cbbd7505ef465e0444da0622e46099ce42
.
Fixes #9702.
(cherry picked from commit
25a1df7c652d180eb716412885c3ce3fcc1bbded
)
Gbp-Pq: Name core-fix-gid-when-DynamicUser-yes-with-static-User.patch
src/core/dynamic-user.c
patch
|
blob
|
history
diff --git
a/src/core/dynamic-user.c
b/src/core/dynamic-user.c
index 7c5111ddf640e486939a7e21e260051dad9b5655..f380db553ebe54e64d62995ede26140e8d3e9a55 100644
(file)
--- a/
src/core/dynamic-user.c
+++ b/
src/core/dynamic-user.c
@@
-525,6
+525,16
@@
static int dynamic_user_realize(
num = new_uid;
uid_lock_fd = new_uid_lock_fd;
}
+ } else if (is_user && !uid_is_dynamic(num)) {
+ struct passwd *p;
+
+ /* Statically allocated user may have different uid and gid. So, let's obtain the gid. */
+ errno = 0;
+ p = getpwuid(num);
+ if (!p)
+ return errno > 0 ? -errno : -ESRCH;
+
+ gid = p->pw_gid;
}
/* If the UID/GID was already allocated dynamically, push the data we popped out back in. If it was already