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 Unix FD passing #62

Merged
merged 1 commit into from Oct 7, 2017
Merged

Add support for Unix FD passing #62

merged 1 commit into from Oct 7, 2017

Conversation

@steffen-kiess
Copy link

@steffen-kiess steffen-kiess commented Jun 5, 2017

Add support for Unix FD passing

During compilation, this requires Mono.Posix from mono with commit
2225b6a260e1f0d469e37ec0df68a89e832688cd (i.e. mono 4.6 or later).
During runtime it will fall back to an implementation which does not support
Unix FD passing when the Mono.Posix version is too old.

An example showing how to pass file descriptors can be found in
examples/UnixFD*.cs

This fixes #57

During compilation, this requires Mono.Posix from mono with commit
2225b6a260e1f0d469e37ec0df68a89e832688cd (i.e. mono 4.6 or later).
During runtime it will fall back to an implementation which does not support
Unix FD passing when the Mono.Posix version is too old.

An example showing how to pass file descriptors can be found in
examples/UnixFD*.cs
@directhex
Copy link
Contributor

@directhex directhex commented Oct 1, 2017

This builds here, and the provided example service works

directhex@bubblegum:~/Projects/dbus-sharp/examples$ mono --debug UnixFDService.exe
Waiting for requests...
Got FD as parameter:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
Got FD as parameter:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
Got FDs as parameter:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/7 -> /dev/null
Got FDs as variant parameter:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/7 -> /dev/null
Register for GotFD event at :1.129 / /mono_dbus_sharp_test/Signals
Got FD from signal:
lrwx------ 1 directhex directhex 64 Oct  1 07:48 /proc/18601/fd/6 -> /dev/null
Open FDs:
total 0
lrwx------ 1 directhex directhex 64 Oct  1 07:48 0 -> /dev/pts/0
lrwx------ 1 directhex directhex 64 Oct  1 07:48 1 -> /dev/pts/0
lrwx------ 1 directhex directhex 64 Oct  1 07:48 2 -> /dev/pts/0
lrwx------ 1 directhex directhex 64 Oct  1 07:48 3 -> socket:[128045]
lr-x------ 1 directhex directhex 64 Oct  1 07:48 4 -> /dev/urandom
lrwx------ 1 directhex directhex 64 Oct  1 07:48 5 -> socket:[128046]

I seem to recall offering a £100 bug bounty for this issue

@garuma garuma merged commit 5ff480a into mono:master Oct 7, 2017
garuma added a commit that referenced this pull request Oct 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.