Skip to content

Commit fa47d40

Browse files
authored
Merge pull request #760 from mlipscombe/issue-688
fix: make `tls_client` configuration work in `target.smtp` block, fixes #688
2 parents d97f9cb + 63420d1 commit fa47d40

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

internal/target/smtp/smtp_downstream.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type Downstream struct {
5757
hostname string
5858
endpoints []config.Endpoint
5959
saslFactory saslClientFactory
60-
tlsConfig tls.Config
60+
tlsConfig *tls.Config
6161

6262
connectTimeout time.Duration
6363
commandTimeout time.Duration
@@ -121,7 +121,7 @@ func (u *Downstream) Init(cfg *config.Map) error {
121121
return nil, nil
122122
}, saslAuthDirective, &u.saslFactory)
123123
cfg.Custom("tls_client", true, false, func() (interface{}, error) {
124-
return tls.Config{}, nil
124+
return &tls.Config{}, nil
125125
}, tls2.TLSClientBlock, &u.tlsConfig)
126126
cfg.Duration("connect_timeout", false, false, 5*time.Minute, &u.connectTimeout)
127127
cfg.Duration("command_timeout", false, false, 5*time.Minute, &u.commandTimeout)
@@ -229,9 +229,9 @@ func (d *delivery) connect(ctx context.Context) error {
229229
for _, endp := range d.u.endpoints {
230230
var err error
231231
if d.u.lmtp {
232-
_, err = conn.ConnectLMTP(ctx, endp, d.u.starttls, &d.u.tlsConfig)
232+
_, err = conn.ConnectLMTP(ctx, endp, d.u.starttls, d.u.tlsConfig)
233233
} else {
234-
_, err = conn.Connect(ctx, endp, d.u.starttls, &d.u.tlsConfig)
234+
_, err = conn.Connect(ctx, endp, d.u.starttls, d.u.tlsConfig)
235235
}
236236
if err != nil {
237237
if len(d.u.endpoints) != 1 {

internal/target/smtp/smtp_downstream_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ func TestDownstreamDelivery_StartTLS(t *testing.T) {
221221
Port: testPort,
222222
},
223223
},
224-
tlsConfig: *clientCfg.Clone(),
224+
tlsConfig: clientCfg.Clone(),
225225
starttls: true,
226226
log: testutils.Logger(t, "target.smtp"),
227227
}

0 commit comments

Comments
 (0)