natefinch / npipe

A Windows named pipe implementation written in pure Go.
MIT License
297 stars 73 forks source link

Add security attributes to PipeListener (Fixes #5) #12

Closed chowey closed 9 years ago

natefinch commented 10 years ago

This looks good, but don't you need to support attributes on the dial, to match those on the listen? Also, it definitely needs tests.

chowey commented 10 years ago

My reason for needing this was opening a named pipe server in a background process, and connecting to it in a user process. In this case, I need to specify permissive security attributes on the named pipe server or the client cannot write anything. But for some reason the default security attributes worked fine on the client.

For symmetry, I will put in variants of Dial to allow you to specify security attributes there too.

I will include a unit test too.

chowey commented 10 years ago

On second read, the security attributes on a named pipe are controlled by the server (i.e. on CreateNamedPipe). See Named Pipe Security and Access Rights.

There is no reason I can see to add non-default security attributes on the CreateFile call. If you want I'll revert that last commit. I don't think it is necessary to clutter the API until someone needs the functionality.