diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 6 | ||||
-rw-r--r-- | camel/providers/imap/camel-imap-auth.c | 22 |
2 files changed, 19 insertions, 9 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index e489b8938d..7fc82ec4ef 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,9 @@ +2000-11-09 Dan Winship <danw@helixcode.com> + + * providers/imap/camel-imap-auth.c (imap_try_kerberos_v4_auth): + Fix error handling. (Only send a "*" to bail out of authentication + if the server hasn't already bailed on us.) + 2000-11-08 Radek Doulik <rodo@helixcode.com> * camel-mime-utils.c (mime_guess_type_from_file_name): new diff --git a/camel/providers/imap/camel-imap-auth.c b/camel/providers/imap/camel-imap-auth.c index 3bf1af6535..cc77843d9c 100644 --- a/camel/providers/imap/camel-imap-auth.c +++ b/camel/providers/imap/camel-imap-auth.c @@ -97,7 +97,7 @@ imap_try_kerberos_v4_auth (CamelImapStore *store, CamelException *ex) */ if (strlen (data) != 8 || base64_decode_simple (data, 8) != 4) { g_free (resp); - goto lose; + goto break_and_lose; } memcpy (&nonce_n, data, 4); g_free (resp); @@ -106,7 +106,7 @@ imap_try_kerberos_v4_auth (CamelImapStore *store, CamelException *ex) /* Our response is an authenticator including that number. */ h = camel_service_gethost (CAMEL_SERVICE (store), ex); if (!h) - goto lose; + goto break_and_lose; inst = g_strndup (h->h_name, strcspn (h->h_name, ".")); g_strdown (inst); realm = g_strdup (krb_realmofhost (h->h_name)); @@ -123,7 +123,7 @@ imap_try_kerberos_v4_auth (CamelImapStore *store, CamelException *ex) camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, _("Could not get Kerberos ticket:\n%s"), krb_err_txt[status]); - goto lose; + goto break_and_lose; } des_key_sched (&session, schedule); @@ -156,7 +156,7 @@ imap_try_kerberos_v4_auth (CamelImapStore *store, CamelException *ex) if (!(data[4] & IMAP_KERBEROS_V4_PROTECTION_NONE)) { g_warning ("Server does not support `no protection' :-("); g_free (resp); - goto lose; + goto break_and_lose; } g_free (resp); @@ -181,15 +181,19 @@ imap_try_kerberos_v4_auth (CamelImapStore *store, CamelException *ex) camel_imap_response_free (response); return TRUE; - lose: - memset (&session, 0, sizeof (session)); - - /* Get the server out of "waiting for continuation data" mode. - */ + break_and_lose: + /* Get the server out of "waiting for continuation data" mode. */ response = camel_imap_command_continuation (store, NULL, "*"); if (response) camel_imap_response_free (response); + lose: + memset (&session, 0, sizeof (session)); + + if (!camel_exception_is_set (ex)) { + camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE, + _("Bad authentication response from server.")); + } return FALSE; } #endif /* HAVE_KRB4 */ |