aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-05 19:50:43 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-05-05 19:50:43 +0000
commit974f4a251b5574e7d3ebe1ab9b19dbee8b9945a2 (patch)
tree98d54b67ecbfebce0775c316d219b8625cf1156e /channels
parentc03d2f4e460c9b06006ee43d722a15114295079a (diff)
Merged revisions 115305 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r115305 | russell | 2008-05-05 14:50:24 -0500 (Mon, 05 May 2008) | 13 lines Merged revisions 115304 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r115304 | russell | 2008-05-05 14:49:25 -0500 (Mon, 05 May 2008) | 5 lines Avoid putting opaque="" in Digest authentication. This patch came from switchvox. It fixes authentication with Primus in Canada, and has been in use for a very long time without causing problems with any other providers. (closes issue AST-36) ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@115306 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5f2a426d2..56155f3b2 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -14061,6 +14061,7 @@ static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int d
char resp[256];
char resp_hash[256];
char uri[256];
+ char opaque[256] = "";
char cnonce[80];
const char *username;
const char *secret;
@@ -14109,11 +14110,17 @@ static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int d
else
snprintf(resp, sizeof(resp), "%s:%s:%s", a1_hash, p->nonce, a2_hash);
ast_md5_hash(resp_hash, resp);
+
+ /* only include the opaque string if it's set */
+ if (!ast_strlen_zero(p->opaque)) {
+ snprintf(opaque, sizeof(opaque), ", opaque=\"%s\"", p->opaque);
+ }
+
/* XXX We hard code our qop to "auth" for now. XXX */
if (!ast_strlen_zero(p->qop))
- snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\", opaque=\"%s\", qop=auth, cnonce=\"%s\", nc=%08x", username, p->realm, uri, p->nonce, resp_hash, p->opaque, cnonce, p->noncecount);
+ snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\"%s, qop=auth, cnonce=\"%s\", nc=%08x", username, p->realm, uri, p->nonce, resp_hash, opaque, cnonce, p->noncecount);
else
- snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\", opaque=\"%s\"", username, p->realm, uri, p->nonce, resp_hash, p->opaque);
+ snprintf(digest, digest_len, "Digest username=\"%s\", realm=\"%s\", algorithm=MD5, uri=\"%s\", nonce=\"%s\", response=\"%s\"%s", username, p->realm, uri, p->nonce, resp_hash, opaque);
append_history(p, "AuthResp", "Auth response sent for %s in realm %s - nc %d", username, p->realm, p->noncecount);