summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2010-04-29 00:03:19 +0000
committerBenny Prijono <bennylp@teluu.com>2010-04-29 00:03:19 +0000
commit85aeddc9c04b1c822b61e01527d4dea6f7fdf0c9 (patch)
treec98a5df5ba6673d3d923aeed0bd55368bf405c3b
parent22e54bedfb0f26c33429a9c4307fe9827491318e (diff)
Fixed #1061 (Assertion when receiving authentication challenge with empty realm (thanks Andrey Kovalenko for the report)):
- removed the assertion (allow responding to empty realm) - slight modification in Authenticate/WWW-Authenticate headers to allow printing challenge with empty realm, otherwise a malformed header will be printed if empty realm is given git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3149 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsip/sip_auth_client.c2
-rw-r--r--pjsip/src/pjsip/sip_auth_msg.c3
2 files changed, 4 insertions, 1 deletions
diff --git a/pjsip/src/pjsip/sip_auth_client.c b/pjsip/src/pjsip/sip_auth_client.c
index e1667c96..df904e4f 100644
--- a/pjsip/src/pjsip/sip_auth_client.c
+++ b/pjsip/src/pjsip/sip_auth_client.c
@@ -393,7 +393,9 @@ static void update_digest_session( pj_pool_t *ses_pool,
cached_auth->nc = 1;
/* Save realm. */
+ /* Note: allow empty realm (http://trac.pjsip.org/repos/ticket/1061)
pj_assert(cached_auth->realm.slen != 0);
+ */
if (cached_auth->realm.slen == 0) {
pj_strdup(ses_pool, &cached_auth->realm,
&hdr->challenge.digest.realm);
diff --git a/pjsip/src/pjsip/sip_auth_msg.c b/pjsip/src/pjsip/sip_auth_msg.c
index 2def9ab0..26477cc0 100644
--- a/pjsip/src/pjsip/sip_auth_msg.c
+++ b/pjsip/src/pjsip/sip_auth_msg.c
@@ -232,7 +232,8 @@ static int print_digest_challenge( pjsip_digest_challenge *chal,
char *endbuf = buf + size;
const pjsip_parser_const_t *pc = pjsip_parser_const();
- copy_advance_pair_quote_cond(buf, " realm=", 7, chal->realm, '"', '"');
+ /* Allow empty realm, see http://trac.pjsip.org/repos/ticket/1061 */
+ copy_advance_pair_quote(buf, " realm=", 7, chal->realm, '"', '"');
copy_advance_pair_quote_cond(buf, ",domain=", 8, chal->domain, '"', '"');
copy_advance_pair_quote_cond(buf, ",nonce=", 7, chal->nonce, '"', '"');
copy_advance_pair_quote_cond(buf, ",opaque=", 8, chal->opaque, '"', '"');