Merged revisions 279817 via svnmerge from
authorDavid Vossel <dvossel@digium.com>
Tue, 27 Jul 2010 16:11:11 +0000 (16:11 +0000)
committerDavid Vossel <dvossel@digium.com>
Tue, 27 Jul 2010 16:11:11 +0000 (16:11 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r279817 | dvossel | 2010-07-27 11:09:15 -0500 (Tue, 27 Jul 2010) | 2 lines

  fix sip transaction match with authentication, fix confusing log message when using getaddrinfo
........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@279818 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
main/netsock2.c

index 4dd27f8..b74bc29 100644 (file)
@@ -7369,11 +7369,10 @@ static struct sip_pvt *find_call(struct sip_request *req, struct ast_sockaddr *a
 
                /* If this is a Request, set the Via and Authorization header arguments */
                if (req->method != SIP_RESPONSE) {
 
                /* If this is a Request, set the Via and Authorization header arguments */
                if (req->method != SIP_RESPONSE) {
-                       const char *auth_header;
                        args.ruri = REQ_OFFSET_TO_STR(req, rlPart2);
                        get_viabranch(ast_strdupa(get_header(req, "Via")), (char **) &args.viasentby, (char **) &args.viabranch);
                        args.ruri = REQ_OFFSET_TO_STR(req, rlPart2);
                        get_viabranch(ast_strdupa(get_header(req, "Via")), (char **) &args.viasentby, (char **) &args.viabranch);
-                       auth_header = get_header(req, "WWW-Authenticate");
-                       if (!ast_strlen_zero(auth_header)) {
+                       if (!ast_strlen_zero(get_header(req, "Authorization")) ||
+                               !ast_strlen_zero(get_header(req, "Proxy-Authorization"))) {
                                args.authentication_present = 1;
                        }
                }
                                args.authentication_present = 1;
                        }
                }
index 52b8a8d..929f4b3 100644 (file)
@@ -201,8 +201,10 @@ int ast_sockaddr_parse(struct ast_sockaddr *addr, const char *str, int flags)
        hints.ai_flags = AI_NUMERICHOST;
 #endif
        if ((e = getaddrinfo(host, port, &hints, &res))) {
        hints.ai_flags = AI_NUMERICHOST;
 #endif
        if ((e = getaddrinfo(host, port, &hints, &res))) {
-               ast_log(LOG_ERROR, "getaddrinfo(\"%s\", \"%s\", ...): %s\n",
-                       host, S_OR(port, "(null)"), gai_strerror(e));
+               if (e != EAI_NONAME) { /* if this was just a host name rather than a ip address, don't print error */
+                       ast_log(LOG_ERROR, "getaddrinfo(\"%s\", \"%s\", ...): %s\n",
+                               host, S_OR(port, "(null)"), gai_strerror(e));
+               }
                return 0;
        }
 
                return 0;
        }