Updated the authtype values.
authorJeffrey Stedfast <fejj@ximian.com>
Sun, 1 Apr 2001 22:10:55 +0000 (22:10 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Sun, 1 Apr 2001 22:10:55 +0000 (22:10 +0000)
2001-04-01  Jeffrey Stedfast  <fejj@ximian.com>

* camel-sasl-plain.c:
* camel-sasl-anonymous.c:
* camel-sasl-digest-md5.c:
* camel-sasl-cram-md5.c:
* camel-sasl-kerberos4.c: Updated the authtype values.

* camel-service.h: Added another field to CamelServiceAuthType
that specifies whether or not the mechanism supports "quick auth"
which means that the client can send the initial challenge in the
AUTH request.

* camel-sasl.c (camel_sasl_new): Add support for LOGIN.
(camel_sasl_authtype_list): Here too.
(camel_sasl_authtype): And finally here.

* camel-sasl-plain.c: Define camel_sasl_login_authtype.

* providers/smtp/camel-smtp-transport.c (smtp_auth): Only unref
the SASL object if it exists.

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

index cd0adf8..6fd06a1 100644 (file)
@@ -1,3 +1,25 @@
+2001-04-01  Jeffrey Stedfast  <fejj@ximian.com>
+
+       * camel-sasl-plain.c: 
+       * camel-sasl-anonymous.c: 
+       * camel-sasl-digest-md5.c: 
+       * camel-sasl-cram-md5.c: 
+       * camel-sasl-kerberos4.c: Updated the authtype values.
+
+       * camel-service.h: Added another field to CamelServiceAuthType
+       that specifies whether or not the mechanism supports "quick auth"
+       which means that the client can send the initial challenge in the
+       AUTH request.
+
+       * camel-sasl.c (camel_sasl_new): Add support for LOGIN.
+       (camel_sasl_authtype_list): Here too.
+       (camel_sasl_authtype): And finally here.
+
+       * camel-sasl-plain.c: Define camel_sasl_login_authtype.
+
+       * providers/smtp/camel-smtp-transport.c (smtp_auth): Only unref
+       the SASL object if it exists.
+
 2001-03-30  Dan Winship  <danw@ximian.com>
 
        * providers/pop3/camel-pop3-store.c (connect_to_server,
index 5626d46..e24bb50 100644 (file)
 #include "camel-internet-address.h"
 #include <string.h>
 
+CamelServiceAuthType camel_sasl_anonymous_authtype = {
+       N_("Anonymous"),
+       
+       N_("This option will connect to the server using an anonymous login."),
+       
+       "ANONYMOUS",
+       FALSE,
+       TRUE
+};
+
 static CamelSaslClass *parent_class = NULL;
 
 /* Returns the class for a CamelSaslAnonymous */
index 3b27aeb..267f338 100644 (file)
@@ -59,7 +59,9 @@ typedef struct _CamelSaslAnonymousClass {
 CamelType camel_sasl_anonymous_get_type (void);
 
 /* public methods */
-CamelSasl * camel_sasl_anonymous_new (CamelSaslAnonTraceType type, const char *trace_info);
+CamelSasl *camel_sasl_anonymous_new (CamelSaslAnonTraceType type, const char *trace_info);
+
+extern CamelServiceAuthType camel_sasl_anonymous_authtype;
 
 #ifdef __cplusplus
 }
index 3d3bae3..7f559dd 100644 (file)
@@ -38,7 +38,8 @@ CamelServiceAuthType camel_sasl_cram_md5_authtype = {
           "secure CRAM-MD5 password, if the server supports it."),
 
        "CRAM-MD5",
-       TRUE
+       TRUE,
+       FALSE
 };
 
 static CamelSaslClass *parent_class = NULL;
index fa0d9a8..a8aa634 100644 (file)
@@ -45,7 +45,8 @@ CamelServiceAuthType camel_sasl_digest_md5_authtype = {
           "secure DIGEST-MD5 password, if the server supports it."),
 
        "DIGEST-MD5",
-       TRUE
+       TRUE,
+       FALSE
 };
 
 static CamelSaslClass *parent_class = NULL;
