* src/imap.c
Fix another possible crash (on fatal errors
at login, like stream error).
+2008-05-16 [colin] 3.4.0cvs47
+
+ * src/imap.c
+ Fix another possible crash (on fatal errors
+ at login, like stream error).
+
2008-05-16 [paul] 3.4.0cvs46
* tools/thunderbird-filters-convertor.pl
2008-05-16 [paul] 3.4.0cvs46
* tools/thunderbird-filters-convertor.pl
( cvs diff -u -r 1.654.2.3400 -r 1.654.2.3401 configure.ac; cvs diff -u -r 1.1.2.19 -r 1.1.2.20 src/ldapupdate.c; ) > 3.4.0cvs44.patchset
( cvs diff -u -r 1.30.2.28 -r 1.30.2.29 tools/README; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 tools/csv2addressbook.pl; ) > 3.4.0cvs45.patchset
( cvs diff -u -r 1.1.2.2 -r 1.1.2.3 tools/thunderbird-filters-convertor.pl; ) > 3.4.0cvs46.patchset
( cvs diff -u -r 1.654.2.3400 -r 1.654.2.3401 configure.ac; cvs diff -u -r 1.1.2.19 -r 1.1.2.20 src/ldapupdate.c; ) > 3.4.0cvs44.patchset
( cvs diff -u -r 1.30.2.28 -r 1.30.2.29 tools/README; cvs diff -u -r 1.1.2.2 -r 1.1.2.3 tools/csv2addressbook.pl; ) > 3.4.0cvs45.patchset
( cvs diff -u -r 1.1.2.2 -r 1.1.2.3 tools/thunderbird-filters-convertor.pl; ) > 3.4.0cvs46.patchset
+( cvs diff -u -r 1.179.2.219 -r 1.179.2.220 src/imap.c; ) > 3.4.0cvs47.patchset
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
MICRO_VERSION=0
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
EXTRA_RELEASE=
EXTRA_GTK2_VERSION=
static IMAPSession *imap_session_new (Folder *folder,
const PrefsAccount *account);
static IMAPSession *imap_session_new (Folder *folder,
const PrefsAccount *account);
-static void imap_session_authenticate(IMAPSession *session,
+static gint imap_session_authenticate(IMAPSession *session,
const PrefsAccount *account);
static void imap_session_destroy (Session *session);
const PrefsAccount *account);
static void imap_session_destroy (Session *session);
/* Make sure session is authenticated */
if (!IMAP_SESSION(session)->authenticated)
/* Make sure session is authenticated */
if (!IMAP_SESSION(session)->authenticated)
- imap_session_authenticate(IMAP_SESSION(session), folder->account);
+ r = imap_session_authenticate(IMAP_SESSION(session), folder->account);
- if (!IMAP_SESSION(session)->authenticated) {
- imap_threaded_disconnect(session->folder);
+ if (r != MAILIMAP_NO_ERROR || (!is_fatal(r) && !IMAP_SESSION(session)->authenticated)) {
- SESSION(session)->state = SESSION_DISCONNECTED;
- SESSION(session)->sock = NULL;
- session_destroy(SESSION(session));
+ if (!is_fatal(r)) {
+ imap_threaded_disconnect(session->folder);
+ SESSION(session)->state = SESSION_DISCONNECTED;
+ SESSION(session)->sock = NULL;
+ session_destroy(SESSION(session));
+ }
rfolder->last_failure = time(NULL);
rfolder->connecting = FALSE;
return NULL;
rfolder->last_failure = time(NULL);
rfolder->connecting = FALSE;
return NULL;
-static void imap_session_authenticate(IMAPSession *session,
+static gint imap_session_authenticate(IMAPSession *session,
const PrefsAccount *account)
{
gchar *pass, *acc_pass;
gboolean failed = FALSE;
const PrefsAccount *account)
{
gchar *pass, *acc_pass;
gboolean failed = FALSE;
+ gint ok = MAILIMAP_NO_ERROR;
g_return_if_fail(account->userid != NULL);
acc_pass = account->passwd;
try_again:
g_return_if_fail(account->userid != NULL);
acc_pass = account->passwd;
try_again:
gchar *tmp_pass;
tmp_pass = input_dialog_query_password(account->recv_server, account->userid);
if (!tmp_pass)
gchar *tmp_pass;
tmp_pass = input_dialog_query_password(account->recv_server, account->userid);
if (!tmp_pass)
- return;
- Xstrdup_a(pass, tmp_pass, {g_free(tmp_pass); return;});
+ return MAILIMAP_NO_ERROR;
+ Xstrdup_a(pass, tmp_pass, {g_free(tmp_pass); return MAILIMAP_NO_ERROR;});
g_free(tmp_pass);
} else if (account->imap_auth_type == IMAP_AUTH_ANON) {
pass = "";
}
statuswindow_print_all(_("Connecting to IMAP4 server %s...\n"),
account->recv_server);
g_free(tmp_pass);
} else if (account->imap_auth_type == IMAP_AUTH_ANON) {
pass = "";
}
statuswindow_print_all(_("Connecting to IMAP4 server %s...\n"),
account->recv_server);
- if (imap_auth(session, account->userid, pass, account->imap_auth_type) != MAILIMAP_NO_ERROR) {
+ if ((ok = imap_auth(session, account->userid, pass, account->imap_auth_type)) != MAILIMAP_NO_ERROR) {
+ if (!failed && !is_fatal(ok)) {
acc_pass = NULL;
failed = TRUE;
goto try_again;
acc_pass = NULL;
failed = TRUE;
goto try_again;
alertpanel_error_log(_("Couldn't login to IMAP server %s."), account->recv_server);
}
alertpanel_error_log(_("Couldn't login to IMAP server %s."), account->recv_server);
}
}
statuswindow_pop_all();
session->authenticated = TRUE;
}
statuswindow_pop_all();
session->authenticated = TRUE;
+ return MAILIMAP_NO_ERROR;
}
static void imap_session_destroy(Session *session)
}
static void imap_session_destroy(Session *session)