[asterisk-commits] dvossel: branch 1.2 r199137 - /branches/1.2/channels/chan_iax2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jun 4 13:57:57 CDT 2009
Author: dvossel
Date: Thu Jun 4 13:57:54 2009
New Revision: 199137
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=199137
Log:
Additional updates to AST-2009-001
Modified:
branches/1.2/channels/chan_iax2.c
Modified: branches/1.2/channels/chan_iax2.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.2/channels/chan_iax2.c?view=diff&rev=199137&r1=199136&r2=199137
==============================================================================
--- branches/1.2/channels/chan_iax2.c (original)
+++ branches/1.2/channels/chan_iax2.c Thu Jun 4 13:57:54 2009
@@ -546,6 +546,8 @@
char username[80];
/*! Expected Secret */
char secret[80];
+ /*! AUTHREJ all AUTHREP frames */
+ int authrej;
/*! permitted authentication methods */
int authmethods;
/*! permitted encryption methods */
@@ -5178,6 +5180,18 @@
if (ast_test_flag(user, IAX_TEMPONLY))
destroy_user(user);
res = 0;
+ } else {
+ /* user was not found, but we should still fake an AUTHREQ.
+ * Set authmethods to the last known authmethods 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 = lastauthmethod ? lastauthmethod : (IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT);
+ ast_copy_string(iaxs[callno]->secret, "badsecret", sizeof(iaxs[callno]->secret));
+ 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;
@@ -5277,6 +5291,9 @@
int x;
struct iax2_user *user = NULL;
+ if (p->authrej) {
+ return res;
+ }
ast_mutex_lock(&userl.lock);
user = userl.users;
while (user) {
@@ -6109,11 +6126,10 @@
authmethods = p ? p->authmethods : lastauthmethod ? lastauthmethod : (IAX_AUTH_PLAINTEXT | IAX_AUTH_MD5);
if (p && ast_test_flag(p, IAX_TEMPONLY)) {
destroy_peer(p);
- } else if (!p && !delayreject) {
+ } else if (!p) {
ast_log(LOG_WARNING, "No such peer '%s'\n", name);
- return 0;
- }
-
+ }
+
memset(&ied, 0, sizeof(ied));
iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, authmethods);
if (authmethods & (IAX_AUTH_RSA | IAX_AUTH_MD5)) {
More information about the asterisk-commits
mailing list