ftp does not close socket descriptor (See #174599)

This commit is contained in:
praszyk 2005-12-02 14:51:35 +00:00
parent 2f28aa5eb3
commit 4ca5a3037c
2 changed files with 32 additions and 1 deletions

View File

@ -1,7 +1,7 @@
Summary: The standard UNIX FTP (File Transfer Protocol) client.
Name: ftp
Version: 0.17
Release: 30
Release: 31
License: BSD
Group: Applications/Internet
Source0: ftp://ftp.uk.linux.org/pub/linux/Networking/netkit-devel/netkit-ftp-%{version}.tar.bz2
@ -16,6 +16,7 @@ Patch8: netkit-ftp-0.17-printf.patch
Patch9: netkit-ftp-0.17-longint.patch
Patch10: netkit-ftp-0.17-vsftp165083.patch
Patch11: netkit-ftp-0.17-C-Frame121.patch
Patch12: netkit-ftp-0.17-data.patch
BuildRoot: /var/tmp/%{name}-root
BuildRequires: gcc, glibc-devel, readline-devel, ncurses-devel, perl
@ -40,6 +41,7 @@ file transfers.
%patch9 -p1 -b .longint
%patch10 -p1 -b .vsftp165083
%patch11 -p1 -b .C-Frame121
%patch12 -p1 -b .data
%build
sh configure --with-c-compiler=gcc --enable-ipv6
@ -73,6 +75,11 @@ rm -rf ${RPM_BUILD_ROOT}
%{_mandir}/man5/netrc.*
%changelog
* Fri Dec 2 2005 Petr Raszyk <praszyk@redhat.com> - 0.17-31
- ftp does not close socket descriptor (if the remote file
does not exist).
See #174599, netkit-ftp-0.17-data.patch
* Wed Oct 26 2005 Petr Raszyk <praszyk@redhat.com> - 0.17-30
- The patch netkit-ftp-0.17-C-Frame121.patch adds some
comments/hints for C-Frame 121. It can be removed any time.

View File

@ -0,0 +1,24 @@
--- netkit-ftp-0.17/ftp/ftp.c.data 2005-12-02 15:31:27.000000000 +0100
+++ netkit-ftp-0.17/ftp/ftp.c 2005-12-02 15:35:46.000000000 +0100
@@ -1223,6 +1223,7 @@
static int
initconn(void)
{
+ int rc;
u_char *p, *a;
int result, tmpno = 0;
socklen_t len;
@@ -1240,6 +1241,13 @@
}
#endif
if (passivemode) {
+ if (data >= 0){
+ rc = close (data);
+ data = -1;
+ if (rc == -1){
+ perror ("ftp: close");
+ }
+ }
data_addr = hisctladdr;
data = socket(data_addr.su_family, SOCK_STREAM, 0);
if (data < 0) {