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

Diff for /src/usr.bin/ssh/packet.c between version 1.270 and 1.271

version 1.270, 2018/05/25 03:20:59 version 1.271, 2018/06/01 04:05:29
Line 412 
Line 412 
 int  int
 ssh_packet_connection_is_on_socket(struct ssh *ssh)  ssh_packet_connection_is_on_socket(struct ssh *ssh)
 {  {
         struct session_state *state = ssh->state;          struct session_state *state;
         struct sockaddr_storage from, to;          struct sockaddr_storage from, to;
         socklen_t fromlen, tolen;          socklen_t fromlen, tolen;
   
         if (state->connection_in == -1 || state->connection_out == -1)          if (ssh == NULL || ssh->state == NULL)
                 return 0;                  return 0;
   
           state = ssh->state;
           if (state->connection_in == -1 || state->connection_out == -1)
                   return 0;
         /* filedescriptors in and out are the same, so it's a socket */          /* filedescriptors in and out are the same, so it's a socket */
         if (state->connection_in == state->connection_out)          if (state->connection_in == state->connection_out)
                 return 1;                  return 1;
Line 497 
Line 500 
 const char *  const char *
 ssh_remote_ipaddr(struct ssh *ssh)  ssh_remote_ipaddr(struct ssh *ssh)
 {  {
         const int sock = ssh->state->connection_in;          int sock;
   
         /* Check whether we have cached the ipaddr. */          /* Check whether we have cached the ipaddr. */
         if (ssh->remote_ipaddr == NULL) {          if (ssh->remote_ipaddr == NULL) {
                 if (ssh_packet_connection_is_on_socket(ssh)) {                  if (ssh_packet_connection_is_on_socket(ssh)) {
                           sock = ssh->state->connection_in;
                         ssh->remote_ipaddr = get_peer_ipaddr(sock);                          ssh->remote_ipaddr = get_peer_ipaddr(sock);
                         ssh->remote_port = get_peer_port(sock);                          ssh->remote_port = get_peer_port(sock);
                         ssh->local_ipaddr = get_local_ipaddr(sock);                          ssh->local_ipaddr = get_local_ipaddr(sock);

Legend:
Removed from v.1.270  
changed lines
  Added in v.1.271