* fake-addrinfo.h (getaddrinfo) [NUMERIC_SERVICE_BROKEN]: Overwrite the port
authorKen Raeburn <raeburn@mit.edu>
Mon, 7 Apr 2003 20:55:18 +0000 (20:55 +0000)
committerKen Raeburn <raeburn@mit.edu>
Mon, 7 Apr 2003 20:55:18 +0000 (20:55 +0000)
number only if a numeric service port was supplied.

ticket: 1392
status: open
target_version: 1.3

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15324 dc483132-0cff-0310-8789-dd5450dbe970

src/include/ChangeLog
src/include/fake-addrinfo.h

index 954fd43440bb0384f167f5c2a8e5fea4616dc3ee..fea9e3ee1fcdc5830b942e603349919b7ccf4b35 100644 (file)
@@ -1,3 +1,9 @@
+2003-04-07  Ken Raeburn  <raeburn@mit.edu>
+
+       * fake-addrinfo.h (getaddrinfo) [NUMERIC_SERVICE_BROKEN]:
+       Overwrite the port number only if a numeric service port was
+       supplied.
+
 2003-04-01  Ken Raeburn  <raeburn@mit.edu>
 
        * fake-addrinfo.h (COPY_FIRST_CANONNAME) [_AIX]: Define.
index 7474543fcd743273b980c876716c00553d41558b..b019c3823428079c864c1687e8201f326321f9a5 100644 (file)
@@ -1055,17 +1055,19 @@ getaddrinfo (const char *name, const char *serv, const struct addrinfo *hint,
 #endif
 
 #ifdef NUMERIC_SERVICE_BROKEN
-    for (ai = *result; ai; ai = ai->ai_next) {
-       if (socket_type != 0 && ai->ai_socktype == 0)
-           /* Is this check actually needed?  */
-           ai->ai_socktype = socket_type;
-       switch (ai->ai_family) {
-       case AF_INET:
-           ((struct sockaddr_in *)ai->ai_addr)->sin_port = service_port;
-           break;
-       case AF_INET6:
-           ((struct sockaddr_in6 *)ai->ai_addr)->sin6_port = service_port;
-           break;
+    if (service_port != 0) {
+       for (ai = *result; ai; ai = ai->ai_next) {
+           if (socket_type != 0 && ai->ai_socktype == 0)
+               /* Is this check actually needed?  */
+               ai->ai_socktype = socket_type;
+           switch (ai->ai_family) {
+           case AF_INET:
+               ((struct sockaddr_in *)ai->ai_addr)->sin_port = service_port;
+               break;
+           case AF_INET6:
+               ((struct sockaddr_in6 *)ai->ai_addr)->sin6_port = service_port;
+               break;
+           }
        }
     }
 #endif