Skip to content

Commit ba7cf4f

Browse files
move setting global TLS parameters to init to prevent -race from complaining (#532)
1 parent dcb560f commit ba7cf4f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tls.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@ import (
44
"encoding/base64"
55
"encoding/csv"
66
"fmt"
7+
"github.com/zmap/zcrypto/encoding/asn1"
8+
"github.com/zmap/zcrypto/x509/pkix"
79
"io/ioutil"
810
"os"
911
"strconv"
1012
"strings"
1113
"time"
1214

1315
log "github.com/sirupsen/logrus"
14-
"github.com/zmap/zcrypto/encoding/asn1"
1516
"github.com/zmap/zcrypto/tls"
1617
"github.com/zmap/zcrypto/x509"
17-
"github.com/zmap/zcrypto/x509/pkix"
1818
)
1919

20+
func init() {
21+
asn1.AllowPermissiveParsing = true
22+
pkix.LegacyNameString = true
23+
}
24+
2025
// Shared code for TLS scans.
2126
// Example usage:
2227
// (include TLSFlags in ScanFlags implementation)
@@ -149,9 +154,6 @@ func (t *TLSFlags) GetTLSConfigForTarget(target *ScanTarget) (*tls.Config, error
149154
}
150155
}
151156

152-
asn1.AllowPermissiveParsing = true
153-
pkix.LegacyNameString = true
154-
155157
if t.NextProtos != "" {
156158
// TODO: Different format?
157159
ret.NextProtos = getCSV(t.NextProtos)

0 commit comments

Comments
 (0)