aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-sasl-cram-md5.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-03-02 02:15:23 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-03-02 02:15:23 +0800
commite2fda906bce1694163eef6b8c42da0ae96bf4ac0 (patch)
tree311d945ddde6777e8fe6596f7f22bff17cedbfa1 /camel/camel-sasl-cram-md5.c
parent4523f15ef3c49020c629a31ce1f22b1c0faae1c9 (diff)
downloadgsoc2013-evolution-e2fda906bce1694163eef6b8c42da0ae96bf4ac0.tar
gsoc2013-evolution-e2fda906bce1694163eef6b8c42da0ae96bf4ac0.tar.gz
gsoc2013-evolution-e2fda906bce1694163eef6b8c42da0ae96bf4ac0.tar.bz2
gsoc2013-evolution-e2fda906bce1694163eef6b8c42da0ae96bf4ac0.tar.lz
gsoc2013-evolution-e2fda906bce1694163eef6b8c42da0ae96bf4ac0.tar.xz
gsoc2013-evolution-e2fda906bce1694163eef6b8c42da0ae96bf4ac0.tar.zst
gsoc2013-evolution-e2fda906bce1694163eef6b8c42da0ae96bf4ac0.zip
Don't base64 encode the data, leave that up to the provider to do if it
2001-03-01 Jeffrey Stedfast <fejj@ximian.com> * camel-sasl-anonymous.c (anon_challenge): Don't base64 encode the data, leave that up to the provider to do if it needs to. Also save on some memory allocations and stuff. * camel-sasl-cram-md5.c (cram_md5_challenge): Same here. Also get rid of the need for the temp buf as we can just write it to the GByteArray. svn path=/trunk/; revision=8456
Diffstat (limited to 'camel/camel-sasl-cram-md5.c')
-rw-r--r--camel/camel-sasl-cram-md5.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/camel/camel-sasl-cram-md5.c b/camel/camel-sasl-cram-md5.c
index 4b3b3aabd6..464039b251 100644
--- a/camel/camel-sasl-cram-md5.c
+++ b/camel/camel-sasl-cram-md5.c
@@ -115,7 +115,7 @@ cram_md5_challenge (CamelSasl *sasl, const char *token, CamelException *ex)
CamelSaslCramMd5 *sasl_cram = CAMEL_SASL_CRAM_MD5 (sasl);
struct _CamelSaslCramMd5Private *priv = sasl_cram->priv;
guchar digest[16], md5asc[33], *s, *p;
- char *timestamp, *passwd, *buf;
+ char *timestamp, *passwd;
GByteArray *ret = NULL;
guchar ipad[64];
guchar opad[64];
@@ -124,8 +124,7 @@ cram_md5_challenge (CamelSasl *sasl, const char *token, CamelException *ex)
switch (priv->state) {
case STATE_AUTH:
- timestamp = g_strdup (token);
- base64_decode_simple (timestamp, strlen (timestamp));
+ timestamp = (char *) token;
passwd = sasl_cram->passwd;
pw_len = strlen (sasl_cram->passwd);
@@ -161,11 +160,10 @@ cram_md5_challenge (CamelSasl *sasl, const char *token, CamelException *ex)
for (s = digest, p = md5asc; p < md5asc + 32; s++, p += 2)
sprintf (p, "%.2x", *s);
- buf = g_strdup_printf ("%s %s", sasl_cram->username, md5asc);
-
ret = g_byte_array_new ();
- g_byte_array_append (ret, buf, strlen (buf));
- g_free (buf);
+ g_byte_array_append (ret, sasl_cram->username, strlen (sasl_cram->username));
+ g_byte_array_append (ret, " ", 1);
+ g_byte_array_append (ret, md5asc, strlen (md5asc));
break;
case STATE_FINAL: