sync with 0.8.11cvs16
authorPaul Mangan <paul@claws-mail.org>
Fri, 28 Mar 2003 11:45:50 +0000 (11:45 +0000)
committerPaul Mangan <paul@claws-mail.org>
Fri, 28 Mar 2003 11:45:50 +0000 (11:45 +0000)
ChangeLog
ChangeLog.claws
ChangeLog.jp
configure.ac
src/common/smtp.c
src/common/smtp.h
src/send_message.c

index ee7c4f1..1ae9d7b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2003-03-28
+
+       * send_message.c: send_message_smtp():
+         re-enabled forcing of SMTP AUTH method.
+         Clear temporary password if authentication failed.
+       * smtp.c: output warning to log and set SMTPSession::error_val
+         if error occurs.
+       * smtp.h: changed error value to enum. Added SMTPSession::error_val.
+       * src/mbox.c: proc_mbox(): force updating of folder.
+
 2003-03-28
 
        * src/pop.h: changed error value to enum.
index 6da45f5..ce330e5 100644 (file)
@@ -1,3 +1,8 @@
+2003-03-28 [paul]      0.8.11claws62
+
+       * sync with 0.8.11cvs16
+               see ChangeLog 2003-03-28
+
 2003-03-28 [paul]      0.8.11claws61
 
        * sync with 0.8.11cvs15
index 9d58609..8fdfde6 100644 (file)
@@ -1,3 +1,13 @@
+2003-03-28
+
+       * send_message.c: send_message_smtp():
+         SMTP AUTH ¤Îǧ¾ÚÊýË¡¤Î¶¯À©¤òºÆ¤ÓÍ­¸ú¤Ë¤·¤¿¡£
+         Ç§¾Ú¤Ë¼ºÇÔ¤·¤¿¤é°ì»þ¥Ñ¥¹¥ï¡¼¥É¤ò¥¯¥ê¥¢¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * smtp.c: ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¾ì¹ç¤Ï·Ù¹ð¤ò¥í¥°¤Ë½ÐÎϤ·¡¢
+         SMTPSession::error_val ¤ò¥»¥Ã¥È¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+       * smtp.h: ¥¨¥é¡¼Ãͤò enum ¤ËÊѹ¹¡£ SMTPSession::error_val ¤òÄɲá£
+       * src/mbox.c: proc_mbox(): ¥Õ¥©¥ë¥À¤Î¹¹¿·¤ò¶¯À©¤¹¤ë¤è¤¦¤Ë¤·¤¿¡£
+
 2003-03-28
 
        * src/pop.h: ¥¨¥é¡¼Ãͤò enum ¤ËÊѹ¹¡£
index d8ae863..fccce04 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=11
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws61
+EXTRA_VERSION=claws62
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index b229980..8598403 100644 (file)
@@ -96,6 +96,8 @@ Session *smtp_session_new(void)
        session->forced_auth_type          = 0;
        session->auth_type                 = 0;
 
+       session->error_val                 = SM_OK;
+
        return SESSION(session);
 }
 
@@ -408,14 +410,30 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg)
        SMTPSession *smtp_session = SMTP_SESSION(session);
        gboolean cont = FALSE;
 
-       if (strlen(msg) < 4)
+       if (strlen(msg) < 4) {
+               log_warning(_("bad SMTP response\n"));
                return -1;
+       }
 
-       log_print("SMTP< %s\n", msg);
+       switch (smtp_session->state) {
+       case SMTP_EHLO:
+       case SMTP_STARTTLS:
+       case SMTP_AUTH:
+       case SMTP_AUTH_LOGIN_USER:
+       case SMTP_AUTH_LOGIN_PASS:
+       case SMTP_AUTH_CRAM_MD5:
+               log_print("ESMTP< %s\n", msg);
+               break;
+       default:
+               log_print("SMTP< %s\n", msg);
+               break;
+       }
 
        if (msg[0] == '5' && msg[1] == '0' &&
            (msg[2] == '4' || msg[2] == '3' || msg[2] == '1')) {
+               log_warning(_("error occurred on SMTP session\n"));
                smtp_session->state = SMTP_ERROR;
+               smtp_session->error_val = SM_ERROR;
                return -1;
        }
 
