summaryrefslogtreecommitdiff
path: root/pjsip
diff options
context:
space:
mode:
authorRiza Sulistyo <riza@teluu.com>2016-01-27 05:42:20 +0000
committerRiza Sulistyo <riza@teluu.com>2016-01-27 05:42:20 +0000
commit687340a74c5c791f11590893a6ed909e98c860e7 (patch)
treea7c949a0fabd2ea1d71bd6205c27aba80bcc168c /pjsip
parenta852b979a9ddcb1537a71f2f8fe924a52f273370 (diff)
Misc (Re #1882): When server sends blank realm on the Authentication challanges, the stack doesn't include the realm param.
And hence, the server will reject the request. This patch will include the blank realm on the next request. Thanks to Keith Hanaway for the report. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5237 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip')
-rw-r--r--pjsip/include/pjsip/print_util.h17
-rw-r--r--pjsip/src/pjsip/sip_auth_msg.c3
2 files changed, 19 insertions, 1 deletions
diff --git a/pjsip/include/pjsip/print_util.h b/pjsip/include/pjsip/print_util.h
index d2ee3aea..f8f9eb01 100644
--- a/pjsip/include/pjsip/print_util.h
+++ b/pjsip/include/pjsip/print_util.h
@@ -105,6 +105,10 @@
#define copy_advance copy_advance_check
#define copy_advance_pair copy_advance_pair_check
+/*
+ * Append str1 and quoted str2 and copy to buf.
+ * No string is copied if str2 is empty.
+ */
#define copy_advance_pair_quote_cond(buf,str1,len1,str2,quotebegin,quoteend) \
do { \
if (str2.slen && *str2.ptr!=quotebegin) \
@@ -114,6 +118,19 @@
} while (0)
/*
+ * Append str1 and quoted str2 and copy to buf.
+ * In case str2 is empty, str1 will be appended with empty quote.
+ */
+#define copy_advance_pair_quote_cond_always(buf,str1,len1,str2,quotebegin, \
+ quoteend)\
+ do { \
+ if (!str2.slen) \
+ copy_advance_pair_quote(buf,str1,len1,str2,quotebegin,quoteend); \
+ else \
+ copy_advance_pair_quote_cond(buf,str1,len1,str2,quotebegin,quoteend);\
+ } while (0)
+
+/*
* Internal type declarations.
*/
typedef void* (*pjsip_hdr_clone_fptr)(pj_pool_t *, const void*);
diff --git a/pjsip/src/pjsip/sip_auth_msg.c b/pjsip/src/pjsip/sip_auth_msg.c
index 0f37fae2..fd42b697 100644
--- a/pjsip/src/pjsip/sip_auth_msg.c
+++ b/pjsip/src/pjsip/sip_auth_msg.c
@@ -71,7 +71,8 @@ static int print_digest_credential(pjsip_digest_credential *cred, char *buf, pj_
const pjsip_parser_const_t *pc = pjsip_parser_const();
copy_advance_pair_quote_cond(buf, "username=", 9, cred->username, '"', '"');
- copy_advance_pair_quote_cond(buf, ", realm=", 8, cred->realm, '"', '"');
+ copy_advance_pair_quote_cond_always(buf, ", realm=", 8, cred->realm, '"',
+ '"');
copy_advance_pair_quote(buf, ", nonce=", 8, cred->nonce, '"', '"');
copy_advance_pair_quote_cond(buf, ", uri=", 6, cred->uri, '"', '"');
copy_advance_pair_quote(buf, ", response=", 11, cred->response, '"', '"');