[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.1 and 1.2

version 1.1, 1999/09/26 20:53:34 version 1.2, 1999/09/29 21:14:16
Line 28 
Line 28 
   struct sockaddr_in from;    struct sockaddr_in from;
   int fromlen, i;    int fromlen, i;
   struct hostent *hp;    struct hostent *hp;
   char name[512];    char name[MAXHOSTNAMELEN];
   
   /* Get IP address of client. */    /* Get IP address of client. */
   fromlen = sizeof(from);    fromlen = sizeof(from);
Line 36 
Line 36 
   if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0)    if (getpeername(socket, (struct sockaddr *)&from, &fromlen) < 0)
     {      {
       error("getpeername failed: %.100s", strerror(errno));        error("getpeername failed: %.100s", strerror(errno));
       strcpy(name, "UNKNOWN");        strlcpy(name, "UNKNOWN", sizeof name);
       goto check_ip_options;        goto check_ip_options;
     }      }
   
Line 47 
Line 47 
     {      {
       /* Got host name, find canonic host name. */        /* Got host name, find canonic host name. */
       if (strchr(hp->h_name, '.') != 0)        if (strchr(hp->h_name, '.') != 0)
         strncpy(name, hp->h_name, sizeof(name));          strlcpy(name, hp->h_name, sizeof(name));
       else if (hp->h_aliases != 0        else if (hp->h_aliases != 0
                && hp->h_aliases[0] != 0                 && hp->h_aliases[0] != 0
                && strchr(hp->h_aliases[0], '.') != 0)                 && strchr(hp->h_aliases[0], '.') != 0)
         strncpy(name, hp->h_aliases[0], sizeof(name));          strlcpy(name, hp->h_aliases[0], sizeof(name));
       else        else
         strncpy(name, hp->h_name, sizeof(name));          strlcpy(name, hp->h_name, sizeof(name));
       name[sizeof(name) - 1] = '\0';  
   
       /* Convert it to all lowercase (which is expected by the rest of this        /* Convert it to all lowercase (which is expected by the rest of this
          software). */           software). */
Line 72 
Line 71 
       if (!hp)        if (!hp)
         {          {
           log("reverse mapping checking gethostbyname for %.700s failed - POSSIBLE BREAKIN ATTEMPT!", name);            log("reverse mapping checking gethostbyname for %.700s failed - POSSIBLE BREAKIN ATTEMPT!", name);
           strcpy(name, inet_ntoa(from.sin_addr));            strlcpy(name, inet_ntoa(from.sin_addr), sizeof name);
           goto check_ip_options;            goto check_ip_options;
         }          }
       /* Look for the address from the list of addresses. */        /* Look for the address from the list of addresses. */
Line 86 
Line 85 
           /* Address not found for the host name. */            /* Address not found for the host name. */
           log("Address %.100s maps to %.600s, but this does not map back to the address - POSSIBLE BREAKIN ATTEMPT!",            log("Address %.100s maps to %.600s, but this does not map back to the address - POSSIBLE BREAKIN ATTEMPT!",
               inet_ntoa(from.sin_addr), name);                inet_ntoa(from.sin_addr), name);
           strcpy(name, inet_ntoa(from.sin_addr));            strlcpy(name, inet_ntoa(from.sin_addr), sizeof name);
           goto check_ip_options;            goto check_ip_options;
         }          }
       /* Address was found for the host name.  We accept the host name. */        /* Address was found for the host name.  We accept the host name. */
Line 94 
Line 93 
   else    else
     {      {
       /* Host name not found.  Use ascii representation of the address. */        /* Host name not found.  Use ascii representation of the address. */
       strcpy(name, inet_ntoa(from.sin_addr));        strlcpy(name, inet_ntoa(from.sin_addr), sizeof name);
       log("Could not reverse map address %.100s.", name);        log("Could not reverse map address %.100s.", name);
     }      }
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2