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

Diff for /src/usr.bin/nc/netcat.c between version 1.219 and 1.220

version 1.219, 2022/06/08 20:07:31 version 1.220, 2022/12/18 12:45:34
Line 131 
Line 131 
 int     socks_connect(const char *, const char *, struct addrinfo,  int     socks_connect(const char *, const char *, struct addrinfo,
             const char *, const char *, struct addrinfo, int, const char *);              const char *, const char *, struct addrinfo, int, const char *);
 int     udptest(int);  int     udptest(int);
   void    connection_info(const char *, const char *, const char *);
 int     unix_bind(char *, int);  int     unix_bind(char *, int);
 int     unix_connect(char *);  int     unix_connect(char *);
 int     unix_listen(char *);  int     unix_listen(char *);
Line 153 
Line 154 
         char *host, *uport;          char *host, *uport;
         char ipaddr[NI_MAXHOST];          char ipaddr[NI_MAXHOST];
         struct addrinfo hints;          struct addrinfo hints;
         struct servent *sv;  
         socklen_t len;          socklen_t len;
         struct sockaddr_storage cliaddr;          struct sockaddr_storage cliaddr;
         char *proxy = NULL, *proxyport = NULL;          char *proxy = NULL, *proxyport = NULL;
Line 168 
Line 168 
         socksv = 5;          socksv = 5;
         host = NULL;          host = NULL;
         uport = NULL;          uport = NULL;
         sv = NULL;  
         Rflag = tls_default_ca_cert_file();          Rflag = tls_default_ca_cert_file();
   
         signal(SIGPIPE, SIG_IGN);          signal(SIGPIPE, SIG_IGN);
Line 709 
Line 708 
                                         }                                          }
                                 }                                  }
   
                                 /* Don't look up port if -n. */                                  connection_info(host, portlist[i], ipaddr);
                                 if (nflag)  
                                         sv = NULL;  
                                 else {  
                                         sv = getservbyport(  
                                             ntohs(atoi(portlist[i])),  
                                             uflag ? "udp" : "tcp");  
                                 }  
   
                                 fprintf(stderr, "Connection to %s", host);  
   
                                 /*  
                                  * if we aren't connecting thru a proxy and  
                                  * there is something to report, print IP  
                                  */  
                                 if (!nflag && !xflag &&  
                                     strcmp(host, ipaddr) != 0)  
                                         fprintf(stderr, " (%s)", ipaddr);  
   
                                 fprintf(stderr, " %s port [%s/%s] succeeded!\n",  
                                     portlist[i], uflag ? "udp" : "tcp",  
                                     sv ? sv->s_name : "*");  
                         }                          }
                         if (Fflag)                          if (Fflag)
                                 fdpass(s);                                  fdpass(s);
Line 1538 
Line 1516 
                         ret = -1;                          ret = -1;
         }          }
         return ret;          return ret;
   }
   
   void
   connection_info(const char *host, const char *port, const char *ipaddr)
   {
           struct servent *sv;
   
           /* Don't look up port if -n. */
           if (nflag)
                   sv = NULL;
           else {
                   sv = getservbyport(ntohs(atoi(port)), uflag ? "udp" : "tcp");
           }
   
           fprintf(stderr, "Connection to %s", host);
   
           /*
            * if we aren't connecting thru a proxy and
            * there is something to report, print IP
            */
           if (!nflag && !xflag && strcmp(host, ipaddr) != 0)
                   fprintf(stderr, " (%s)", ipaddr);
   
           fprintf(stderr, " %s port [%s/%s] succeeded!\n",
               port, uflag ? "udp" : "tcp", sv ? sv->s_name : "*");
 }  }
   
 void  void

Legend:
Removed from v.1.219  
changed lines
  Added in v.1.220