From a7f33af1770db61d1dc5fd8192ed8e7ff94d5bf4 Mon Sep 17 00:00:00 2001 From: Christian Korneck Date: Thu, 25 Sep 2025 16:36:50 +0200 Subject: [PATCH] Add option to allow remote access to pipe. Signed-off-by: Christian Korneck --- pipe.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pipe.go b/pipe.go index a2da6639..d9e149d8 100644 --- a/pipe.go +++ b/pipe.go @@ -370,7 +370,14 @@ func makeServerPipeHandle(path string, sd []byte, c *PipeConfig, first bool) (wi } } - typ := uint32(windows.FILE_PIPE_REJECT_REMOTE_CLIENTS) + var typ uint32 + switch { + case c.AcceptRemoteClients: + typ |= windows.FILE_PIPE_ACCEPT_REMOTE_CLIENTS + default: + typ |= windows.FILE_PIPE_REJECT_REMOTE_CLIENTS + } + if c.MessageMode { typ |= windows.FILE_PIPE_MESSAGE_TYPE } @@ -498,6 +505,10 @@ type PipeConfig struct { // when the pipe is in message mode. MessageMode bool + // AcceptRemoteClients determines whether clients connecting from remote machines + // (for example over SMB) are permitted. When false, remote clients are rejected. + AcceptRemoteClients bool + // InputBufferSize specifies the size of the input buffer, in bytes. InputBufferSize int32