index 1698ffe..72dcd34 100644 (file)
@@ -43,6 +43,7 @@ CamelServiceAuthType camel_sasl_kerberos4_authtype = {
           "Kerberos 4 authentication."),
 
        "KERBEROS_V4",
+       FALSE,
        FALSE
 };
 
index aea5199..958a30e 100644 (file)
 
 CamelServiceAuthType camel_sasl_plain_authtype = {
        N_("Password"),
-
+       
        N_("This option will connect to the server using a "
           "simple password."),
-
+       
        "PLAIN",
+       TRUE,
+       FALSE
+};
+
+CamelServiceAuthType camel_sasl_login_authtype = {
+       N_("NT Login"),
+       
+       N_("This option will connect to the server using a "
+          "simple password."),
+       
+       "LOGIN",
+       TRUE,
        TRUE
 };
 
index 1e93ae5..047fc6b 100644 (file)
@@ -52,6 +52,8 @@ CamelType camel_sasl_plain_get_type (void);
 
 extern CamelServiceAuthType camel_sasl_plain_authtype;
 
+extern CamelServiceAuthType camel_sasl_login_authtype;
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index 7ab6b41..1044d58 100644 (file)
@@ -191,7 +191,7 @@ camel_sasl_new (const char *service_name, const char *mechanism, CamelService *s
        else if (!strcmp (mechanism, "KERBEROS_V4"))
                sasl = (CamelSasl *)camel_object_new (CAMEL_SASL_KERBEROS4_TYPE);
 #endif
-       else if (!strcmp (mechanism, "PLAIN"))
+       else if (!strcmp (mechanism, "PLAIN") || !strcmp (mechanism, "LOGIN"))
                sasl = (CamelSasl *)camel_object_new (CAMEL_SASL_PLAIN_TYPE);
        else
                return NULL;
@@ -220,9 +220,10 @@ 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);
-
+       
        return types;
 }
 
@@ -246,6 +247,8 @@ camel_sasl_authtype (const char *mechanism)
 #endif
        else if (!strcmp (mechanism, "PLAIN"))
                return &camel_sasl_plain_authtype;
+       else if (!strcmp (mechanism, "LOGIN"))
+               return &camel_sasl_login_authtype;
        else
                return NULL;
 }
index 7850aca..9c180e5 100644 (file)
@@ -83,8 +83,14 @@ typedef struct {
 
 /* query_auth_types returns a GList of these */
 typedef struct {
-       char *name, *description, *authproto;
-       gboolean need_password;
+       char *name;               /* user-friendly name */
+       char *description;
+       char *authproto;
+       
+       gboolean need_password;   /* needs a password to authenticate */
+       
+       gboolean quick_login;     /* client can send initial challenge to
+                                  * speed up the authentication procedure */
 } CamelServiceAuthType;
 
 
index ca38182..2121161 100644 (file)
@@ -1189,6 +1189,7 @@ get_folder_info (CamelStore *store, const char *top, gboolean fast,
                        }
                }
        }
+       
        if (need_inbox) {
                CamelURL *url;
                char *uri;
index f2c344e..af41b2f 100644 (file)
@@ -735,7 +735,7 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex)
                        goto lose;
                
                /* eat whtspc */
-               for (challenge = respbuf + 4; isspace (*challenge); challenge++);
+               for (challenge = respbuf + 4; *challenge && isspace (*challenge); challenge++);
                
                challenge = camel_sasl_challenge_base64 (sasl, challenge, ex);
                g_free (respbuf);
@@ -778,7 +778,8 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex)
                                     _("Bad authentication response from server.\n"));
        }
        
-       camel_object_unref (CAMEL_OBJECT (sasl));
+       if (sasl)
+               camel_object_unref (CAMEL_OBJECT (sasl));
        
        return FALSE;
 }