diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2006-05-30 18:01:52 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2006-05-30 18:01:52 +0000 |
commit | 4790dd5d9e3b59be9976fad2f0862e94205ed769 (patch) | |
tree | ac9abdba763e67a8ae002a45f7f74ba9a975b71d /channels/chan_iax2.c | |
parent | 7e84433270ff43622e17b5d585253b9ab787dd37 (diff) |
when we receive an IAX2 registration request with both a plaintext secret and an MD5 challenge, prefer the MD5 challenge for authentation (reported on asterisk-dev)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@30847 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r-- | channels/chan_iax2.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 1a91dc759..ae92d3360 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -5052,16 +5052,6 @@ static int register_verify(int callno, struct sockaddr_in *sin, struct iax_ies * destroy_peer(p); return -1; } - } else if (!ast_strlen_zero(secret) && (p->authmethods & IAX_AUTH_PLAINTEXT)) { - /* They've provided a plain text password and we support that */ - if (strcmp(secret, p->secret)) { - if (authdebug) - ast_log(LOG_NOTICE, "Host %s did not provide proper plaintext password for '%s'\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), p->name); - if (ast_test_flag(p, IAX_TEMPONLY)) - destroy_peer(p); - return -1; - } else - ast_set_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED); } else if (!ast_strlen_zero(md5secret) && (p->authmethods & IAX_AUTH_MD5) && !ast_strlen_zero(iaxs[callno]->challenge)) { struct MD5Context md5; unsigned char digest[16]; @@ -5088,6 +5078,16 @@ static int register_verify(int callno, struct sockaddr_in *sin, struct iax_ies * destroy_peer(p); return -1; } + } else if (!ast_strlen_zero(secret) && (p->authmethods & IAX_AUTH_PLAINTEXT)) { + /* They've provided a plain text password and we support that */ + if (strcmp(secret, p->secret)) { + if (authdebug) + ast_log(LOG_NOTICE, "Host %s did not provide proper plaintext password for '%s'\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), p->name); + if (ast_test_flag(p, IAX_TEMPONLY)) + destroy_peer(p); + return -1; + } else + ast_set_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED); } else if (!ast_strlen_zero(md5secret) || !ast_strlen_zero(secret)) { if (authdebug) ast_log(LOG_NOTICE, "Inappropriate authentication received\n"); |