Skip to content

Commit

Permalink
attempt to fix broken tls config
Browse files Browse the repository at this point in the history
  • Loading branch information
RicYaben committed Nov 6, 2024
1 parent dfdd56a commit d2bd5a7
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions modules/mqtt/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,20 @@ type scan struct {
func (scan *scan) getTLSConfig() (*tls.Config, error) {
cfg, err := scan.scanner.config.TLSFlags.GetTLSConfigForTarget(scan.target)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to create TLS config for target: %w", err)
}

var (
b []byte
t *tls.Config
)
if b, err = cfg.MarshalJSON(); err != nil {
return nil, err
b, err := cfg.MarshalJSON()
if err != nil {
return nil, fmt.Errorf("failed to marshal zgrab TLS config: %w", err)
}

var t tls.Config
if err = json.Unmarshal(b, &t); err != nil {
return nil, err
return nil, fmt.Errorf("failed to unmarshal TLS config: %w", err)
}

return t, nil
return &t, nil
}

func (scan *scan) makeClient() (paho.Client, error) {
Expand Down

0 comments on commit d2bd5a7

Please sign in to comment.