SHA256
1
0
forked from pool/vsftpd
OBS User unknown 2008-06-25 22:23:20 +00:00 committed by Git OBS Bridge
parent a1d374a745
commit e6d7caf088
4 changed files with 155 additions and 1 deletions

@ -0,0 +1,73 @@
--- vsftpd-2.0.4/standalone.c.listen-retry 2008-05-14 11:56:57.775023643 -0700
+++ vsftpd-2.0.4/standalone.c 2008-05-14 12:11:16.501225812 -0700
@@ -130,7 +130,11 @@
die("could not bind listening IPv6 socket");
}
}
- vsf_sysutil_listen(listen_sock, VSFTP_LISTEN_BACKLOG);
+ retval = vsf_sysutil_listen(listen_sock, VSFTP_LISTEN_BACKLOG);
+ if (vsf_sysutil_retval_is_error(retval))
+ {
+ die("could not listen");
+ }
vsf_sysutil_sockaddr_alloc(&p_accept_addr);
while (1)
{
--- vsftpd-2.0.4/sysutil.h.listen-retry 2008-05-14 11:55:58.851165197 -0700
+++ vsftpd-2.0.4/sysutil.h 2008-05-14 12:07:08.357934466 -0700
@@ -239,7 +239,7 @@
struct vsf_sysutil_socketpair_retval
vsf_sysutil_unix_stream_socketpair(void);
int vsf_sysutil_bind(int fd, const struct vsf_sysutil_sockaddr* p_sockptr);
-void vsf_sysutil_listen(int fd, const unsigned int backlog);
+int vsf_sysutil_listen(int fd, const unsigned int backlog);
void vsf_sysutil_getsockname(int fd, struct vsf_sysutil_sockaddr** p_sockptr);
void vsf_sysutil_getpeername(int fd, struct vsf_sysutil_sockaddr** p_sockptr);
int vsf_sysutil_accept_timeout(int fd, struct vsf_sysutil_sockaddr* p_sockaddr,
--- vsftpd-2.0.4/postlogin.c.listen-retry 2008-05-14 11:54:22.182803066 -0700
+++ vsftpd-2.0.4/postlogin.c 2008-05-14 12:14:08.116688582 -0700
@@ -555,7 +555,11 @@
retval = vsf_sysutil_bind(p_sess->pasv_listen_fd, s_p_sockaddr);
if (!vsf_sysutil_retval_is_error(retval))
{
- break;
+ retval = vsf_sysutil_listen(p_sess->pasv_listen_fd, 1);
+ if (!vsf_sysutil_retval_is_error(retval))
+ {
+ break;
+ }
}
if (vsf_sysutil_get_error() == kVSFSysUtilErrADDRINUSE)
{
@@ -567,7 +571,6 @@
{
die("vsf_sysutil_bind");
}
- vsf_sysutil_listen(p_sess->pasv_listen_fd, 1);
if (is_epsv)
{
str_alloc_text(&s_pasv_res_str, "Entering Extended Passive Mode (|||");
--- vsftpd-2.0.4/sysutil.c.listen-retry 2006-01-09 09:05:18.000000000 -0800
+++ vsftpd-2.0.4/sysutil.c 2008-05-14 12:06:41.211606698 -0700
@@ -1614,14 +1614,18 @@
return bind(fd, p_sockaddr, len);
}
-void
+int
vsf_sysutil_listen(int fd, const unsigned int backlog)
{
int retval = listen(fd, backlog);
- if (retval != 0)
+ if (vsf_sysutil_retval_is_error(retval))
{
- die("listen");
+ if (vsf_sysutil_get_error() != kVSFSysUtilErrADDRINUSE)
+ {
+ die("listen");
+ }
}
+ return(retval);
}
/* Warning: callers of this function assume it does NOT make use of any

@ -0,0 +1,68 @@
diff -up vsftpd-2.0.5/sysutil.h.write_race vsftpd-2.0.5/sysutil.h
--- vsftpd-2.0.5/sysutil.h.write_race 2007-11-21 08:48:28.000000000 +0100
+++ vsftpd-2.0.5/sysutil.h 2007-11-21 08:48:28.000000000 +0100
@@ -91,6 +91,8 @@ void vsf_sysutil_close(int fd);
int vsf_sysutil_close_failok(int fd);
int vsf_sysutil_unlink(const char* p_dead);
int vsf_sysutil_write_access(const char* p_filename);
+/* Trucate after open */
+int vsf_sysutil_truncate(int fd, filesize_t length);
/* Reading and writing */
void vsf_sysutil_lseek_to(const int fd, filesize_t seek_pos);
diff -up vsftpd-2.0.5/postlogin.c.write_race vsftpd-2.0.5/postlogin.c
--- vsftpd-2.0.5/postlogin.c.write_race 2007-11-21 08:48:28.000000000 +0100
+++ vsftpd-2.0.5/postlogin.c 2007-11-21 08:51:59.000000000 +0100
@@ -953,6 +953,7 @@ handle_upload_common(struct vsf_session*
struct vsf_transfer_ret trans_ret;
int new_file_fd;
int remote_fd;
+ int truncit = 0;
filesize_t offset = p_sess->restart_pos;
p_sess->restart_pos = 0;
if (!data_transfer_checks_ok(p_sess))
@@ -987,7 +988,15 @@ handle_upload_common(struct vsf_session*
/* For non-anonymous, allow open() to overwrite or append existing files */
if (!is_append && offset == 0)
{
- new_file_fd = str_create_overwrite(p_filename);
+ if (tunable_lock_upload_files)
+ {
+ new_file_fd = str_create_append(p_filename);
+ truncit = 1;
+ }
+ else
+ {
+ new_file_fd = str_create_overwrite(p_filename);
+ }
}
else
{
@@ -1023,6 +1032,11 @@ handle_upload_common(struct vsf_session*
if (tunable_lock_upload_files)
{
vsf_sysutil_lock_file_write(new_file_fd);
+ if (truncit)
+ {
+ vsf_sysutil_truncate(new_file_fd, 0);
+ vsf_sysutil_lseek_to(new_file_fd, 0);
+ }
}
if (!is_append && offset != 0)
{
diff -up vsftpd-2.0.5/sysutil.c.write_race vsftpd-2.0.5/sysutil.c
--- vsftpd-2.0.5/sysutil.c.write_race 2007-11-21 08:48:28.000000000 +0100
+++ vsftpd-2.0.5/sysutil.c 2007-11-21 08:48:28.000000000 +0100
@@ -1196,6 +1196,12 @@ vsf_sysutil_close_failok(int fd)
}
int
+vsf_sysutil_truncate(int fd, filesize_t length)
+{
+ return ftruncate(fd, length);
+}
+
+int
vsf_sysutil_unlink(const char* p_dead)
{
return unlink(p_dead);

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jun 11 12:44:25 CEST 2008 - hvogel@suse.de
- Fix simultaneous ftp put of the same file [bnc#361559, bnc#273454]
- dont die on EADDRINUSE but try again [bnc#395899]
-------------------------------------------------------------------
Fri May 2 10:08:03 CEST 2008 - tiwai@suse.de

@ -19,7 +19,7 @@ BuildRequires: libcap
BuildRequires: libcap-devel
%endif
Version: 2.0.6
Release: 18
Release: 27
Summary: Very Secure FTP Daemon - Written from Scratch
License: GPL v2 or later
Group: Productivity/Networking/Ftp/Servers
@ -41,6 +41,8 @@ Patch6: %name-2.0.5-vuser.patch
Patch7: %name-2.0.5-enable-debuginfo.patch
Patch8: %name-2.0.5-utf8-log-names.patch
Patch9: %name-2.0.6-libcap2-fix.diff
Patch10: %name-2.0.6-write_race.patch
Patch11: %name-2.0.6-listen-retry.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: ftp-server
PreReq: %insserv_prereq /usr/sbin/useradd
@ -74,6 +76,8 @@ Authors:
%patch7
%patch8 -p1
%patch9
%patch10 -p1
%patch11 -p1
%build
rm -f dummyinc/sys/capability.h
@ -129,6 +133,9 @@ rm -rf $RPM_BUILD_ROOT
%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
%changelog
* Wed Jun 11 2008 hvogel@suse.de
- Fix simultaneous ftp put of the same file [bnc#361559, bnc#273454]
- dont die on EADDRINUSE but try again [bnc#395899]
* Fri May 02 2008 tiwai@suse.de
- fix the link with libcap2
* Wed Apr 30 2008 hvogel@suse.de