diff options
author | Kay Sievers <kay@vrfy.org> | 2014-04-19 13:53:11 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2014-04-19 13:53:11 +0200 |
commit | 2f20a8ebdb5aed3146f366360762d8963efe8d82 (patch) | |
tree | 20d592fe3add1828ce68129dd82dbd42060ff0d5 /src/core | |
parent | a606871da508995f5ede113a8fc6538afd98966c (diff) |
Revert "Handle Unix domain socket connections from outside our namespace"
This reverts commit 9754d56e9b21bfe89fc18f47987d6bef491b8521.
It causes a crash in PID1:
Apr 19 13:49:32 lon systemd[1]: Code should not be reached 'Unhandled socket type.'
at src/core/socket.c:684, function instance_from_socket(). Aborting.
Apr 19 13:49:32 lon systemd[1]: Caught <ABRT>, dumped core as pid 336.
Apr 19 13:49:32 lon systemd[1]: Freezing execution.
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/socket.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/core/socket.c b/src/core/socket.c index d57e7701ca..7c18a2b75c 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -663,21 +663,17 @@ static int instance_from_socket(int fd, unsigned nr, char **instance) { int k; k = getpeercred(fd, &ucred); - if (k >= 0) { - if (asprintf(&r, - "%u-"PID_FMT"-"UID_FMT, - nr, ucred.pid, ucred.uid) < 0) - return -ENOMEM; - } else 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; + + break; } default: |