Try to starttls if it seems to be the only
authorColin Leroy <colin@colino.net>
Tue, 18 Feb 2003 10:13:00 +0000 (10:13 +0000)
committerColin Leroy <colin@colino.net>
Tue, 18 Feb 2003 10:13:00 +0000 (10:13 +0000)
way to authenticate a user

ChangeLog.claws
configure.ac
src/common/smtp.c
src/common/smtp.h
src/prefs_account.c

index 6c815d2ddd35e1e24aeabe9bb2f56bce130a6588..166b6aaae2d3634e6e07fa8b1bc0f660e91b0dd9 100644 (file)
@@ -1,3 +1,10 @@
+2003-02-18 [colin]     0.8.10claws23
+
+       * src/common/smtp.[ch]
+         src/prefs_account.c
+               Try to starttls if it seems to be the only
+               way to authenticate a user
+
 2003-02-18 [paul]      0.8.10claws22
 
        * src/Makefile.am
index 163fbd31bd007aacee152f97f341d1618fb8eb41..8d8668e34b9e17665154f1d7a807210af3144ac7 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=10
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws22
+EXTRA_VERSION=claws23
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 82a0cbaa0f7ab70c566cd40bc0ccbac991f4071e..6179443bc01593060ffe062682060c35dfdaedba 100644 (file)
@@ -140,11 +140,18 @@ gint smtp_connect(SMTPSession *session, const gchar *server, gushort port,
        else
                val = smtp_helo(session, domain);
        if (val != SM_OK) {
-               log_warning(_("Error occurred while sending HELO\n"));
+               log_warning(use_esmtp?  _("Error occurred while sending EHLO\n"):
+                                       _("Error occurred while sending HELO\n"));
                return val;
        }
 
 #if USE_OPENSSL
+       /* if we have a user to authenticate and no auth methods, but starttls,
+          try to starttls */
+       if (ssl_type == SSL_NONE && avail_auth_type == SMTPAUTH_TLS_AVAILABLE 
+           && user != NULL)
+               ssl_type = SSL_STARTTLS;
+
        if (ssl_type == SSL_STARTTLS) {
                val = smtp_starttls(session);
                if (val != SM_OK) {
@@ -321,6 +328,9 @@ gint smtp_ehlo(SMTPSession *session, const gchar *hostname,
                                        *avail_auth_type |= SMTPAUTH_CRAM_MD5;
                                if (strcasestr(p, "DIGEST-MD5"))
                                        *avail_auth_type |= SMTPAUTH_DIGEST_MD5;
+                       } else if (g_strncasecmp(p, "STARTTLS", 8) == 0) {
+                               p += 9;
+                               *avail_auth_type |= SMTPAUTH_TLS_AVAILABLE;
                        }
                } else if ((buf[0] == '1' || buf[0] == '2' || buf[0] == '3') &&
                    (buf[3] == ' ' || buf[3] == '\0'))
index 86bf614a078456eaf77b692b6e32ff6e33704c7f..5e58ce5954df91ead3944acef4dc03577c3cde46 100644 (file)
@@ -51,7 +51,8 @@ typedef enum
 {
        SMTPAUTH_LOGIN      = 1 << 0,
        SMTPAUTH_CRAM_MD5   = 1 << 1,
-       SMTPAUTH_DIGEST_MD5 = 1 << 2
+       SMTPAUTH_DIGEST_MD5 = 1 << 2,
+       SMTPAUTH_TLS_AVAILABLE = 1 << 3
 } SMTPAuthType;
 
 typedef enum
index 35171c7445ec8e286cd48b41cb58829db78513ab..31ddbfec1aa16e6ef5e880ebdcc7dd935cec9189 100644 (file)
@@ -1794,7 +1794,7 @@ static void prefs_account_ssl_create(void)
 
        CREATE_RADIO_BUTTONS(vbox5,
                             smtp_nossl_radiobtn,
-                            _("Don't use SSL"),
+                            _("Don't use SSL (or STARTTLS only if necessary)"),
                             SSL_NONE,
                             smtp_ssltunnel_radiobtn,
                             _("Use SSL for SMTP connection"),