[BACK]Return to canohost.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/canohost.c between version 1.41 and 1.41.2.2

version 1.41, 2004/07/21 11:51:29 version 1.41.2.2, 2005/09/02 03:44:59
Line 137 
Line 137 
         u_char options[200];          u_char options[200];
         char text[sizeof(options) * 3 + 1];          char text[sizeof(options) * 3 + 1];
         socklen_t option_size;          socklen_t option_size;
         int i, ipproto;          u_int i;
           int ipproto;
         struct protoent *ip;          struct protoent *ip;
   
         if ((ip = getprotobyname("ip")) != NULL)          if ((ip = getprotobyname("ip")) != NULL)
Line 199 
Line 200 
         struct sockaddr_storage addr;          struct sockaddr_storage addr;
         socklen_t addrlen;          socklen_t addrlen;
         char ntop[NI_MAXHOST];          char ntop[NI_MAXHOST];
           int r;
   
         /* Get IP address of client. */          /* Get IP address of client. */
         addrlen = sizeof(addr);          addrlen = sizeof(addr);
Line 214 
Line 216 
                         return NULL;                          return NULL;
         }          }
         /* Get the address in ascii. */          /* Get the address in ascii. */
         if (getnameinfo((struct sockaddr *)&addr, addrlen, ntop, sizeof(ntop),          if ((r = getnameinfo((struct sockaddr *)&addr, addrlen, ntop,
             NULL, 0, flags) != 0) {              sizeof(ntop), NULL, 0, flags)) != 0) {
                 error("get_socket_address: getnameinfo %d failed", flags);                  error("get_socket_address: getnameinfo %d failed: %s", flags,
                       r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r));
                 return NULL;                  return NULL;
         }          }
         return xstrdup(ntop);          return xstrdup(ntop);
Line 292 
Line 295 
         struct sockaddr_storage from;          struct sockaddr_storage from;
         socklen_t fromlen;          socklen_t fromlen;
         char strport[NI_MAXSERV];          char strport[NI_MAXSERV];
           int r;
   
         /* Get IP address of client. */          /* Get IP address of client. */
         fromlen = sizeof(from);          fromlen = sizeof(from);
Line 304 
Line 308 
         } else {          } else {
                 if (getpeername(sock, (struct sockaddr *)&from, &fromlen) < 0) {                  if (getpeername(sock, (struct sockaddr *)&from, &fromlen) < 0) {
                         debug("getpeername failed: %.100s", strerror(errno));                          debug("getpeername failed: %.100s", strerror(errno));
                         cleanup_exit(255);                          return -1;
                 }                  }
         }          }
         /* Return port number. */          /* Return port number. */
         if (getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0,          if ((r = getnameinfo((struct sockaddr *)&from, fromlen, NULL, 0,
             strport, sizeof(strport), NI_NUMERICSERV) != 0)              strport, sizeof(strport), NI_NUMERICSERV)) != 0)
                 fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed");                  fatal("get_sock_port: getnameinfo NI_NUMERICSERV failed: %s",
                       r == EAI_SYSTEM ? strerror(errno) : gai_strerror(r));
         return atoi(strport);          return atoi(strport);
 }  }
   

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.41.2.2