Ports: Use sendfd()/recvfd() for mm_send_fd()/mm_receive_fd()

This commit is contained in:
Gunnar Beutner 2021-05-01 12:08:55 +02:00 committed by Andreas Kling
parent 17e5ba70b1
commit e69b729733
3 changed files with 37 additions and 0 deletions

View file

@ -8,5 +8,6 @@ webcontent:!:15:15:WebContent,,,:/:/bin/false
image:!:16:16:ImageDecoder,,,:/:/bin/false
symbol:!:17:17:SymbolServer,,,:/:/bin/false
websocket:!:18:18:WebSocket,,,:/:/bin/false
sshd:!:19:19:OpenSSH privsep,,,:/:/bin/false
anon:!:100:100:Anonymous,,,:/home/anon:/bin/sh
nona:!:200:200:Nona,,,:/home/nona:/bin/sh

View file

@ -9,4 +9,5 @@ webcontent:!*:18727::::::
image:!*:18727::::::
symbol:!*:18727::::::
websocket:!*:18727::::::
sshd:!*:18727::::::
nona:!*:18727::::::

View file

@ -0,0 +1,35 @@
diff -Naur openssh-portable-9ca7e9c861775dd6c6312bc8aaab687403d24676/monitor_fdpass.c openssh-portable-9ca7e9c861775dd6c6312bc8aaab687403d24676.serenity/monitor_fdpass.c
--- openssh-portable-9ca7e9c861775dd6c6312bc8aaab687403d24676/monitor_fdpass.c 2020-05-27 02:38:00.000000000 +0200
+++ openssh-portable-9ca7e9c861775dd6c6312bc8aaab687403d24676.serenity/monitor_fdpass.c 2021-05-01 12:32:21.145854477 +0200
@@ -51,6 +51,7 @@
int
mm_send_fd(int sock, int fd)
{
+#ifndef __serenity__
#if defined(HAVE_SENDMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
struct msghdr msg;
#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
@@ -107,11 +108,15 @@
error("%s: file descriptor passing not supported", __func__);
return -1;
#endif
+#else
+ return sendfd(sock, fd);
+#endif
}
int
mm_receive_fd(int sock)
{
+#ifndef __serenity__
#if defined(HAVE_RECVMSG) && (defined(HAVE_ACCRIGHTS_IN_MSGHDR) || defined(HAVE_CONTROL_IN_MSGHDR))
struct msghdr msg;
#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
@@ -184,4 +189,7 @@
error("%s: file descriptor passing not supported", __func__);
return -1;
#endif
+#else
+ return recvfd(sock, 0);
+#endif
}