]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Updates to AST-2009-001
authorTilghman Lesher <tilghman@meg.abyt.es>
Fri, 23 Jan 2009 19:19:06 +0000 (19:19 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Fri, 23 Jan 2009 19:19:06 +0000 (19:19 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@170580 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index a46cec0f54499dc4f77eb1330dfca6c8f56898fb..c7fe21d8ca065d95cbf298b8a0635597e28a634b 100644 (file)
@@ -5482,8 +5482,11 @@ static int register_verify(int callno, struct sockaddr_in *sin, struct iax_ies *
                        return -1;
                }
        } else if (!ast_strlen_zero(p->secret) || !ast_strlen_zero(p->inkeys)) {
-               if (authdebug)
+               if (authdebug &&
+                               ((!ast_strlen_zero(p->secret) && (p->authmethods & IAX_AUTH_MD5) && !ast_strlen_zero(iaxs[callno]->challenge)) ||
+                                (!ast_strlen_zero(p->inkeys) && (p->authmethods & IAX_AUTH_RSA) && !ast_strlen_zero(iaxs[callno]->challenge)))) {
                        ast_log(LOG_NOTICE, "Inappropriate authentication received for '%s'\n", p->name);
+               }
                if (ast_test_flag(p, IAX_TEMPONLY))
                        destroy_peer(p);
                return -1;
@@ -6092,7 +6095,7 @@ static int registry_authrequest(char *name, int callno)
        struct iax2_peer *p;
        int authmethods;
 
-       if (!iaxs[callno]) {
+       if (!callno || !iaxs[callno]) {
                return 0;
        }
 
@@ -6110,7 +6113,7 @@ static int registry_authrequest(char *name, int callno)
        }
        
        memset(&ied, 0, sizeof(ied));
-       iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
+       iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, authmethods);
        if (authmethods & (IAX_AUTH_RSA | IAX_AUTH_MD5)) {
                /* Build the challenge */
                snprintf(iaxs[callno]->challenge, sizeof(iaxs[callno]->challenge), "%d", rand());