[evolution-data-server] Bug #634385 - Crash in smtp_connect
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug #634385 - Crash in smtp_connect
- Date: Wed, 15 Dec 2010 14:52:43 +0000 (UTC)
commit cc745b5e13c22d48ac6d6f209b5d54fa5098bede
Author: Milan Crha <mcrha redhat com>
Date: Wed Dec 15 15:51:54 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 74de8b9..ab1407e 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -292,7 +292,7 @@ read_from_prfd (PRFileDesc *fd,
PRSocketOptionData sockopts;
PRPollDesc pollfds[2];
gboolean nonblock;
- gint error;
+ gint saved_errno;
/* get O_NONBLOCK options */
sockopts.option = PR_SockOpt_Nonblocking;
@@ -340,11 +340,11 @@ read_from_prfd (PRFileDesc *fd,
/* 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)
@@ -403,7 +403,7 @@ write_to_prfd (PRFileDesc *fd,
PRSocketOptionData sockopts;
PRPollDesc pollfds[2];
gboolean nonblock;
- gint error;
+ gint saved_errno;
/* get O_NONBLOCK options */
sockopts.option = PR_SockOpt_Nonblocking;
@@ -455,15 +455,17 @@ write_to_prfd (PRFileDesc *fd,
} 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 f437d4c..14d6743 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -481,13 +481,20 @@ smtp_connect_sync (CamelService *service,
cancellable, &local_error);
if (!authenticated) {
if (g_cancellable_is_cancelled (cancellable) ||
- 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]