[asterisk-commits] russell: trunk r58244 - in /trunk: ./ channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Mar 7 11:20:51 MST 2007


Author: russell
Date: Wed Mar  7 12:20:51 2007
New Revision: 58244

URL: http://svn.digium.com/view/asterisk?view=rev&rev=58244
Log:
Merged revisions 58243 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r58243 | russell | 2007-03-07 12:19:19 -0600 (Wed, 07 Mar 2007) | 17 lines

(This bug was reported to me by Kinsey Moore)

Merged revisions 58242 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r58242 | russell | 2007-03-07 12:17:07 -0600 (Wed, 07 Mar 2007) | 7 lines

Fix a problem where the Asterisk channel name could be that of the wrong IAX2
user for a call.  This is because the first step of choosing this name is to
look for an IAX2 peer that happens to have the same IP/port number that this
call is coming from and assuming that is it.  However, this is not always
correct.  So, I have made it change this name after authentication happens
since at that point, we have an exact match.

........

................

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=58244&r1=58243&r2=58244
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Wed Mar  7 12:20:51 2007
@@ -1328,6 +1328,12 @@
 		}
 	}
 	if ((res < 1) && (new >= NEW_ALLOW)) {
+		/* It may seem odd that we look through the peer list for a name for
+		 * this *incoming* call.  Well, it is weird.  However, users don't
+		 * have an IP address/port number that we can match against.  So,
+		 * this is just checking for a peer that has that IP/port and
+		 * assuming that we have a user of the same name.  This isn't always
+		 * correct, but it will be changed if needed after authentication. */
 		if (!iax2_getpeername(*sin, host, sizeof(host), lockpeer))
 			snprintf(host, sizeof(host), "%s:%d", ast_inet_ntoa(sin->sin_addr), ntohs(sin->sin_port));
 		gettimeofday(&now, NULL);
@@ -5015,17 +5021,19 @@
 	int x;
 	struct iax2_user *user = NULL;
 
-	if (ast_test_flag(p, IAX_MAXAUTHREQ)) {
-		AST_LIST_LOCK(&users);
-		AST_LIST_TRAVERSE(&users, user, entry) {
-			if (!strcmp(user->name, p->username)) {
-				user->curauthreq--;
-				break;
-			}
-		}
-		AST_LIST_UNLOCK(&users);
-		ast_clear_flag(p, IAX_MAXAUTHREQ);
-	}
+	AST_LIST_LOCK(&users);
+	AST_LIST_TRAVERSE(&users, user, entry) {
+		if (!strcmp(user->name, p->username))
+			break;
+	}
+	if (user) {
+		if (ast_test_flag(p, IAX_MAXAUTHREQ)) {
+			user->curauthreq--;
+			ast_clear_flag(p, IAX_MAXAUTHREQ);
+		}
+		ast_string_field_set(p, host, user->name);
+	}
+	AST_LIST_UNLOCK(&users);
 
 	if (!ast_test_flag(&p->state, IAX_STATE_AUTHENTICATED))
 		return res;



More information about the asterisk-commits mailing list