aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraubble <anmol@aubble.com>2015-08-20 14:31:15 -0400
committerAdam Langley <agl@golang.org>2015-08-29 19:28:03 +0000
commitbfa016150b886b76cc1a4050ee8b6e98d0e0e9ba (patch)
tree39dfa7730dd4c6a6393df879de1b5fc5ef4a3de4 /src
parent74245b03534dfec5f719aa60e03c0b932aa63e26 (diff)
downloadgo-bfa016150b886b76cc1a4050ee8b6e98d0e0e9ba.tar.xz
crypto/tls: allow tls.Listen when only GetCertificate is provided.
Go 1.5 allowed TLS connections where Config.Certificates was nil as long as the GetCertificate callback was given. However, tls.Listen wasn't updated accordingly until this change. Change-Id: I5f67f323f63c988ff79642f3daf8a6b2a153e6b2 Reviewed-on: https://go-review.googlesource.com/13801 Reviewed-by: Adam Langley <agl@golang.org>
Diffstat (limited to 'src')
-rw-r--r--src/crypto/tls/tls.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/crypto/tls/tls.go b/src/crypto/tls/tls.go
index 0b1c3778ad..f6d5bb1b9a 100644
--- a/src/crypto/tls/tls.go
+++ b/src/crypto/tls/tls.go
@@ -67,8 +67,8 @@ func NewListener(inner net.Listener, config *Config) net.Listener {
// The configuration config must be non-nil and must have
// at least one certificate.
func Listen(network, laddr string, config *Config) (net.Listener, error) {
- if config == nil || len(config.Certificates) == 0 {
- return nil, errors.New("tls.Listen: no certificates in configuration")
+ if config == nil || (len(config.Certificates) == 0 && config.GetCertificate == nil) {
+ return nil, errors.New("tls: neither Certificates nor GetCertificate set in Config")
}
l, err := net.Listen(network, laddr)
if err != nil {