SHA256
1
0
forked from pool/vsftpd
vsftpd/vsftpd-2.0.6-listen-retry.patch

74 lines
2.5 KiB
Diff

--- 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