Skip to content

Commit d95e4f9

Browse files
committed
Bump go-smtp version, update tests to expect LF in messages
Upstream change fixes \r\n\r\n being mangled into \r\n\n.
1 parent 18657de commit d95e4f9

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/emersion/go-milter v0.1.1-0.20200513090417-c3e74efc8df9
1818
github.com/emersion/go-msgauth v0.5.0
1919
github.com/emersion/go-sasl v0.0.0-20200509203442-7bfe0ed36a21
20-
github.com/emersion/go-smtp v0.13.1-0.20200721085548-87b76f44681a
20+
github.com/emersion/go-smtp v0.13.1-0.20200724113925-09421d11e5b0
2121
github.com/foxcpp/go-dovecot-sasl v0.0.0-20200522223722-c4699d7a24bf
2222
github.com/foxcpp/go-imap-i18nlevel v0.0.0-20200208001533-d6ec88553005
2323
github.com/foxcpp/go-imap-sql v0.4.1-0.20200719153150-6551cd572c1c

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ github.com/emersion/go-smtp v0.13.1-0.20200521085049-d143b3ef4b5e h1:y2iLWskJUT3
5858
github.com/emersion/go-smtp v0.13.1-0.20200521085049-d143b3ef4b5e/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ=
5959
github.com/emersion/go-smtp v0.13.1-0.20200721085548-87b76f44681a h1:tswS/0NdSOgkDP9I+9lulxsWcLalddcX2t0zSFUB57I=
6060
github.com/emersion/go-smtp v0.13.1-0.20200721085548-87b76f44681a/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ=
61+
github.com/emersion/go-smtp v0.13.1-0.20200724113925-09421d11e5b0 h1:110GWeGuYRg82JJxTAucVmonobbR79ubOWFvDAE5rQM=
62+
github.com/emersion/go-smtp v0.13.1-0.20200724113925-09421d11e5b0/go.mod h1:qm27SGYgoIPRot6ubfQ/GpiPy/g3PaZAVRxiO/sDUgQ=
6163
github.com/emersion/go-textwrapper v0.0.0-20160606182133-d0e65e56babe h1:40SWqY0zE3qCi6ZrtTf5OUdNm5lDnGnjRSq9GgmeTrg=
6264
github.com/emersion/go-textwrapper v0.0.0-20160606182133-d0e65e56babe/go.mod h1:aqO8z8wPrjkscevZJFVE1wXJrLpC5LtJG7fqLOsPb2U=
6365
github.com/foxcpp/go-dovecot-sasl v0.0.0-20200522223722-c4699d7a24bf h1:rmBPY5fryjp9zLQYsUmQqqgsYq7qeVfrjtr96Tf9vD8=

internal/target/queue/queue_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ func TestQueueDelivery_AbortNoDangling(t *testing.T) {
589589
IDRaw := sha1.Sum([]byte(t.Name()))
590590
encodedID := hex.EncodeToString(IDRaw[:])
591591

592-
body := buffer.MemoryBuffer{Slice: []byte("foobar")}
592+
body := buffer.MemoryBuffer{Slice: []byte("foobar\r\n")}
593593
ctx := module.MsgMetadata{
594594
DontTraceSender: true,
595595
ID: encodedID,
@@ -764,7 +764,7 @@ func TestQueueDSN_RcptRewrite(t *testing.T) {
764764
IDRaw := sha1.Sum([]byte(t.Name()))
765765
encodedID := hex.EncodeToString(IDRaw[:])
766766

767-
body := buffer.MemoryBuffer{Slice: []byte("foobar")}
767+
body := buffer.MemoryBuffer{Slice: []byte("foobar\r\n")}
768768
ctx := module.MsgMetadata{
769769
DontTraceSender: true,
770770
OriginalFrom: "test3@example.org",

internal/testutils/smtp_server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (be *SMTPBackend) CheckMsg(t *testing.T, indx int, from string, rcptTo []st
7272
t.Errorf("Wrong RCPT TO: %v", msg.To)
7373
}
7474
if string(msg.Data) != DeliveryData {
75-
t.Errorf("Wrong DATA payload: %v", string(msg.Data))
75+
t.Errorf("Wrong DATA payload: %v (%v)", string(msg.Data), msg.Data)
7676
}
7777
}
7878

internal/testutils/target.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,10 +225,10 @@ func DoTestDeliveryNonAtomic(t *testing.T, c module.StatusCollector, tgt module.
225225
return encodedID
226226
}
227227

228-
const DeliveryData = "A: 1\n" +
229-
"B: 2\n" +
230-
"\n" +
231-
"foobar\n"
228+
const DeliveryData = "A: 1\r\n" +
229+
"B: 2\r\n" +
230+
"\r\n" +
231+
"foobar\r\n"
232232

233233
func DoTestDeliveryErr(t *testing.T, tgt module.DeliveryTarget, from string, to []string) (string, error) {
234234
return DoTestDeliveryErrMeta(t, tgt, from, to, &module.MsgMetadata{})
@@ -241,7 +241,7 @@ func DoTestDeliveryErrMeta(t *testing.T, tgt module.DeliveryTarget, from string,
241241
encodedID := hex.EncodeToString(IDRaw[:])
242242
testCtx := context.Background()
243243

244-
body := buffer.MemoryBuffer{Slice: []byte("foobar\n")}
244+
body := buffer.MemoryBuffer{Slice: []byte("foobar\r\n")}
245245
msgMeta.DontTraceSender = true
246246
msgMeta.ID = encodedID
247247
t.Log("-- tgt.Start", from)
@@ -318,8 +318,8 @@ func CheckMsgID(t *testing.T, msg *Msg, sender string, rcpt []string, id string)
318318
if !reflect.DeepEqual(msg.RcptTo, rcpt) {
319319
t.Errorf("wrong recipients, want %v, got %v", rcpt, msg.RcptTo)
320320
}
321-
if string(msg.Body) != "foobar\n" {
322-
t.Errorf("wrong body, want '%s', got '%s'", "foobar", string(msg.Body))
321+
if string(msg.Body) != "foobar\r\n" {
322+
t.Errorf("wrong body, want '%s', got '%s' (%v)", "foobar\r\n", string(msg.Body), msg.Body)
323323
}
324324

325325
return msg.MsgMeta.ID

0 commit comments

Comments
 (0)