• Adam Langley's avatar
    crypto/tls: enforce that either ServerName or InsecureSkipVerify be given. · fca335e9
    Adam Langley authored
    crypto/tls has two functions for creating a client connection: Dial,
    which most users are expected to use, and Client, which is the
    lower-level API.
    
    Dial does what you expect: it gives you a secure connection to the host
    that you specify and the majority of users of crypto/tls appear to work
    fine with it.
    
    Client gives more control but needs more care. Specifically, if it
    wasn't given a server name in the tls.Config then it didn't check that
    the server's certificates match any hostname - because it doesn't have
    one to check against. It was assumed that users of the low-level API
    call VerifyHostname on the certificate themselves if they didn't supply
    a hostname.
    
    A review of the uses of Client both within Google and in a couple of
    external libraries has shown that nearly all of them got this wrong.
    
    Thus, this change enforces that either a ServerName or
    InsecureSkipVerify is given. This does not affect tls.Dial.
    
    See discussion at https://groups.google.com/d/msg/golang-nuts/4vnt7NdLvVU/b1SJ4u0ikb0J.
    
    Fixes #7342.
    
    LGTM=bradfitz
    R=golang-codereviews, bradfitz
    CC=golang-codereviews
    https://golang.org/cl/67010043
    fca335e9
Name
Last commit
Last update
..
articles Loading commit data...
codewalk Loading commit data...
devel Loading commit data...
gopher Loading commit data...
play Loading commit data...
progs Loading commit data...
Makefile Loading commit data...
asm.html Loading commit data...
cmd.html Loading commit data...
code.html Loading commit data...
contrib.html Loading commit data...
contribute.html Loading commit data...
debugging_with_gdb.html Loading commit data...
docs.html Loading commit data...
effective_go.html Loading commit data...
gccgo_contribute.html Loading commit data...
gccgo_install.html Loading commit data...
go-logo-black.png Loading commit data...
go-logo-blue.png Loading commit data...
go-logo-white.png Loading commit data...
go1.1.html Loading commit data...
go1.2.html Loading commit data...
go1.3.txt Loading commit data...
go1.html Loading commit data...
go1compat.html Loading commit data...
go_faq.html Loading commit data...
go_mem.html Loading commit data...
go_spec.html Loading commit data...
help.html Loading commit data...
ie.css Loading commit data...
install-source.html Loading commit data...
install.html Loading commit data...
logo-153x55.png Loading commit data...
root.html Loading commit data...
share.png Loading commit data...
sieve.gif Loading commit data...
tos.html Loading commit data...