[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.194 and 1.195

version 1.194, 2018/09/07 09:55:29 version 1.195, 2018/10/04 17:04:50
Line 543 
Line 543 
                         err(1, "pledge");                          err(1, "pledge");
         }          }
         if (lflag) {          if (lflag) {
                 struct tls *tls_cctx = NULL;  
                 int connfd;  
                 ret = 0;                  ret = 0;
   
                 if (family == AF_UNIX) {                  if (family == AF_UNIX) {
Line 603 
Line 601 
   
                                 readwrite(s, NULL);                                  readwrite(s, NULL);
                         } else {                          } else {
                                   struct tls *tls_cctx = NULL;
                                   int connfd;
   
                                 len = sizeof(cliaddr);                                  len = sizeof(cliaddr);
                                 connfd = accept4(s, (struct sockaddr *)&cliaddr,                                  connfd = accept4(s, (struct sockaddr *)&cliaddr,
                                     &len, SOCK_NONBLOCK);                                      &len, SOCK_NONBLOCK);
Line 618 
Line 619 
                                         readwrite(connfd, tls_cctx);                                          readwrite(connfd, tls_cctx);
                                 if (!usetls)                                  if (!usetls)
                                         readwrite(connfd, NULL);                                          readwrite(connfd, NULL);
                                 if (tls_cctx) {                                  if (tls_cctx)
                                         timeout_tls(s, tls_cctx, tls_close);                                          timeout_tls(s, tls_cctx, tls_close);
                                         tls_free(tls_cctx);  
                                         tls_cctx = NULL;  
                                 }  
                                 close(connfd);                                  close(connfd);
                                   tls_free(tls_cctx);
                         }                          }
                         if (family == AF_UNIX && uflag) {                          if (family == AF_UNIX && uflag) {
                                 if (connect(s, NULL, 0) < 0)                                  if (connect(s, NULL, 0) < 0)
Line 657 
Line 656 
                 for (s = -1, i = 0; portlist[i] != NULL; i++) {                  for (s = -1, i = 0; portlist[i] != NULL; i++) {
                         if (s != -1)                          if (s != -1)
                                 close(s);                                  close(s);
                           tls_free(tls_ctx);
                           tls_ctx = NULL;
   
                         if (usetls) {                          if (usetls) {
                                 if ((tls_ctx = tls_client()) == NULL)                                  if ((tls_ctx = tls_client()) == NULL)
Line 707 
Line 708 
                                         tls_setup_client(tls_ctx, s, host);                                          tls_setup_client(tls_ctx, s, host);
                                 if (!zflag)                                  if (!zflag)
                                         readwrite(s, tls_ctx);                                          readwrite(s, tls_ctx);
                                 if (tls_ctx) {                                  if (tls_ctx)
                                         timeout_tls(s, tls_ctx, tls_close);                                          timeout_tls(s, tls_ctx, tls_close);
                                         tls_free(tls_ctx);  
                                         tls_ctx = NULL;  
                                 }  
                         }                          }
                 }                  }
         }          }
   
         if (s != -1)          if (s != -1)
                 close(s);                  close(s);
           tls_free(tls_ctx);
         tls_config_free(tls_cfg);          tls_config_free(tls_cfg);
   
         return ret;          return ret;

Legend:
Removed from v.1.194  
changed lines
  Added in v.1.195