- apply and adapt Bram's patch which allows user to set SMTP AUTH
authorAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 22 Jun 2002 20:54:45 +0000 (20:54 +0000)
committerAlfons Hoogervorst <alfons@proteus.demon.nl>
Sat, 22 Jun 2002 20:54:45 +0000 (20:54 +0000)
  options.  (see <http://sourceforge.net/tracker/index.php
  ?func=detail&aid=566937&group_id=25528&atid=384600>);

- merge Stanislav's fix to make SMTP AUTH work with qmail
  (see <http://www.tmtm.org/cgi-bin/w3ml/msg.cgi?ml=sylpheed&id=14343>)

AUTHORS
ChangeLog.claws
configure.in
src/prefs_account.c
src/prefs_account.h
src/send.c
src/smtp.c
src/smtp.h

diff --git a/AUTHORS b/AUTHORS
index 4aeb461..6a61bc3 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -148,3 +148,5 @@ contributors (beside the above; based on Changelog)
        Thorsten Thielen
        Eugene Brevdo
        Mitko Haralanov 
+       Bram Metsch
+       Stanislav Karchebny
index 473ccc0..ce8f9da 100644 (file)
@@ -1,3 +1,17 @@
+2002-06-22 [alfons]    0.7.8claws15
+
+       * AUTHORS
+               add Bram Metsch & Stanislav Karchebny
+       * src/smtp.[ch]
+       * src/prefs_account.[ch]
+       * src/send.c
+               - apply and adapt Bram's patch which allows user to set SMTP AUTH 
+                 options.  (see <http://sourceforge.net/tracker/index.php
+                 ?func=detail&aid=566937&group_id=25528&atid=384600>);
+
+               - merge Stanislav's fix to make SMTP AUTH work with qmail
+                 (see <http://www.tmtm.org/cgi-bin/w3ml/msg.cgi?ml=sylpheed&id=14343>)
+
 2002-06-22 [paul]      0.7.8claws14
 
        * sync with 0.7.8cvs5
index 303d50e..29f3ba9 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=8
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws14
+EXTRA_VERSION=claws15
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 0907b9c..1312385 100644 (file)
@@ -109,6 +109,9 @@ static struct Send {
        GtkWidget *smtp_auth_chkbtn;
        GtkWidget *smtp_uid_entry;
        GtkWidget *smtp_pass_entry;
+       GtkWidget *smtp_auth_enable_login_chkbtn;       /* CLAWS: smtp auth options */
+       GtkWidget *smtp_auth_enable_cram_md5_chkbtn;
+       GtkWidget *smtp_auth_enable_digest_md5_chkbtn;
        GtkWidget *pop_bfr_smtp_chkbtn;
 } send;
 
@@ -320,6 +323,15 @@ static PrefParam param[] = {
         &send.smtp_uid_entry, prefs_set_data_from_entry, prefs_set_entry},
        {"smtp_password", NULL, &tmp_ac_prefs.smtp_passwd, P_STRING,
         &send.smtp_pass_entry, prefs_set_data_from_entry, prefs_set_entry},
+       {"smtp_auth_enable_digest_md5", "TRUE", &tmp_ac_prefs.smtp_auth_enable_digest_md5, P_BOOL,
+        &send.smtp_auth_enable_digest_md5_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"smtp_auth_enable_cram_md5", "TRUE", &tmp_ac_prefs.smtp_auth_enable_cram_md5, P_BOOL,
+        &send.smtp_auth_enable_cram_md5_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
+       {"smtp_auth_enable_login", "TRUE", &tmp_ac_prefs.smtp_auth_enable_login, P_BOOL,
+        &send.smtp_auth_enable_login_chkbtn,
+        prefs_set_data_from_toggle, prefs_set_toggle},
 
        {"pop_before_smtp", "FALSE", &tmp_ac_prefs.pop_before_smtp, P_BOOL,
         &send.pop_bfr_smtp_chkbtn,
@@ -1214,6 +1226,9 @@ static void prefs_account_send_create(void)
        GtkWidget *smtp_pass_entry;
        GtkWidget *vbox_spc;
        GtkWidget *pop_bfr_smtp_chkbtn;
+       GtkWidget *smtp_auth_enable_login_chkbtn;       /* CLAWS: SMTP AUTH */
+       GtkWidget *smtp_auth_enable_cram_md5_chkbtn;
+       GtkWidget *smtp_auth_enable_digest_md5_chkbtn;
 
        vbox1 = gtk_vbox_new (FALSE, VSPACING);
        gtk_widget_show (vbox1);
@@ -1309,6 +1324,15 @@ static void prefs_account_send_create(void)
 
        SET_TOGGLE_SENSITIVITY (smtp_auth_chkbtn, vbox4);
 
+       PACK_CHECK_BUTTON (vbox4, smtp_auth_enable_login_chkbtn,
+               _("LOGIN Authentication"));
+
+       PACK_CHECK_BUTTON (vbox4, smtp_auth_enable_cram_md5_chkbtn,
+               _("CRAM-MD5 Authentication"));
+
+       PACK_CHECK_BUTTON (vbox4, smtp_auth_enable_digest_md5_chkbtn,
+               _("DIGEST-MD5 Authentication"));        
+
        PACK_CHECK_BUTTON (vbox3, pop_bfr_smtp_chkbtn,
                _("Authenticate with POP3 before sending"));
        gtk_widget_set_sensitive(pop_bfr_smtp_chkbtn, FALSE);
@@ -1321,6 +1345,11 @@ static void prefs_account_send_create(void)
        send.smtp_uid_entry      = smtp_uid_entry;
        send.smtp_pass_entry     = smtp_pass_entry;
        send.pop_bfr_smtp_chkbtn = pop_bfr_smtp_chkbtn;
+       
+       /* CLAWS: SMTP AUTH */
+       send.smtp_auth_enable_login_chkbtn      = smtp_auth_enable_login_chkbtn;
+       send.smtp_auth_enable_cram_md5_chkbtn   = smtp_auth_enable_cram_md5_chkbtn;
+       send.smtp_auth_enable_digest_md5_chkbtn = smtp_auth_enable_digest_md5_chkbtn;
 }
 
 static void prefs_account_compose_create(void)
index 8e76480..1f6f0f9 100644 (file)
@@ -121,6 +121,11 @@ struct _PrefsAccount
        gchar *smtp_userid;
        gchar *smtp_passwd;
 
+       /* CLAWS: SMTP AUTH */
+       gboolean smtp_auth_enable_login;
+       gboolean smtp_auth_enable_cram_md5;
+       gboolean smtp_auth_enable_digest_md5;
+
        /* Temporarily preserved password */
        gchar *tmp_smtp_pass;
 
index d654bd0..28308dc 100644 (file)
@@ -371,12 +371,20 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list,
 #if USE_SSL
        SEND_EXIT_IF_ERROR((session = smtp_session_new
                                (ac_prefs->smtp_server, port, domain,
-                                user, pass, ac_prefs->ssl_smtp)),
+                                user, pass, ac_prefs->ssl_smtp,
+                                0 
+                                | (ac_prefs->smtp_auth_enable_login ? SMTPAUTH_LOGIN : 0) 
+                                | (ac_prefs->smtp_auth_enable_cram_md5 ? SMTPAUTH_CRAM_MD5 : 0) 
+                                | (ac_prefs->smtp_auth_enable_digest_md5 ? SMTPAUTH_DIGEST_MD5 : 0))),
                           "connecting to server");
 #else
        SEND_EXIT_IF_ERROR((session = smtp_session_new
                                (ac_prefs->smtp_server, port, domain,
-                                user, pass)),
+                                user, pass,
+                                0
+                                | (ac_prefs->smtp_auth_enable_login ? SMTPAUTH_LOGIN : 0) 
+                                | (ac_prefs->smtp_auth_enable_cram_md5 ? SMTPAUTH_CRAM_MD5 : 0) 
+                                | (ac_prefs->smtp_auth_enable_digest_md5 ? SMTPAUTH_DIGEST_MD5 : 0))),
                           "connecting to server");
 #endif
 
