On 04/10/2014 09:57 PM, Konstantin Kolinko wrote:
2014-04-08 11:52 GMT+04:00  <mt...@apache.org>:
Author: mturk
Date: Tue Apr  8 07:52:56 2014
New Revision: 1585657

URL: http://svn.apache.org/r1585657
Log:
Use port when calling getaddrinfo and skip bogus addresses

Modified:
     tomcat/jk/trunk/native/common/jk_connect.c

Modified: tomcat/jk/trunk/native/common/jk_connect.c
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_connect.c?rev=1585657&r1=1585656&r2=1585657&view=diff
==============================================================================
--- tomcat/jk/trunk/native/common/jk_connect.c (original)
+++ tomcat/jk/trunk/native/common/jk_connect.c Tue Apr  8 07:52:56 2014
@@ -430,6 +430,8 @@ int jk_resolve(const char *host, int por
           */
          struct addrinfo hints, *ai_list, *ai = NULL;
          int error;
+        char  pbuf[12];
+        char *pbufptr = NULL;

          memset(&hints, 0, sizeof(hints));
          hints.ai_socktype = SOCK_STREAM;
@@ -440,7 +442,11 @@ int jk_resolve(const char *host, int por
          else
  #endif
              hints.ai_family = JK_INET;
-        error = getaddrinfo(host, NULL, &hints, &ai_list);
+        if (port > 0) {
+            snprintf(pbuf, port, sizeof(pbuf));
+            pbufptr = pbuf;
+        }
+        error = getaddrinfo(host, pbufptr, &hints, &ai_list);


The "getaddrinfo" method is called twice in this method. The above
modifies the first call.

Apply the same change to the second call, a few lines below?


Hmm, yes, good catch.


Regards
--
^TM

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to