diff options
-rw-r--r-- | camel/ChangeLog | 30 | ||||
-rw-r--r-- | camel/camel-sasl-anonymous.c | 3 | ||||
-rw-r--r-- | camel/camel-sasl-cram-md5.c | 3 | ||||
-rw-r--r-- | camel/camel-sasl-digest-md5.c | 3 | ||||
-rw-r--r-- | camel/camel-sasl-kerberos4.c | 1 | ||||
-rw-r--r-- | camel/camel-sasl-login.c | 1 | ||||
-rw-r--r-- | camel/camel-sasl-plain.c | 7 | ||||
-rw-r--r-- | camel/camel-sasl.c | 1 | ||||
-rw-r--r-- | camel/camel-service.h | 6 | ||||
-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 |
12 files changed, 64 insertions, 44 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 637669dc26..7f17b7aef3 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,33 @@ +2001-04-02 Dan Winship <danw@ximian.com> + + * 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. + 2001-04-02 Gediminas Paulauskas <menesis@delfi.lt> * camel-filter-driver.c: marked missing report status' for translation. diff --git a/camel/camel-sasl-anonymous.c b/camel/camel-sasl-anonymous.c index e24bb50182..5b97fb4edf 100644 --- a/camel/camel-sasl-anonymous.c +++ b/camel/camel-sasl-anonymous.c @@ -35,8 +35,7 @@ CamelServiceAuthType camel_sasl_anonymous_authtype = { N_("This option will connect to the server using an anonymous login."), "ANONYMOUS", - FALSE, - TRUE + FALSE }; static CamelSaslClass *parent_class = NULL; diff --git a/camel/camel-sasl-cram-md5.c b/camel/camel-sasl-cram-md5.c index 7f559ddc68..3d3bae36e1 100644 --- a/camel/camel-sasl-cram-md5.c +++ b/camel/camel-sasl-cram-md5.c @@ -38,8 +38,7 @@ CamelServiceAuthType camel_sasl_cram_md5_authtype = { "secure CRAM-MD5 password, if the server supports it."), "CRAM-MD5", - TRUE, - FALSE + TRUE }; static CamelSaslClass *parent_class = NULL; diff --git a/camel/camel-sasl-digest-md5.c b/camel/camel-sasl-digest-md5.c index a8aa6340c2..fa0d9a8175 100644 --- a/camel/camel-sasl-digest-md5.c +++ b/camel/camel-sasl-digest-md5.c @@ -45,8 +45,7 @@ CamelServiceAuthType camel_sasl_digest_md5_authtype = { "secure DIGEST-MD5 password, if the server supports it."), "DIGEST-MD5", - TRUE, - FALSE + TRUE }; static CamelSaslClass *parent_class = NULL; diff --git a/camel/camel-sasl-kerberos4.c b/camel/camel-sasl-kerberos4.c index 72dcd34e0c..1698ffe870 100644 --- a/camel/camel-sasl-kerberos4.c +++ b/camel/camel-sasl-kerberos4.c @@ -43,7 +43,6 @@ CamelServiceAuthType camel_sasl_kerberos4_authtype = { "Kerberos 4 authentication."), "KERBEROS_V4", - FALSE, FALSE }; diff --git a/camel/camel-sasl-login.c b/camel/camel-sasl-login.c index 6396e51102..833578bc1d 100644 --- a/camel/camel-sasl-login.c +++ b/camel/camel-sasl-login.c @@ -35,7 +35,6 @@ CamelServiceAuthType camel_sasl_login_authtype = { "simple password."), "LOGIN", - TRUE, TRUE }; diff --git a/camel/camel-sasl-plain.c b/camel/camel-sasl-plain.c index e0b7511ff0..aea5199b68 100644 --- a/camel/camel-sasl-plain.c +++ b/camel/camel-sasl-plain.c @@ -30,13 +30,12 @@ CamelServiceAuthType camel_sasl_plain_authtype = { N_("Password"), - + N_("This option will connect to the server using a " "simple password."), - + "PLAIN", - TRUE, - FALSE + TRUE }; static CamelSaslClass *parent_class = NULL; diff --git a/camel/camel-sasl.c b/camel/camel-sasl.c index dd4da2f081..4d27b37b75 100644 --- a/camel/camel-sasl.c +++ b/camel/camel-sasl.c @@ -223,7 +223,6 @@ camel_sasl_authtype_list (gboolean include_plain) #ifdef HAVE_KRB4 types = g_list_prepend (types, &camel_sasl_kerberos4_authtype); #endif - types = g_list_prepend (types, &camel_sasl_login_authtype); if (include_plain) types = g_list_prepend (types, &camel_sasl_plain_authtype); diff --git a/camel/camel-service.h b/camel/camel-service.h index 911a0d8f8f..64574123d5 100644 --- a/camel/camel-service.h +++ b/camel/camel-service.h @@ -88,12 +88,6 @@ typedef struct { char *authproto; gboolean need_password; /* needs a password to authenticate */ - - gboolean quick_login; /* Client can send initial challenge to - * speed up the authentication procedure. - * Note: This option only ever matters if - * it is a SASL mechanism. If unsure, it - * is safe to say FALSE. */ } CamelServiceAuthType; 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); |