From 5ea224b3caa383ab7581d9c846d0db32109cf174 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 17 Jan 2007 22:04:01 +0000 Subject: [PATCH] fix for cnonce crap (tell pekka) git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3982 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/.update | 2 +- libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 152d9c8037..64d79eac98 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Thu Jan 4 13:01:49 EST 2007 +Wed Jan 17 17:00:56 EST 2007 diff --git a/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c b/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c index 963f1421b9..5c7dd4b1c2 100644 --- a/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c +++ b/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_client.c @@ -766,12 +766,22 @@ static int auc_digest_challenge(auth_client_t *ca, msg_auth_t const *ch) if (ac->ac_qop && (cda->cda_cnonce == NULL || ac->ac_stale)) { su_guid_t guid[1]; char *cnonce; + char *e; + if (cda->cda_cnonce != NULL) /* Free the old one if we are updating after stale=true */ su_free(home, (void *)cda->cda_cnonce); su_guid_generate(guid); cda->cda_cnonce = cnonce = su_alloc(home, BASE64_SIZE(sizeof(guid)) + 1); base64_e(cnonce, BASE64_SIZE(sizeof(guid)) + 1, guid, sizeof(guid)); + /* somewhere else in the code the '=' chars are stripped in the header + we need to strip it now before the digest is created or we're in trouble + cos they won't match..... + */ + e = cnonce + strlen(cnonce) - 1; + while(*e == '=') { + *e-- = '\0'; + } cda->cda_ncount = 0; }