Skip to content

Commit

Permalink
Merge pull request #760 from mlipscombe/issue-688
Browse files Browse the repository at this point in the history
fix: make `tls_client` configuration work in `target.smtp` block, fixes #688
  • Loading branch information
foxcpp authored Mar 9, 2025
2 parents d97f9cb + 63420d1 commit fa47d40
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions internal/target/smtp/smtp_downstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ type Downstream struct {
hostname string
endpoints []config.Endpoint
saslFactory saslClientFactory
tlsConfig tls.Config
tlsConfig *tls.Config

connectTimeout time.Duration
commandTimeout time.Duration
Expand Down Expand Up @@ -121,7 +121,7 @@ func (u *Downstream) Init(cfg *config.Map) error {
return nil, nil
}, saslAuthDirective, &u.saslFactory)
cfg.Custom("tls_client", true, false, func() (interface{}, error) {
return tls.Config{}, nil
return &tls.Config{}, nil
}, tls2.TLSClientBlock, &u.tlsConfig)
cfg.Duration("connect_timeout", false, false, 5*time.Minute, &u.connectTimeout)
cfg.Duration("command_timeout", false, false, 5*time.Minute, &u.commandTimeout)
Expand Down Expand Up @@ -229,9 +229,9 @@ func (d *delivery) connect(ctx context.Context) error {
for _, endp := range d.u.endpoints {
var err error
if d.u.lmtp {
_, err = conn.ConnectLMTP(ctx, endp, d.u.starttls, &d.u.tlsConfig)
_, err = conn.ConnectLMTP(ctx, endp, d.u.starttls, d.u.tlsConfig)
} else {
_, err = conn.Connect(ctx, endp, d.u.starttls, &d.u.tlsConfig)
_, err = conn.Connect(ctx, endp, d.u.starttls, d.u.tlsConfig)
}
if err != nil {
if len(d.u.endpoints) != 1 {
Expand Down
2 changes: 1 addition & 1 deletion internal/target/smtp/smtp_downstream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func TestDownstreamDelivery_StartTLS(t *testing.T) {
Port: testPort,
},
},
tlsConfig: *clientCfg.Clone(),
tlsConfig: clientCfg.Clone(),
starttls: true,
log: testutils.Logger(t, "target.smtp"),
}
Expand Down

0 comments on commit fa47d40

Please sign in to comment.