Assume direct TLS if SMTP autoconfig finds port 465.
authorAndrej Kacian <ticho@claws-mail.org>
Thu, 13 Apr 2017 07:06:30 +0000 (09:06 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Thu, 13 Apr 2017 07:06:30 +0000 (09:06 +0200)
Technically, this is incorrect:
A direct TLS-only SMTP service is against the standards,
and a "_submission._tcp" SRV record should have a port
that has a plaintext+STARTTLS service listening
(RFC 6186, section 3.1).

Port 465 shouldn't even be used for mail submission of
any kind, according to IANA:
(https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=465)

However, everyone ignores that, and port 465 is routinely
used for TLS-only SMTP service, and therefore it is safe to
assume direct TLS instead of STARTTLS.

src/gtk/gtkutils.c
src/prefs_account.c

index 4500e0a732f18580d4bc3f2cc29291079c358e50..f3c7aba38b89f7f0e9f1891e3d6c378f0f29e747 100644 (file)
@@ -1879,6 +1879,8 @@ GdkPixbuf *claws_load_pixbuf_fitting(GdkPixbuf *src_pixbuf, int box_width,
 #if (defined USE_GNUTLS && GLIB_CHECK_VERSION(2,22,0))
 static void auto_configure_done(const gchar *hostname, gint port, gboolean ssl, AutoConfigureData *data)
 {
+       gboolean smtp = strcmp(data->tls_service, "submission") == 0 ? TRUE : FALSE;
+
        if (hostname != NULL) {
                if (data->hostname_entry)
                        gtk_entry_set_text(data->hostname_entry, hostname);
@@ -1904,7 +1906,15 @@ static void auto_configure_done(const gchar *hostname, gint port, gboolean ssl,
                                /* Wizard where TLS is [x]SSL + [x]TLS */
                                gtk_toggle_button_set_active(data->ssl_checkbtn, TRUE);
                        }
-                       gtk_toggle_button_set_active(data->tls_checkbtn, TRUE);
+
+                       /* Even though technically this is against the RFCs,
+                        * if a "_submission._tcp" SRV record uses port 465,
+                        * it is safe to assume TLS-only service, instead of
+                        * plaintext + STARTTLS one. */
+                       if (smtp && port == 465)
+                               gtk_toggle_button_set_active(data->ssl_checkbtn, TRUE);
+                       else
+                               gtk_toggle_button_set_active(data->tls_checkbtn, TRUE);
                }
 
                /* Check authentication by default. This is probably required if
index 85207840ab2281b4944c28f6e34093f72ca4026e..30c3d0abec6883185ea51d1b97dca4cd0fc24c16 100644 (file)
@@ -4016,7 +4016,7 @@ static void auto_configure_cb (GtkWidget *widget, gpointer data)
        send_data->set_port = GTK_TOGGLE_BUTTON(advanced_page.smtpport_checkbtn);
        send_data->port = GTK_SPIN_BUTTON(advanced_page.smtpport_spinbtn);
        send_data->tls_checkbtn = GTK_TOGGLE_BUTTON(ssl_page.smtp_starttls_radiobtn);
-       send_data->ssl_checkbtn = NULL;
+       send_data->ssl_checkbtn = GTK_TOGGLE_BUTTON(ssl_page.smtp_ssltunnel_radiobtn);
        send_data->default_port = 25;
        send_data->default_ssl_port = -1;
        send_data->uid_entry = NULL;