diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2001-08-04 02:16:59 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2001-08-04 02:16:59 +0800 |
commit | 733175aaec70f4466915e1b028de572338911259 (patch) | |
tree | 56d075c3e770962f923acaf278d793218a49c591 /camel/providers/smtp | |
parent | 7d143c9c442f2c30f4a47c173cb48829ebe847b8 (diff) | |
download | gsoc2013-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/providers/smtp')
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 28 |
1 files changed, 14 insertions, 14 deletions
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 " |