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

replace shellouts with libc calls where possible #1143

Merged
merged 1 commit into from
Aug 11, 2016

Conversation

bookshelfdave
Copy link
Contributor

@bookshelfdave bookshelfdave commented Aug 11, 2016

You can test functionality via the test framework documented here.

Which reminds me, I'll have a PR "soonish" for the test stuff in Travis.

Signed-off-by: Dave Parfitt [email protected]

@thesentinels
Copy link
Contributor

@metadave, thanks for your PR! By analyzing the annotation information on this pull request, we identified @fnichol, @adamhjk, @reset, @smith and @juliandunn to be potential reviewers

@reset
Copy link
Collaborator

reset commented Aug 11, 2016

gif-keyboard-8160307767399486525

@reset reset merged commit 58e6ec3 into master Aug 11, 2016
@reset reset deleted the dp_remove_magic_shellouts branch August 11, 2016 18:33
@bookshelfdave
Copy link
Contributor Author

bookshelfdave commented Aug 12, 2016

I forgot to mention a few things here:

  • as UDP is connectionless, you may be wondering why we call connect here:
    pub fn ip() -> Result<IpAddr> {
    let socket = try!(UdpSocket::bind("0.0.0.0:0"));
    let _ = try!(socket.connect(GOOGLE_DNS));
    let addr =try!(socket.local_addr());
    Ok(addr.ip())
    }

After this call:

let socket = try!(UdpSocket::bind("0.0.0.0:0"));`

calling

socket.local_addr()

doesn't return a useful IP address.

However, calling

let _ = try!(socket.connect(GOOGLE_DNS));

performs some internal caching without making a network connection, and lets us use the result from:

let addr =try!(socket.local_addr());

See also:

@fnichol: anything else I should call out here?


  • thanks to @markan for his original work to get rid of chown.
  • thanks to @fnichol for a great pairing session.

Cheers!

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.

4 participants