From 22c6a0961baf7db6c00c59ce8512c2d317eb062e Mon Sep 17 00:00:00 2001 From: oej Date: Thu, 26 Jun 2008 16:32:08 +0000 Subject: Add support for peer realm based auth (a few missing lines, the rest is well documented but never worked) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@125384 f38db490-d61c-443f-a65b-d21fe96a405b --- channels/chan_sip.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'channels') diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 70014f2d0..20560afc2 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2863,6 +2863,7 @@ static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer) dialog->maxtime = peer->maxms; dialog->callgroup = peer->callgroup; dialog->pickupgroup = peer->pickupgroup; + dialog->peerauth = peer->auth; dialog->allowtransfer = peer->allowtransfer; /* Set timer T1 to RTT for this peer (if known by qualify=) */ /* Minimum is settable or default to 100 ms */ @@ -11649,9 +11650,11 @@ static int build_reply_digest(struct sip_pvt *p, int method, char* digest, int d snprintf(cnonce, sizeof(cnonce), "%08lx", ast_random()); /* Check if we have separate auth credentials */ - if ((auth = find_realm_authentication(authl, p->realm))) { - ast_log(LOG_WARNING, "use realm [%s] from peer [%s][%s]\n", - auth->username, p->peername, p->username); + if(!(auth = find_realm_authentication(p->peerauth, p->realm))) /* Start with peer list */ + auth = find_realm_authentication(authl, p->realm); /* If not, global list */ + + if (auth) { + ast_log(LOG_DEBUG, "use realm [%s] from peer [%s][%s]\n", auth->username, p->peername, p->username); username = auth->username; secret = auth->secret; md5secret = auth->md5secret; -- cgit v1.2.3