diff options
author | Dan Winship <danw@src.gnome.org> | 2001-04-03 04:57:39 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-04-03 04:57:39 +0800 |
commit | 014ed35be581511ae4c69cbdc38a3536aae39cf3 (patch) | |
tree | 51dc0f58554a59ba7bb23f2d37d7f592b3bfdaa4 /camel/providers | |
parent | 6b674781defaf52cf8a902357864b3ea793c2352 (diff) | |
download | gsoc2013-evolution-014ed35be581511ae4c69cbdc38a3536aae39cf3.tar gsoc2013-evolution-014ed35be581511ae4c69cbdc38a3536aae39cf3.tar.gz gsoc2013-evolution-014ed35be581511ae4c69cbdc38a3536aae39cf3.tar.bz2 gsoc2013-evolution-014ed35be581511ae4c69cbdc38a3536aae39cf3.tar.lz gsoc2013-evolution-014ed35be581511ae4c69cbdc38a3536aae39cf3.tar.xz gsoc2013-evolution-014ed35be581511ae4c69cbdc38a3536aae39cf3.tar.zst gsoc2013-evolution-014ed35be581511ae4c69cbdc38a3536aae39cf3.zip |
Remove the "quick_login" member, which is unnecessary.
* camel-service.h: Remove the "quick_login" member, which is
unnecessary.
* providers/smtp/camel-smtp-transport.c (smtp_auth): Remove the
references to quick_login and fix this to use the CamelSasl
interfaces correctly to do the same thing.
(connect_to_server): Split this out of smtp_connect
(smtp_connect): Use connect_to_server. When re-EHLO'ing after
auth, ignore errors.
(query_auth_types): Use connect_to_server rather than
smtp_connect, so it doesn't try to authenticate. Add LOGIN
authtype to the list of authtypes to check for.
* providers/smtp/camel-smtp-provider.c
(camel_provider_module_init): Add LOGIN authtype to the authtypes
list explicitly.
* camel-sasl.c (camel_sasl_authtype_list): Don't list LOGIN here:
it's not a real SASL authtype and is only used for SMTP.
* camel-sasl-plain.c:
* camel-sasl-login.c:
* camel-sasl-kerberos4.c:
* camel-sasl-cram-md5.c:
* camel-sasl-anonymous.c:
* providers/pop3/camel-pop3-provider.c: Remove "quick_login"
argument from authtypes.
svn path=/trunk/; revision=9100
Diffstat (limited to 'camel/providers')
-rw-r--r-- | camel/providers/pop3/camel-pop3-provider.c | 7 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-provider.c | 3 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 43 |
3 files changed, 28 insertions, 25 deletions
diff --git a/camel/providers/pop3/camel-pop3-provider.c b/camel/providers/pop3/camel-pop3-provider.c index 79cd088738..0931f903ed 100644 --- a/camel/providers/pop3/camel-pop3-provider.c +++ b/camel/providers/pop3/camel-pop3-provider.c @@ -70,8 +70,7 @@ CamelServiceAuthType camel_pop3_password_authtype = { "password. This is the only option supported by many POP servers."), "", - TRUE, - FALSE + TRUE }; CamelServiceAuthType camel_pop3_apop_authtype = { @@ -82,8 +81,7 @@ CamelServiceAuthType camel_pop3_apop_authtype = { "even on servers that claim to support it."), "+APOP", - TRUE, - FALSE + TRUE }; #ifdef HAVE_KRB4 @@ -94,7 +92,6 @@ CamelServiceAuthType camel_pop3_kpop_authtype = { "to authenticate to it."), "+KPOP", - FALSE, FALSE }; #endif diff --git a/camel/providers/smtp/camel-smtp-provider.c b/camel/providers/smtp/camel-smtp-provider.c index b84a6a0d83..3bb47b3429 100644 --- a/camel/providers/smtp/camel-smtp-provider.c +++ b/camel/providers/smtp/camel-smtp-provider.c @@ -54,7 +54,8 @@ camel_provider_module_init (CamelSession *session) { smtp_provider.object_types[CAMEL_PROVIDER_TRANSPORT] = camel_smtp_transport_get_type (); - smtp_provider.authtypes = camel_sasl_authtype_list (TRUE); + smtp_provider.authtypes = g_list_append (camel_sasl_authtype_list (TRUE), + camel_sasl_authtype ("LOGIN")); smtp_provider.service_cache = g_hash_table_new (camel_url_hash, camel_url_equal); camel_session_register_provider (session, &smtp_provider); diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 1c18c154b3..b2331598ae 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -220,7 +220,7 @@ get_smtp_error_string (int error) } static gboolean -smtp_connect (CamelService *service, CamelException *ex) +connect_to_server (CamelService *service, CamelException *ex) { CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service); CamelStream *tcp_stream; @@ -325,6 +325,17 @@ smtp_connect (CamelService *service, CamelException *ex) smtp_helo (transport, ex); } + return TRUE; +} + +static gboolean +smtp_connect (CamelService *service, CamelException *ex) +{ + CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service); + + 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); @@ -404,8 +415,11 @@ smtp_connect (CamelService *service, CamelException *ex) } } - /* we have to re-EHLO */ - smtp_helo (transport, ex); + /* The spec says we have to re-EHLO, but some servers + * we won't bother to name don't want you to... so ignore + * errors. + */ + smtp_helo (transport, NULL); } return TRUE; @@ -488,10 +502,10 @@ query_auth_types (CamelService *service, CamelException *ex) CamelServiceAuthType *authtype; GList *types, *t, *next; - if (!smtp_connect (service, ex)) + if (!connect_to_server (service, ex)) return NULL; - types = camel_sasl_authtype_list (TRUE); + types = g_list_copy (service->provider->authtypes); for (t = types; t; t = next) { authtype = t->data; next = t->next; @@ -502,6 +516,7 @@ query_auth_types (CamelService *service, CamelException *ex) } } + smtp_disconnect (service, TRUE, NULL); return types; } @@ -696,8 +711,7 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) static gboolean smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex) { - CamelServiceAuthType *authtype; - gchar *cmdbuf, *respbuf = NULL; + gchar *cmdbuf, *respbuf = NULL, *challenge; CamelSasl *sasl; sasl = camel_sasl_new ("smtp", mech, CAMEL_SERVICE (transport)); @@ -708,15 +722,8 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex) return FALSE; } - /* get the authtype object so we know if we can challenge the server */ - authtype = camel_sasl_authtype (mech); - - /* tell the server we want to authenticate... */ - if (authtype && authtype->quick_login) { - /* cool, we can challenge the server in our initial request */ - char *challenge; - - challenge = camel_sasl_challenge_base64 (sasl, NULL, ex); + challenge = camel_sasl_challenge_base64 (sasl, NULL, ex); + if (challenge) { cmdbuf = g_strdup_printf ("AUTH %s %s\r\n", mech, challenge); g_free (challenge); } else @@ -744,13 +751,11 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex) } while (!camel_sasl_authenticated (sasl)) { - char *challenge; - if (!respbuf) goto lose; /* eat whtspc */ - for (challenge = respbuf + 4; *challenge && isspace (*challenge); challenge++); + for (challenge = respbuf + 4; isspace (*challenge); challenge++); challenge = camel_sasl_challenge_base64 (sasl, challenge, ex); g_free (respbuf); |