aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-04 19:40:20 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2009-06-04 19:40:20 +0000
commit68f17fe3ced485b50e17eac32665b6608e7be13f (patch)
treeb585a191682a3cb7d228d75ef29eb38ae38e46d6
parent0732d3b93bbee50f6520d2be8275fe847dcada20 (diff)
Additional updates for AST-2009-001
git-svn-id: http://svn.digium.com/svn/asterisk/tags/1.6.0.10@199207 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_iax2.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index c4e856e23..95f2ba20d 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -581,7 +581,8 @@ struct chan_iax2_pvt {
/*! received OSP token */
AST_STRING_FIELD(osptoken);
);
-
+ /*! AUTHREJ all AUTHREP frames */
+ int authrej;
/*! permitted authentication methods */
int authmethods;
/*! permitted encryption methods */
@@ -6164,6 +6165,18 @@ static int check_access(int callno, struct sockaddr_in *sin, struct iax_ies *ies
ast_string_field_set(iaxs[callno], secret, user->secret);
res = 0;
user = user_unref(user);
+ } else {
+ /* user was not found, but we should still fake an AUTHREQ.
+ * Set authmethods to the last known authmethod used by the system
+ * Set a fake secret, it's not looked at, just required to attempt authentication.
+ * Set authrej so the AUTHREP is rejected without even looking at its contents */
+ iaxs[callno]->authmethods = last_authmethod ? last_authmethod : (IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT);
+ ast_string_field_set(iaxs[callno], secret, "badsecret");
+ iaxs[callno]->authrej = 1;
+ if (!ast_strlen_zero(iaxs[callno]->username)) {
+ /* only send the AUTHREQ if a username was specified. */
+ res = 0;
+ }
}
ast_set2_flag(iaxs[callno], iax2_getpeertrunk(*sin), IAX_TRUNK);
return res;
@@ -6272,6 +6285,9 @@ static int authenticate_verify(struct chan_iax2_pvt *p, struct iax_ies *ies)
.name = p->username,
};
+ if (p->authrej) {
+ return res;
+ }
user = ao2_find(users, &tmp_user, OBJ_POINTER);
if (user) {
if (ast_test_flag(p, IAX_MAXAUTHREQ)) {