[evolution-data-server/gnome-2-32] Bug #634385 - Crash in smtp_connect
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/gnome-2-32] Bug #634385 - Crash in smtp_connect
- Date: Wed, 15 Dec 2010 14:57:20 +0000 (UTC)
commit b08a6a13d4cb48e9de8ffbc7f9d74ef8c7a9a8a4
Author: Milan Crha <mcrha redhat com>
Date: Wed Dec 15 15:56:43 2010 +0100
Bug #634385 - Crash in smtp_connect
camel/camel-tcp-stream-raw.c | 16 +++++++++-------
camel/providers/smtp/camel-smtp-transport.c | 11 +++++++++--
2 files changed, 18 insertions(+), 9 deletions(-)
---
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index 5695f62..11869c0 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -285,7 +285,7 @@ read_from_prfd (PRFileDesc *fd, gchar *buffer, gsize n, GError **error)
PRSocketOptionData sockopts;
PRPollDesc pollfds[2];
gboolean nonblock;
- gint error;
+ gint saved_errno;
/* get O_NONBLOCK options */
sockopts.option = PR_SockOpt_Nonblocking;
@@ -333,11 +333,11 @@ read_from_prfd (PRFileDesc *fd, gchar *buffer, gsize n, GError **error)
/* restore O_NONBLOCK options */
failed:
- error = errno;
+ saved_errno = errno;
sockopts.option = PR_SockOpt_Nonblocking;
sockopts.value.non_blocking = nonblock;
PR_SetSocketOption (fd, &sockopts);
- errno = error;
+ errno = saved_errno;
}
if (nread == -1)
@@ -388,7 +388,7 @@ write_to_prfd (PRFileDesc *fd, const gchar *buffer, gsize n, GError **error)
PRSocketOptionData sockopts;
PRPollDesc pollfds[2];
gboolean nonblock;
- gint error;
+ gint saved_errno;
/* get O_NONBLOCK options */
sockopts.option = PR_SockOpt_Nonblocking;
@@ -440,15 +440,17 @@ write_to_prfd (PRFileDesc *fd, const gchar *buffer, gsize n, GError **error)
} while (w != -1 && written < n);
/* restore O_NONBLOCK options */
- error = errno;
+ saved_errno = errno;
sockopts.option = PR_SockOpt_Nonblocking;
sockopts.value.non_blocking = nonblock;
PR_SetSocketOption (fd, &sockopts);
- errno = error;
+ errno = saved_errno;
}
- if (w == -1)
+ if (w == -1) {
_set_g_error_from_errno (error, TRUE);
+ written = -1;
+ }
return written;
}
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 4d855c6..9f927ee 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -519,13 +519,20 @@ smtp_connect (CamelService *service, GError **error)
transport, authtype->authproto, &local_error);
if (!authenticated) {
if (g_error_matches (local_error, G_IO_ERROR, G_IO_ERROR_CANCELLED) ||
- g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE))
+ g_error_matches (local_error, CAMEL_SERVICE_ERROR, CAMEL_SERVICE_ERROR_UNAVAILABLE)) {
+ g_free (service->url->passwd);
+ service->url->passwd = NULL;
+
+ if (local_error)
+ g_clear_error (&local_error);
+
return FALSE;
+ }
errbuf = g_markup_printf_escaped (
_("Unable to authenticate "
"to SMTP server.\n%s\n\n"),
- local_error->message);
+ local_error ? local_error->message : _("Unknown error"));
g_clear_error (&local_error);
g_free (service->url->passwd);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]