Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for libassuan file sockets (WinGnuPG support) #2

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

NZSmartie
Copy link

This closes #1. See that issue for details on this pull request.

Some housekeeping is needed though. Although I create a overlapped socket handle, i don't check all edge cases of it failing. will need to tidy that up

@NZSmartie
Copy link
Author

I've noticed that npiperelay.exe likes to hang around after the pipe has finished. not sure if the socket isn't getting closed.

@NZSmartie NZSmartie changed the title Add support for libassuane file sockets Add support for libassuan file sockets Dec 29, 2017
@NZSmartie
Copy link
Author

Hey @jstarks, this PR is ready for review and merging!

@jstarks
Copy link
Owner

jstarks commented Dec 31, 2017

Thanks for the contribution! I think it might be cleaner to require a special flag for this case rather than auto detect, since the user surely knows which case they’re in.

Also, you can probably avoid the overlapped file stuff for the file and socket and just use Go’s built in support.

And you may be able to make the file parsing more idiomatic. I suggest looking at bufio.Reader.

@NZSmartie
Copy link
Author

I went with overlapped file IO to minimise needing to change code elsewhere. Then again i'm new to Go and yet to explore how it all works.

Decided against using a flag for convenience, but will require one for libassaun since it is a special case.
As I'm still very new to Go and went with what i knew. Will investigate bufio.Reader and update accordingly

@NZSmartie
Copy link
Author

Hey @jstarks, I've add a -a flag that must be explicitly set in order to use libassuan file sockets. and I've moved to using bufio for reading the file itself.

@NZSmartie
Copy link
Author

Hello?

@NZSmartie NZSmartie changed the title Add support for libassuan file sockets Add support for libassuan file sockets (WinGnuPG support) Feb 18, 2018
@otakup0pe
Copy link

Given the choice between this and invoking gpg.exe from WSL, I'd love to try this out....

@neersighted
Copy link

I'd like to see this merged, or fixed up if it needs to be, if possible. @jstarks is there a list of blockers on merging this?

continue
}

err = os.NewSyscallError("ConnectEx", err)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this should be inside the if err != nil block below.

log.Printf("Port: %d, Nonce: %X", port, nonce)
}

_ = conn.Close()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_ = conn.Close()
conn.Close()

}

// LibAssaaun file socket: Attempt to read contents of the target file and connect to a TCP port
if *assuan {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer that the existing pipe path stay the same as it was (don't change dialPipe) and that this path be a separate branch, maybe a separate function dialAssuan.

@jstarks
Copy link
Owner

jstarks commented Nov 21, 2018

I think we can get this merged, I'd just like to see some minor cleanup first.

@MacLeodMike
Copy link

Any progress on this? I'd love to have a stable way interacting with gpg4win's gpg-agent from WSL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for LibAssuan file sockets
5 participants