aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-04 02:16:59 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-04 02:16:59 +0800
commit733175aaec70f4466915e1b028de572338911259 (patch)
tree56d075c3e770962f923acaf278d793218a49c591 /camel
parent7d143c9c442f2c30f4a47c173cb48829ebe847b8 (diff)
downloadgsoc2013-evolution-733175aaec70f4466915e1b028de572338911259.tar.gz
gsoc2013-evolution-733175aaec70f4466915e1b028de572338911259.tar.zst
gsoc2013-evolution-733175aaec70f4466915e1b028de572338911259.zip
First check to make sure that service->url->authmech is non-NULL before
2001-08-03 Jeffrey Stedfast <fejj@ximian.com> * providers/smtp/camel-smtp-transport.c (smtp_connect): First check to make sure that service->url->authmech is non-NULL before passing it into strcmp to avoid a segfault. svn path=/trunk/; revision=11618
Diffstat (limited to 'camel')
-rw-r--r--camel/ChangeLog4
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c28
2 files changed, 18 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 8865adad20..e969917624 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,5 +1,9 @@
2001-08-03 Jeffrey Stedfast <fejj@ximian.com>
+ * providers/smtp/camel-smtp-transport.c (smtp_connect): First
+ check to make sure that service->url->authmech is non-NULL before
+ passing it into strcmp to avoid a segfault.
+
* camel-pgp-context.c (pgp_decrypt): Sigh, if gpg returns '1' it
means that the key is bad but it did succeede in decrypting the
block so to make users happy (even though I find this a
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 86674fdc2a..92d0abc9b0 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -342,36 +342,36 @@ static gboolean
smtp_connect (CamelService *service, CamelException *ex)
{
CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
-
+
/* We (probably) need to check popb4smtp before we connect ... */
- if (strcmp(service->url->authmech, "POPB4SMTP") == 0) {
+ if (service->url->authmech && !strcmp (service->url->authmech, "POPB4SMTP")) {
int truth;
GByteArray *chal;
CamelSasl *sasl;
-
- sasl = camel_sasl_new("smtp", "POPB4SMTP", service);
- chal = camel_sasl_challenge(sasl, NULL, ex);
- truth = camel_sasl_authenticated(sasl);
+
+ sasl = camel_sasl_new ("smtp", "POPB4SMTP", service);
+ chal = camel_sasl_challenge (sasl, NULL, ex);
+ truth = camel_sasl_authenticated (sasl);
if (chal)
- g_byte_array_free(chal, TRUE);
- camel_object_unref((CamelObject *)sasl);
-
+ g_byte_array_free (chal, TRUE);
+ camel_object_unref (CAMEL_OBJECT (sasl));
+
if (!truth)
return FALSE;
-
- return connect_to_server(service, ex);
+
+ return connect_to_server (service, ex);
}
-
+
if (!connect_to_server (service, ex))
return FALSE;
-
+
/* check to see if AUTH is required, if so...then AUTH ourselves */
if (service->url->authmech) {
CamelSession *session = camel_service_get_session (service);
CamelServiceAuthType *authtype;
gboolean authenticated = FALSE;
char *errbuf = NULL;
-
+
if (!transport->is_esmtp || !g_hash_table_lookup (transport->authtypes, service->url->authmech)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
_("SMTP server %s does not support requested "