Skip to content

Commit

Permalink
Allow remote named pipe
Browse files Browse the repository at this point in the history
Signed-off-by: Inndy Lin <inndy.tw@gmail.com>
  • Loading branch information
Inndy committed Nov 22, 2023
1 parent 553a715 commit 281d96e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,12 @@ func makeServerPipeHandle(path string, sd []byte, c *PipeConfig, first bool) (wi
}
}

typ := uint32(windows.FILE_PIPE_REJECT_REMOTE_CLIENTS)
var typ uint32
if c.AllowRemoteClients {
typ = uint32(windows.FILE_PIPE_ACCEPT_REMOTE_CLIENTS)
} else {
typ = uint32(windows.FILE_PIPE_REJECT_REMOTE_CLIENTS)
}
if c.MessageMode {
typ |= windows.FILE_PIPE_MESSAGE_TYPE
}
Expand Down Expand Up @@ -503,6 +508,10 @@ type PipeConfig struct {

// OutputBufferSize specifies the size of the output buffer, in bytes.
OutputBufferSize int32

// AllowRemoteClients determines whether the pipe is allowed to be used remotely (i.e. connect
// to named pipe via SMB share)
AllowRemoteClients bool
}

// ListenPipe creates a listener on a Windows named pipe path, e.g. \\.\pipe\mypipe.
Expand Down

0 comments on commit 281d96e

Please sign in to comment.