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

Diff for /src/usr.bin/ssh/ssh-keyscan.c between version 1.146 and 1.147

version 1.146, 2022/08/19 04:02:46 version 1.147, 2022/10/28 02:29:34
Line 44 
Line 44 
 #include "ssherr.h"  #include "ssherr.h"
 #include "ssh_api.h"  #include "ssh_api.h"
 #include "dns.h"  #include "dns.h"
   #include "addr.h"
   
 /* Flag indicating whether IPv4 or IPv6.  This can be set on the command line.  /* Flag indicating whether IPv4 or IPv6.  This can be set on the command line.
    Default value is AF_UNSPEC means both IPv4 and IPv6. */     Default value is AF_UNSPEC means both IPv4 and IPv6. */
Line 364 
Line 365 
 }  }
   
 static int  static int
 conalloc(char *iname, char *oname, int keytype)  conalloc(const char *iname, const char *oname, int keytype)
 {  {
         char *namebase, *name, *namelist;          char *namebase, *name, *namelist;
         int s;          int s;
Line 609 
Line 610 
 }  }
   
 static void  static void
 do_host(char *host)  do_one_host(char *host)
 {  {
         char *name = strnnsep(&host, " \t\n");          char *name = strnnsep(&host, " \t\n");
         int j;          int j;
Line 622 
Line 623 
                                 conloop();                                  conloop();
                         conalloc(name, *host ? host : name, j);                          conalloc(name, *host ? host : name, j);
                 }                  }
           }
   }
   
   static void
   do_host(char *host)
   {
           char daddr[128];
           struct xaddr addr, end_addr;
           u_int masklen;
   
           if (host == NULL)
                   return;
           if (addr_pton_cidr(host, &addr, &masklen) != 0) {
                   /* Assume argument is a hostname */
                   do_one_host(host);
           } else {
                   /* Argument is a CIDR range */
                   debug("CIDR range %s", host);
                   end_addr = addr;
                   if (addr_host_to_all1s(&end_addr, masklen) != 0)
                           goto badaddr;
                   /*
                    * Note: we deliberately include the all-zero/ones addresses.
                    */
                   for (;;) {
                           if (addr_ntop(&addr, daddr, sizeof(daddr)) != 0) {
    badaddr:
                                   error("Invalid address %s", host);
                                   return;
                           }
                           debug("CIDR expand: address %s", daddr);
                           do_one_host(daddr);
                           if (addr_cmp(&addr, &end_addr) == 0)
                                   break;
                           addr_increment(&addr);
                   };
         }          }
 }  }
   

Legend:
Removed from v.1.146  
changed lines
  Added in v.1.147