mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +03:00
systemd: Apply patch to make container logins work again
This commit is contained in:
parent
150d3b0095
commit
2503e7e0c8
@ -26,6 +26,45 @@ index 41605ee..8517369 100644
|
|||||||
if (switch_root_dir)
|
if (switch_root_dir)
|
||||||
args[i++] = "--switched-root";
|
args[i++] = "--switched-root";
|
||||||
args[i++] = arg_running_as == SYSTEMD_SYSTEM ? "--system" : "--user";
|
args[i++] = arg_running_as == SYSTEMD_SYSTEM ? "--system" : "--user";
|
||||||
|
diff --git a/src/core/socket.c b/src/core/socket.c
|
||||||
|
index 7c18a2b..eba67d5 100644
|
||||||
|
--- a/src/core/socket.c
|
||||||
|
+++ b/src/core/socket.c
|
||||||
|
@@ -663,16 +663,25 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) {
|
||||||
|
int k;
|
||||||
|
|
||||||
|
k = getpeercred(fd, &ucred);
|
||||||
|
- if (k < 0)
|
||||||
|
+ if (k == -ENODATA) {
|
||||||
|
+ /* This handles the case where somebody is
|
||||||
|
+ * connecting from another pid/uid namespace
|
||||||
|
+ * (e.g. from outside of our container). */
|
||||||
|
+ if (asprintf(&r,
|
||||||
|
+ "%u-unknown",
|
||||||
|
+ nr) < 0)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+ else if (k < 0)
|
||||||
|
return k;
|
||||||
|
-
|
||||||
|
- if (asprintf(&r,
|
||||||
|
- "%u-%lu-%lu",
|
||||||
|
- nr,
|
||||||
|
- (unsigned long) ucred.pid,
|
||||||
|
- (unsigned long) ucred.uid) < 0)
|
||||||
|
- return -ENOMEM;
|
||||||
|
-
|
||||||
|
+ else {
|
||||||
|
+ if (asprintf(&r,
|
||||||
|
+ "%u-%lu-%lu",
|
||||||
|
+ nr,
|
||||||
|
+ (unsigned long) ucred.pid,
|
||||||
|
+ (unsigned long) ucred.uid) < 0)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
diff --git a/src/core/umount.c b/src/core/umount.c
|
diff --git a/src/core/umount.c b/src/core/umount.c
|
||||||
index d1258f0..0311812 100644
|
index d1258f0..0311812 100644
|
||||||
--- a/src/core/umount.c
|
--- a/src/core/umount.c
|
||||||
|
Loading…
Reference in New Issue
Block a user