index f398ac5..82067c8 100644 (file)
@@ -43,11 +43,13 @@ static gint smtp_ok(SockInfo *sock, gchar *buf, gint len);
 Session *smtp_session_new(const gchar *server, gushort port,
                          const gchar *domain,
                          const gchar *user, const gchar *pass,
-                         SSLType ssl_type)
+                         SSLType ssl_type,
+                         SMTPAuthType enable_auth_type)
 #else
 Session *smtp_session_new(const gchar *server, gushort port,
                          const gchar *domain,
-                         const gchar *user, const gchar *pass)
+                         const gchar *user, const gchar *pass,
+                         SMTPAuthType enable_auth_type)
 #endif
 {
        SMTPSession *session;
@@ -89,7 +91,7 @@ Session *smtp_session_new(const gchar *server, gushort port,
                domain = get_domain_name();
 
        if (use_esmtp)
-               val = smtp_ehlo(sock, domain, &avail_auth_type);
+               val = smtp_ehlo(sock, domain, &avail_auth_type, enable_auth_type);
        else
                val = smtp_helo(sock, domain);
        if (val != SM_OK) {
@@ -110,7 +112,7 @@ Session *smtp_session_new(const gchar *server, gushort port,
                        sock_close(sock);
                        return NULL;
                }
-               val = smtp_ehlo(sock, domain, &avail_auth_type);
+               val = smtp_ehlo(sock, domain, &avail_auth_type, enable_auth_type);
                if (val != SM_OK) {
                        log_warning(_("Error occurred while sending EHLO\n"));
                        sock_close(sock);
@@ -261,7 +263,8 @@ gint smtp_auth(SMTPSession *session)
 }
 
 gint smtp_ehlo(SockInfo *sock, const gchar *hostname,
-              SMTPAuthType *avail_auth_type)
+              SMTPAuthType *avail_auth_type,
+              SMTPAuthType  enable_auth_type)
 {
        gchar buf[MSGBUFSIZE];
 
@@ -282,13 +285,15 @@ gint smtp_ehlo(SockInfo *sock, const gchar *hostname,
                if (strncmp(buf, "250-", 4) == 0) {
                        gchar *p = buf;
                        p += 4;
-                       if (g_strncasecmp(p, "AUTH ", 5) == 0) {
+                       
+                       if (g_strncasecmp(p, "AUTH ", 5) == 0 ||
+                          (g_strncasecmp(p, "AUTH=", 5) == 0)) {       /* CLAWS: qmail */
                                p += 5;
-                               if (strcasestr(p, "LOGIN"))
+                               if (strcasestr(p, "LOGIN") && (enable_auth_type & SMTPAUTH_LOGIN))
                                        *avail_auth_type |= SMTPAUTH_LOGIN;
-                               if (strcasestr(p, "CRAM-MD5"))
+                               if (strcasestr(p, "CRAM-MD5") && (enable_auth_type & SMTPAUTH_CRAM_MD5))
                                        *avail_auth_type |= SMTPAUTH_CRAM_MD5;
-                               if (strcasestr(p, "DIGEST-MD5"))
+                               if (strcasestr(p, "DIGEST-MD5") && (enable_auth_type & SMTPAUTH_DIGEST_MD5))
                                        *avail_auth_type |= SMTPAUTH_DIGEST_MD5;
                        }
                } else if ((buf[0] == '1' || buf[0] == '2' || buf[0] == '3') &&
index 3fd848c..9f35e2b 100644 (file)
@@ -69,13 +69,15 @@ Session *smtp_session_new   (const gchar    *server,
                                 const gchar    *domain,
                                 const gchar    *user,
                                 const gchar    *pass,
-                                SSLType         ssl_type);
+                                SSLType         ssl_type,
+                                SMTPAuthType    enable_auth_type);
 #else
 Session *smtp_session_new      (const gchar    *server,
                                 gushort         port,
                                 const gchar    *domain,
                                 const gchar    *user,
-                                const gchar    *pass);
+                                const gchar    *pass,
+                                SMTPAuthType    enable_auth_type);
 #endif
 void smtp_session_destroy      (SMTPSession    *session);
 
@@ -85,7 +87,8 @@ gint smtp_auth                        (SMTPSession    *session);
 
 gint smtp_ehlo                 (SockInfo       *sock,
                                 const gchar    *hostname,
-                                SMTPAuthType   *avail_auth_type);
+                                SMTPAuthType   *avail_auth_type,
+                                SMTPAuthType    enable_auth_type);
 
 gint smtp_helo                 (SockInfo       *sock,
                                 const gchar    *hostname);