Blame SOURCES/golang-1.15-warnCN.patch

41f000
diff --git a/src/crypto/x509/verify.go b/src/crypto/x509/verify.go
41f000
index 50f4d4a..121fd1b 100644
41f000
--- a/src/crypto/x509/verify.go
41f000
+++ b/src/crypto/x509/verify.go
41f000
@@ -20,6 +20,9 @@ import (
41f000
 
41f000
 // ignoreCN disables interpreting Common Name as a hostname. See issue 24151.
41f000
 var ignoreCN = !strings.Contains(os.Getenv("GODEBUG"), "x509ignoreCN=0")
41f000
+// if using Common Name as a hostname is enabled via x509ignoreCN=0,
41f000
+// warnCN enables a warning whenever Common Name is interpreted as a hostname.
41f000
+var warnCN = strings.Contains(os.Getenv("GODEBUG"), "x509warnCN=1")
41f000
 
41f000
 type InvalidReason int
41f000
 
41f000
@@ -1078,6 +1081,10 @@ func (c *Certificate) VerifyHostname(h string) error {
41f000
 	names := c.DNSNames
41f000
 	if c.commonNameAsHostname() {
41f000
 		names = []string{c.Subject.CommonName}
41f000
+		if warnCN {
41f000
+			fmt.Fprintf(os.Stderr, "x509: Warning - certificate relies on legacy Common Name field. " +
41f000
+				"Using CN without SAN is deprecated and will not work in future versions.\n")
41f000
+		}
41f000
 	}
41f000
 
41f000
 	candidateName := toLowerCaseASCII(h) // Save allocations inside the loop.