@@ -425,14 +443,18 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg)
        }
 
        if (msg[0] != '1' && msg[0] != '2' && msg[0] != '3') {
+               log_warning(_("error occurred on SMTP session\n"));
                smtp_session->state = SMTP_ERROR;
+               smtp_session->error_val = SM_ERROR;
                return -1;
        }
 
        if (msg[3] == '-')
                cont = TRUE;
        else if (msg[3] != ' ' && msg[3] != '\0') {
+               log_warning(_("bad SMTP response\n"));
                smtp_session->state = SMTP_ERROR;
+               smtp_session->error_val = SM_UNRECOVERABLE;
                return -1;
        }
 
@@ -474,8 +496,12 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg)
                break;
        case SMTP_STARTTLS:
 #if USE_OPENSSL
-               if (session_start_tls(session) < 0)
+               if (session_start_tls(session) < 0) {
+                       log_warning(_("can't start TLS session\n"));
+                       smtp_session->state = SMTP_ERROR;
+                       smtp_session->error_val = SM_ERROR;
                        return -1;
+               }
                smtp_session->tls_init_done = TRUE;
                smtp_ehlo(smtp_session);
 #endif
@@ -512,6 +538,8 @@ static gint smtp_session_recv_msg(Session *session, const gchar *msg)
        case SMTP_ERROR:
        case SMTP_AUTH_FAILED:
        default:
+               log_warning(_("error occurred on SMTP session\n"));
+               smtp_session->error_val = SM_ERROR;
                return -1;
        }
 
index dfc4c89..017917d 100644 (file)
@@ -34,14 +34,20 @@ typedef struct _SMTPSession SMTPSession;
 
 #define MSGBUFSIZE             8192
 
-#define        SM_OK                   0
-#define        SM_ERROR                128
-#define        SM_UNRECOVERABLE        129
-#define SM_AUTHFAIL            130
+typedef enum
+{
+       SM_OK                   = 0,
+       SM_ERROR                = 128,
+       SM_UNRECOVERABLE        = 129,
+       SM_AUTHFAIL             = 130
+} SMTPErrorValue;
 
-#define        ESMTP_8BITMIME          0x01
-#define        ESMTP_SIZE              0x02
-#define        ESMTP_ETRN              0x04
+typedef enum
+{
+       ESMTP_8BITMIME  = 1 << 0,
+       ESMTP_SIZE      = 1 << 1,
+       ESMTP_ETRN      = 1 << 2
+} ESMTPFlag;
 
 typedef enum
 {
@@ -101,6 +107,8 @@ struct _SMTPSession
        SMTPAuthType avail_auth_type;
        SMTPAuthType forced_auth_type;
        SMTPAuthType auth_type;
+
+       SMTPErrorValue error_val;
 };
 
 Session *smtp_session_new      (void);
index 4503eee..fa72c59 100644 (file)
@@ -305,6 +305,8 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp)
                ac_prefs->set_domain ? g_strdup(ac_prefs->domain) : NULL;
 
        if (ac_prefs->use_smtp_auth) {
+               smtp_session->forced_auth_type = ac_prefs->smtp_auth_type;
+
                if (ac_prefs->smtp_userid) {
                        smtp_session->user = g_strdup(ac_prefs->smtp_userid);
                        if (ac_prefs->smtp_passwd)
@@ -402,12 +404,15 @@ gint send_message_smtp(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp)
               session->state != SESSION_ERROR)
                gtk_main_iteration();
 
-       if (SMTP_SESSION(session)->state == SMTP_AUTH_FAILED) {
-               g_free(ac_prefs->tmp_smtp_pass);
-               ac_prefs->tmp_smtp_pass = NULL;
+       if (SMTP_SESSION(session)->error_val == SM_AUTHFAIL) {
+               if (ac_prefs->smtp_userid && ac_prefs->tmp_smtp_pass) {
+                       g_free(ac_prefs->tmp_smtp_pass);
+                       ac_prefs->tmp_smtp_pass = NULL;
+               }
                ret = -1;
-       } else if ((session->state == SESSION_ERROR) ||
-                  (SMTP_SESSION(session)->state == SMTP_ERROR))
+       } else if (session->state == SESSION_ERROR ||
+                  SMTP_SESSION(session)->state == SMTP_ERROR ||
+                  SMTP_SESSION(session)->error_val != SM_OK)
                ret = -1;
        else if (dialog->cancelled == TRUE)
                ret = -1;