FAQ
Reviewers: agl1, dfc,

Message:
Hello agl@golang.org, dave@cheney.net (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go.crypto


Description:
go.crypto/ssh: seed random generator, so auto port allocation is truly
random.

Please review this at https://codereview.appspot.com/12027043/

Affected files:
    M ssh/tcpip.go


Index: ssh/tcpip.go
===================================================================
--- a/ssh/tcpip.go
+++ b/ssh/tcpip.go
@@ -44,6 +44,8 @@

   const openSSHPrefix = "OpenSSH_"

+var portRandomizer = rand.New(rand.NewSource(time.Now().UnixNano()))
+
   // isBrokenOpenSSHVersion returns true if the given version string
   // specifies a version of OpenSSH that is known to have a bug in port
   // forwarding.
@@ -71,7 +73,7 @@
    const tries = 10
    for i := 0; i < tries; i++ {
     addr := *laddr
- addr.Port = 1024 + rand.Intn(60000)
+ addr.Port = 1024 + portRandomizer.Intn(60000)
     sshListener, err = c.ListenTCP(&addr)
     if err == nil {
      laddr.Port = addr.Port


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Hanwen at Jul 29, 2013 at 1:26 pm

    On 2013/07/29 13:13:44, hanwen wrote:
    Hello mailto:agl@golang.org, mailto:dave@cheney.net (cc:
    mailto:golang-dev@googlegroups.com),
    I'd like you to review this change to
    https://code.google.com/p/go.crypto
    ps. I'll be away from email for 2 weeks starting this afternoon.

    https://codereview.appspot.com/12027043/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Agl at Jul 29, 2013 at 5:10 pm
    *** Submitted as
    https://code.google.com/p/go/source/detail?r=96563f6f87f6&repo=crypto
    ***

    go.crypto/ssh: seed random generator, so auto port allocation is truly
    random.

    R=agl, dave
    CC=golang-dev
    https://codereview.appspot.com/12027043

    Committer: Adam Langley <agl@golang.org>


    https://codereview.appspot.com/12027043/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Agl at Jul 29, 2013 at 5:10 pm
    I though about making this randomness stronger, but it's only for a
    workaround of a buggy sshd, so I think keeping it simple is preferable.

    https://codereview.appspot.com/12027043/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedJul 29, '13 at 1:13p
activeJul 29, '13 at 5:10p
posts4
users2
websitegolang.org

2 users in discussion

Hanwen: 2 posts Agl: 2 posts

People

Translate

site design / logo © 2022 Grokbase