try to authenticate with CRAM-MD5
authorPaul Mangan <paul@claws-mail.org>
Sun, 7 Apr 2002 12:05:52 +0000 (12:05 +0000)
committerPaul Mangan <paul@claws-mail.org>
Sun, 7 Apr 2002 12:05:52 +0000 (12:05 +0000)
ChangeLog.claws
configure.in
src/esmtp.c
src/esmtp.h
src/smtp.c

index 6662e6c38db74b48d8cc74263c3da154e91ab61a..4399ea6fa4d299d8bf416e1f7106f5efe1712f6c 100644 (file)
@@ -1,3 +1,13 @@
+2002-04-07 [paul]      0.7.4claws71
+
+       * src/esmtp.[ch]
+         src/smtp.c
+               try to authenticate with CRAM-MD5 in SMTP when 
+               SMTP-AUTH enabled even if MTA doesn't issue this 
+               auth-method in it's ehlo-response. bug item #531364,
+               patch item #938910. patch submitted by Colin Leroy 
+               <colin@colino.net>
+
 2002-04-07 [paul]      0.7.4claws70
 
        * src/nntp.c
index bc7f41cf90b2f54894a5c4c5ca520cd27f6489ee..4d366e1c3b7f869c4a0b938f77a9b2224b5b8dbd 100644 (file)
@@ -8,7 +8,7 @@ MINOR_VERSION=7
 MICRO_VERSION=4
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws70
+EXTRA_VERSION=claws71
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 80eec301fc7f297d4af27028a4f01952c464b861..2304279c669a59f0b89d59be9f143ffafb12709a 100644 (file)
@@ -35,6 +35,7 @@ static gchar esmtp_response[MSGBUFSIZE];
 
 gint esmtp_ehlo(SockInfo *sock, const gchar *hostname)
 {
+       smtp_auth_methods[0] = smtp_auth_methods[1] = smtp_auth_methods[2] = smtp_auth_methods[3] = FALSE;
        sock_printf(sock, "EHLO %s\r\n", hostname);
        if (verbose)
                log_print("ESMTP> EHLO %s\n", hostname);
@@ -157,6 +158,12 @@ gint esmtp_ok(SockInfo *sock)
                if (verbose)
                        log_print("ESMTP< %s\n", esmtp_response);
 
+               if (strncasecmp("250-AUTH", esmtp_response, 8) == 0) {
+                       smtp_auth_methods[SMTPAUTH_LOGIN]      = (strstr(esmtp_response, " LOGIN") != NULL); 
+                       smtp_auth_methods[SMTPAUTH_CRAM_MD5]   = (strstr(esmtp_response, " CRAM-MD5") != NULL);
+                       smtp_auth_methods[SMTPAUTH_DIGEST_MD5] = FALSE; /* not implemented yet */
+               }
+
                if ((esmtp_response[0] == '1' || esmtp_response[0] == '2' ||
                     esmtp_response[0] == '3') && esmtp_response[3] == ' ')
                        return SM_OK;
index cb9073973064bd8ac4e229f6df9f2311231dade7..8f2270607b0ecad0dbfc912d8dad890d99146b94 100644 (file)
@@ -45,5 +45,6 @@ gint esmtp_auth_cram_md5(SockInfo *sock);
 gint esmtp_auth(SockInfo *sock, SMTPAuthType authtype,
                const gchar *userid, const gchar *passwd);
 gint esmtp_ok(SockInfo *sock);
+gboolean smtp_auth_methods[4];
 
 #endif /* __ESMTP_H__ */
index cbcc8f780ae617e35e48fcfd9cbf9284c9c2d722..fdf52218eb091683471551b589f600bdb1c708a9 100644 (file)
@@ -53,9 +53,11 @@ gint smtp_from(SockInfo *sock, const gchar *from,
 
        if (use_smtp_auth) {
                /* exist AUTH-Type CRAM_MD5 */
-               if (esmtp_auth_cram_md5(sock) == SM_ERROR) {
+               if (!smtp_auth_methods[SMTPAUTH_CRAM_MD5]
+                   || esmtp_auth_cram_md5(sock) == SM_ERROR) {
                        /* exist AUTH-Type LOGIN */
-                       if (esmtp_auth_login(sock) == SM_ERROR)
+                       if (!smtp_auth_methods[SMTPAUTH_LOGIN]
+                           || esmtp_auth_login(sock) == SM_ERROR)
                                return SM_ERROR;
                        else
                                authtype = SMTPAUTH_LOGIN;