git » chasquid » commit 6dda2ff

chasquid: Introduce support for SMTPUTF8

author Alberto Bertogli
2016-10-01 19:03:44 UTC
committer Alberto Bertogli
2016-10-09 23:51:04 UTC
parent f767b83fe0202bce41b0ddd6d9f429f5ff864f39

chasquid: Introduce support for SMTPUTF8

This patch adds initial support for SMTPUTF8, which for now consists of just
advertising it.

We support most of it, but sending emails over SMTP requires further work, as
the SMTP courier does not support this yet (it's not in Go's standard
library). That will come in subsequent patches, along with IDNA handling.

https://tools.ietf.org/html/rfc6531.html

chasquid.go +1 -0
test/t-07-smtputf8/config/chasquid.conf +8 -0
test/t-07-smtputf8/content +6 -0
test/t-07-smtputf8/hosts +1 -0
test/t-07-smtputf8/run.sh +26 -0

diff --git a/chasquid.go b/chasquid.go
index 9f6d447..76de975 100644
--- a/chasquid.go
+++ b/chasquid.go
@@ -534,6 +534,7 @@ func (c *Conn) EHLO(params string) (code int, msg string) {
 	fmt.Fprintf(buf, c.hostname+" - Your hour of destiny has come.\n")
 	fmt.Fprintf(buf, "8BITMIME\n")
 	fmt.Fprintf(buf, "PIPELINING\n")
+	fmt.Fprintf(buf, "SMTPUTF8\n")
 	fmt.Fprintf(buf, "SIZE %d\n", c.maxDataSize)
 	if c.onTLS {
 		fmt.Fprintf(buf, "AUTH PLAIN\n")
diff --git a/test/t-07-smtputf8/config/chasquid.conf b/test/t-07-smtputf8/config/chasquid.conf
new file mode 100644
index 0000000..a805eae
--- /dev/null
+++ b/test/t-07-smtputf8/config/chasquid.conf
@@ -0,0 +1,8 @@
+smtp_address: ":1025"
+submission_address: ":1587"
+monitoring_address: ":1099"
+
+mail_delivery_agent_bin: "test-mda"
+mail_delivery_agent_args: "%to%"
+
+data_dir: "../.data"
diff --git a/test/t-07-smtputf8/content b/test/t-07-smtputf8/content
new file mode 100644
index 0000000..8fbedb8
--- /dev/null
+++ b/test/t-07-smtputf8/content
@@ -0,0 +1,6 @@
+From: ñandú@ñoños
+To: ñangapirí@ñoños
+Subject: Arañando el test
+
+Crece desde el test el futuro
+Crece desde el test
diff --git a/test/t-07-smtputf8/hosts b/test/t-07-smtputf8/hosts
new file mode 100644
index 0000000..d276cfd
--- /dev/null
+++ b/test/t-07-smtputf8/hosts
@@ -0,0 +1 @@
+ñoños localhost
diff --git a/test/t-07-smtputf8/run.sh b/test/t-07-smtputf8/run.sh
new file mode 100755
index 0000000..9c2a650
--- /dev/null
+++ b/test/t-07-smtputf8/run.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+
+set -e
+. $(dirname ${0})/../util/lib.sh
+
+init
+
+skip_if_python_is_too_old
+
+generate_certs_for ñoños
+add_user ñoños ñangapirí antaño
+
+# Python doesn't support UTF8 for auth, use an ascii user and domain.
+add_user nada nada nada
+
+mkdir -p .logs
+chasquid -v=2 --log_dir=.logs --config_dir=config &
+wait_until_ready 1025
+
+smtpc.py --server=localhost:1025 --user=nada@nada --password=nada \
+	< content
+
+wait_for_file .mail/ñangapirí@ñoños
+mail_diff content .mail/ñangapirí@ñoños
+
+success