From 61a496ffcad857b0dac176861206c4a98edc1620 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Thu, 1 Mar 2001 22:23:23 +0000 Subject: Take a GByteArray as input as well. Comment that you can pass %NULL for * camel-sasl.c (camel_sasl_challenge): Take a GByteArray as input as well. Comment that you can pass %NULL for @token to get the initial auth data for mechanisms that are client-initiated. (camel_sasl_challenge_base64): Convenience function for protocols that use base64-encoded SASL. (camel_sasl_authenticated): Implement this... (it was prototyped already) (camel_sasl_new): Function to take a service name, a mechanism name, and a CamelService, and return a CamelSasl for it. (camel_sasl_authtype, camel_sasl_authtype_list): Functions to return CamelServiceAuthType information about SASL mechanisms, to allow providers to deal with them generically. * camel-sasl-anonymous.c, camel-sasl-plain.c: Update/simplify for CamelSasl changes. Both of these are single-round (client-initiated) mechanisms, so they don't need to keep state. (camel_sasl_plain_new): Removed; use camel_sasl_new instead. (Can't get rid of camel_sasl_anonymous_new though...) * camel-sasl-cram-md5.c: Update/simplify for CamelSasl changes. (camel_sasl_cram_md5_new): Removed; use camel_sasl_new instead. (cram_md5_challenge): Use md5_get_digest where possible, and various other minor simplifications. CRAM-MD5 only has a single round, so there's no need to keep track of state. This code is now tested (against Cyrus IMAPd) and known to work. * camel-sasl-kerberos4.h: Update/simplify for CamelSasl changes. Make only a single #ifdef HAVE_KRB4. Remove stuff from priv that isn't needed between rounds. (camel_sasl_kerberos4_new): Removed; use camel_sasl_new instead (krb4_challenge): Fix up the logic I broke in my previous "at least make it compile" fixes, update to match other changes, and remove IMAP-isms that shouldn't be in the generic code. This still isn't tested, because we're stuck behind a NAT right now... svn path=/trunk/; revision=8462 --- camel/camel-sasl.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'camel/camel-sasl.h') diff --git a/camel/camel-sasl.h b/camel/camel-sasl.h index 24201a0b03..02f05eb8cf 100644 --- a/camel/camel-sasl.h +++ b/camel/camel-sasl.h @@ -31,6 +31,7 @@ extern "C" { #include #include #include +#include #define CAMEL_SASL_TYPE (camel_sasl_get_type ()) #define CAMEL_SASL(obj) (CAMEL_CHECK_CAST((obj), CAMEL_SASL_TYPE, CamelSasl)) @@ -40,6 +41,8 @@ extern "C" { typedef struct _CamelSasl { CamelObject parent_object; + char *service_name; + CamelService *service; gboolean authenticated; } CamelSasl; @@ -47,7 +50,7 @@ typedef struct _CamelSasl { typedef struct _CamelSaslClass { CamelObjectClass parent_class; - GByteArray * (*challenge) (CamelSasl *sasl, const char *token, CamelException *ex); + GByteArray * (*challenge) (CamelSasl *sasl, GByteArray *token, CamelException *ex); } CamelSaslClass; @@ -56,9 +59,16 @@ typedef struct _CamelSaslClass { CamelType camel_sasl_get_type (void); /* public methods */ -GByteArray *camel_sasl_challenge (CamelSasl *sasl, const char *token, CamelException *ex); +GByteArray *camel_sasl_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex); +char *camel_sasl_challenge_base64 (CamelSasl *sasl, const char *token, CamelException *ex); -gboolean camel_sasl_authenticated (CamelSasl *sasl); +gboolean camel_sasl_authenticated (CamelSasl *sasl); + +/* utility functions */ +CamelSasl *camel_sasl_new (const char *service_name, const char *mechanism, CamelService *service); + +GList *camel_sasl_authtype_list (void); +CamelServiceAuthType *camel_sasl_authtype (const char *mechanism); #ifdef __cplusplus } -- cgit