sync with 0.8.11cvs16

This commit is contained in:
Paul Mangan 2003-03-28 11:45:50 +00:00
parent 40e1a89611
commit ac3b4a9780
7 changed files with 82 additions and 16 deletions

View file

@ -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.

View 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

View 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 に変更。

View 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

View 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;
}

View 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);

View 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;