aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-07 19:05:38 +0000
committerautomerge <automerge@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-07 19:05:38 +0000
commite2ee0c8fd50fcbf439b8865de788b0014d2ec755 (patch)
treea04b8b025b8403e18c73066751a6a06726066517
parente88a53402b5076b363b5cafe61f722f06da65b46 (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@58284 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_iax2.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 1e23a726e..b9d536aab 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -1085,6 +1085,12 @@ static int find_callno(unsigned short callno, unsigned short dcallno, struct soc
}
}
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(iabuf, sizeof(iabuf), sin->sin_addr), ntohs(sin->sin_port));
gettimeofday(&now, NULL);
@@ -5035,19 +5041,21 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
int x;
struct iax2_user *user = NULL;
- if (ast_test_flag(p, IAX_MAXAUTHREQ)) {
- ast_mutex_lock(&userl.lock);
- user = userl.users;
- while (user) {
- if (!strcmp(user->name, p->username)) {
- user->curauthreq--;
- break;
- }
- user = user->next;
+ ast_mutex_lock(&userl.lock);
+ user = userl.users;
+ while (user) {
+ if (!strcmp(user->name, p->username))
+ break;
+ user = user->next;
+ }
+ if (user) {
+ if (ast_test_flag(p, IAX_MAXAUTHREQ)) {
+ user->curauthreq--;
+ ast_clear_flag(p, IAX_MAXAUTHREQ);
}
- ast_mutex_unlock(&userl.lock);
- ast_clear_flag(p, IAX_MAXAUTHREQ);
+ ast_copy_string(p->host, user->name, sizeof(p->host));
}
+ ast_mutex_unlock(&userl.lock);
if (!ast_test_flag(&p->state, IAX_STATE_AUTHENTICATED))
return res;