patch-xa_input_c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. $OpenBSD: patch-xa_input_c,v 1.1 2017/05/09 20:09:48 naddy Exp $
  2. Index: xa_input.c
  3. --- xa_input.c.orig
  4. +++ xa_input.c
  5. @@ -1025,49 +1025,49 @@ char *machine, *user_cmd, *passwd_cmd, *file_cmd;
  6. memset(&data,0,sizeof(data));
  7. memset(&from,0,sizeof(from));
  8. if (gethostname(hostname, sizeof(hostname)) < 0)
  9. - return(xa_ftp_abort(xin));
  10. + return(xa_ftp_abort(*xin));
  11. if ((host= (struct hostent *)gethostbyname(hostname)) == 0)
  12. - return(xa_ftp_abort(xin));
  13. + return(xa_ftp_abort(*xin));
  14. data.sin_family = host->h_addrtype;
  15. memcpy( (char *)&data.sin_addr, (char *)host->h_addr_list[0], host->h_length);
  16. if ((tmp_sock = socket ( AF_INET , SOCK_STREAM , 0 )) < 0)
  17. - return(xa_ftp_abort(xin));
  18. + return(xa_ftp_abort(*xin));
  19. len = 1;
  20. if (setsockopt(tmp_sock, SOL_SOCKET, SO_REUSEADDR,
  21. (char *)(&len), sizeof(len)) < 0)
  22. - { close(tmp_sock); return(xa_ftp_abort(xin)); }
  23. + { close(tmp_sock); return(xa_ftp_abort(*xin)); }
  24. data.sin_port = 0;
  25. if ( bind(tmp_sock, (struct sockaddr *)&data, sizeof(data)) < 0 )
  26. - { close(tmp_sock); return(xa_ftp_abort(xin)); }
  27. + { close(tmp_sock); return(xa_ftp_abort(*xin)); }
  28. len = sizeof(data);
  29. if (getsockname(tmp_sock, (struct sockaddr *)&data, &len) < 0 )
  30. - { close(tmp_sock); return(xa_ftp_abort(xin)); }
  31. + { close(tmp_sock); return(xa_ftp_abort(*xin)); }
  32. if (listen(tmp_sock, 4) < 0 )
  33. - { close(tmp_sock); return(xa_ftp_abort(xin)); }
  34. + { close(tmp_sock); return(xa_ftp_abort(*xin)); }
  35. /* POD add support for PORT command? */
  36. addr = (xaUBYTE *) (&data.sin_addr);
  37. port = (xaUBYTE *) (&data.sin_port);
  38. - sprintf(port_cmd,"PORT %d,%d,%d,%d,%d,%d\0",
  39. + sprintf(port_cmd,"PORT %d,%d,%d,%d,%d,%d",
  40. (addr[0] & 0xff), (addr[1] & 0xff),
  41. (addr[2] & 0xff), (addr[3] & 0xff),
  42. (port[0] & 0xff), (port[1] & 0xff) );
  43. if (xa_ftp_send_cmd(xin, port_cmd, &retcode) == xaFALSE)
  44. { fprintf(stderr,"FTP: send cmd err\n");
  45. - close(tmp_sock); return(xa_ftp_abort(xin)); }
  46. + close(tmp_sock); return(xa_ftp_abort(*xin)); }
  47. if (xa_ftp_send_cmd(xin, file_cmd, &retcode) == xaFALSE)
  48. { fprintf(stderr,"FTP: send cmd err\n");
  49. - close(tmp_sock); return(xa_ftp_abort(xin)); }
  50. + close(tmp_sock); return(xa_ftp_abort(*xin)); }
  51. len = sizeof(from);
  52. xin->dsock = accept((int)tmp_sock, (struct sockaddr *) &from, (int *)&len);
  53. - if (xin->dsock < 0) { close(tmp_sock); return(xa_ftp_abort(xin)); }
  54. + if (xin->dsock < 0) { close(tmp_sock); return(xa_ftp_abort(*xin)); }
  55. close(tmp_sock);
  56. return(xaTRUE);
  57. }