[asterisk-commits] russell: trunk r79306 - in /trunk: ./ channels/chan_iax2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Aug 13 15:40:47 CDT 2007
Author: russell
Date: Mon Aug 13 15:40:47 2007
New Revision: 79306
URL: http://svn.digium.com/view/asterisk?view=rev&rev=79306
Log:
Merged revisions 79301 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r79301 | russell | 2007-08-13 15:37:50 -0500 (Mon, 13 Aug 2007) | 3 lines
Don't call find_peer in registry_authrequest with the pvt lock held to avoid a
deadlock.
........
Modified:
trunk/ (props changed)
trunk/channels/chan_iax2.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=79306&r1=79305&r2=79306
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Mon Aug 13 15:40:47 2007
@@ -6127,13 +6127,21 @@
return send_command_final(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_REGACK, 0, ied.buf, ied.pos, -1);
}
-static int registry_authrequest(const char *name, int callno)
+static int registry_authrequest(int callno)
{
struct iax_ie_data ied;
struct iax2_peer *p;
char challenge[10];
+ const char *peer_name;
+
+ peer_name = ast_strdupa(iaxs[callno]->peer);
+
/* SLD: third call to find_peer in registration */
- p = find_peer(name, 1);
+ ast_mutex_unlock(&iaxsl[callno]);
+ p = find_peer(peer_name, 1);
+ ast_mutex_lock(&iaxsl[callno]);
+ if (!iaxs[callno])
+ return -1;
if (p) {
memset(&ied, 0, sizeof(ied));
iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
@@ -6144,12 +6152,12 @@
/* snprintf(iaxs[callno]->challenge, sizeof(iaxs[callno]->challenge), "%d", (int)ast_random()); */
iax_ie_append_str(&ied, IAX_IE_CHALLENGE, iaxs[callno]->challenge);
}
- iax_ie_append_str(&ied, IAX_IE_USERNAME, name);
+ iax_ie_append_str(&ied, IAX_IE_USERNAME, peer_name);
if (ast_test_flag(p, IAX_TEMPONLY))
destroy_peer(p);
return send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_REGAUTH, 0, ied.buf, ied.pos, -1);;
}
- ast_log(LOG_WARNING, "No such peer '%s'\n", name);
+ ast_log(LOG_WARNING, "No such peer '%s'\n", peer_name);
return 0;
}
@@ -8175,7 +8183,11 @@
}
break;
}
- registry_authrequest(iaxs[fr->callno]->peer, fr->callno);
+ registry_authrequest(fr->callno);
+ if (!iaxs[fr->callno]) {
+ ast_mutex_unlock(&iaxsl[fr->callno]);
+ return 1;
+ }
break;
case IAX_COMMAND_REGACK:
if (iax2_ack_registry(&ies, &sin, fr->callno))
More information about the asterisk-commits
mailing list