Remove the "quick_login" member, which is unnecessary.
authorDan Winship <danw@src.gnome.org>
Mon, 2 Apr 2001 20:57:39 +0000 (20:57 +0000)
committerDan Winship <danw@src.gnome.org>
Mon, 2 Apr 2001 20:57:39 +0000 (20:57 +0000)
* 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.

12 files changed:
camel/ChangeLog
camel/camel-sasl-anonymous.c
camel/camel-sasl-cram-md5.c
camel/camel-sasl-digest-md5.c
camel/camel-sasl-kerberos4.c
camel/camel-sasl-login.c
camel/camel-sasl-plain.c
camel/camel-sasl.c
camel/camel-service.h
camel/providers/pop3/camel-pop3-provider.c
camel/providers/smtp/camel-smtp-provider.c
camel/providers/smtp/camel-smtp-transport.c

index 637669d..7f17b7a 100644 (file)
@@ -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.
index e24bb50..5b97fb4 100644 (file)
@@ -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;
index 7f559dd..3d3bae3 100644 (file)
@@ -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;
index a8aa634..fa0d9a8 100644 (file)
@@ -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;
index 72dcd34..1698ffe 100644 (file)
@@ -43,7 +43,6 @@ CamelServiceAuthType camel_sasl_kerberos4_authtype = {
           "Kerberos 4 authentication."),
 
        "KERBEROS_V4",
-       FALSE,
        FALSE
 };
 
index 6396e51..833578b 100644 (file)
@@ -35,7 +35,6 @@ CamelServiceAuthType camel_sasl_login_authtype = {
           "simple password."),
        
        "LOGIN",
-       TRUE,
        TRUE
 };
 
index e0b7511..aea5199 100644 (file)
 
 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;
index dd4da2f..4d27b37 100644 (file)
@@ -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);
        
index 911a0d8..6457412 100644 (file)
@@ -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;
 
 
index 79cd088..0931f90 100644 (file)
@@ -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
index b84a6a0..3bb47b3 100644 (file)
@@ -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);
index 1c18c15..b233159 100644 (file)
@@ -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);