go/fix_certificates_lookup.patch
Flavio Castelli d10969cffe Accepting request 360455 from home:jordimassaguerpla:go
- Update to version 1.6
  * On Linux on little-endian 64-bit PowerPC (linux/ppc64le), Go 1.6 now supports cgo with external linking and is roughly feature complete.
  * Vendoring support
  * HTTP2 transparent support
  * fix gc and gccgo incompatibility regarding embedded unexported struct types containing exported fields
  * Linux on 64-bit MIPS and Android on 32-bit x86
  * enforced rules for sharing Go pointers with C
  * new mechanism for template reuse
  * performance improvements
  ... and more!
   see more in https://tip.golang.org/doc/go1.6

OBS-URL: https://build.opensuse.org/request/show/360455
OBS-URL: https://build.opensuse.org/package/show/devel:languages:go/go?expand=0&rev=249
2016-02-19 13:26:44 +00:00

56 lines
1.3 KiB
Diff

diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go
index 9f06f9d..b3b2bb8 100644
--- a/src/crypto/x509/root_unix.go
+++ b/src/crypto/x509/root_unix.go
@@ -6,13 +6,15 @@
package x509
-import "io/ioutil"
+import (
+ "io/ioutil"
+ "os"
+)
// Possible directories with certificate files; stop after successfully
// reading at least one file from a directory.
var certDirectories = []string{
- "/etc/ssl/certs", // SLES10/SLES11, https://golang.org/issue/12139
- "/system/etc/security/cacerts", // Android
+ "/etc/ssl/certs", // SLES10/SLES11, https://golang.org/issue/12139
}
func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
@@ -30,22 +32,26 @@ func initSystemRoots() {
}
}
+ rootsAdded := false
+
for _, directory := range certDirectories {
fis, err := ioutil.ReadDir(directory)
if err != nil {
continue
}
- rootsAdded := false
for _, fi := range fis {
+ if fi.Mode()&os.ModeSymlink != 0 {
+ continue
+ }
data, err := ioutil.ReadFile(directory + "/" + fi.Name())
if err == nil && roots.AppendCertsFromPEM(data) {
rootsAdded = true
}
}
- if rootsAdded {
- systemRoots = roots
- return
- }
+ }
+
+ if rootsAdded {
+ systemRoots = roots
}
// All of the files failed to load. systemRoots will be nil which will