diff --git a/.cvsignore b/.cvsignore index effa13d..97866b8 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -vsftpd-2.1.0.tar.gz +vsftpd-2.1.1pre1.tar.gz diff --git a/sources b/sources index 200e624..cfb82bf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -7890b54e7ffa6106ffbdfda53f47fa41 vsftpd-2.1.0.tar.gz +ea57505bf438eef6d4f53d4dc7fe8574 vsftpd-2.1.1pre1.tar.gz diff --git a/vsftpd-2.1.0-trim.patch b/vsftpd-2.1.0-trim.patch new file mode 100644 index 0000000..ce9b65d --- /dev/null +++ b/vsftpd-2.1.0-trim.patch @@ -0,0 +1,78 @@ +diff -up vsftpd-2.1.0/parseconf.c.trim vsftpd-2.1.0/parseconf.c +--- vsftpd-2.1.0/parseconf.c.trim 2009-03-24 15:50:47.000000000 +0100 ++++ vsftpd-2.1.0/parseconf.c 2009-03-24 15:51:10.000000000 +0100 +@@ -273,7 +273,7 @@ handle_config_setting(struct mystr* p_se + } + else + { +- *p_curr_setting = str_strdup(p_value_str); ++ *p_curr_setting = str_strdup_trimmed(p_value_str); + } + return; + } +diff -up vsftpd-2.1.0/str.c.trim vsftpd-2.1.0/str.c +--- vsftpd-2.1.0/str.c.trim 2009-03-24 15:50:34.000000000 +0100 ++++ vsftpd-2.1.0/str.c 2009-03-24 15:54:07.000000000 +0100 +@@ -89,6 +89,18 @@ str_strdup(const struct mystr* p_str) + return vsf_sysutil_strdup(str_getbuf(p_str)); + } + ++const char* ++str_strdup_trimmed(const struct mystr* p_str) ++{ ++ const char* p_trimmed = str_getbuf(p_str); ++ int h, t, newlen; ++ ++ for (h = 0; h < (int)str_getlen(p_str) && vsf_sysutil_isspace(p_trimmed[h]); h++) ; ++ for (t = str_getlen(p_str) - 1; t >= 0 && vsf_sysutil_isspace(p_trimmed[t]); t--) ; ++ newlen = t - h + 1; ++ return newlen ? vsf_sysutil_strndup(p_trimmed+h, (unsigned int)newlen) : 0L; ++} ++ + void + str_alloc_alt_term(struct mystr* p_str, const char* p_src, char term) + { +diff -up vsftpd-2.1.0/str.h.trim vsftpd-2.1.0/str.h +--- vsftpd-2.1.0/str.h.trim 2009-03-24 15:50:31.000000000 +0100 ++++ vsftpd-2.1.0/str.h 2009-03-24 15:51:48.000000000 +0100 +@@ -31,6 +31,7 @@ void str_alloc_ulong(struct mystr* p_str + void str_alloc_filesize_t(struct mystr* p_str, filesize_t the_filesize); + void str_copy(struct mystr* p_dest, const struct mystr* p_src); + const char* str_strdup(const struct mystr* p_str); ++const char* str_strdup_trimmed(const struct mystr* p_str); + void str_empty(struct mystr* p_str); + void str_free(struct mystr* p_str); + void str_trunc(struct mystr* p_str, unsigned int trunc_len); +diff -up vsftpd-2.1.0/sysutil.c.trim vsftpd-2.1.0/sysutil.c +--- vsftpd-2.1.0/sysutil.c.trim 2009-03-24 15:50:19.000000000 +0100 ++++ vsftpd-2.1.0/sysutil.c 2009-03-24 15:52:53.000000000 +0100 +@@ -1031,6 +1031,18 @@ vsf_sysutil_strdup(const char* p_str) + return strdup(p_str); + } + ++char* ++vsf_sysutil_strndup(const char* p_str, unsigned int p_len) ++{ ++ char *new = (char *)malloc(p_len+1); ++ ++ if (new == NULL) ++ return NULL; ++ ++ new[p_len]='\0'; ++ return (char *)memcpy(new, p_str, p_len); ++} ++ + void + vsf_sysutil_memclr(void* p_dest, unsigned int size) + { +diff -up vsftpd-2.1.0/sysutil.h.trim vsftpd-2.1.0/sysutil.h +--- vsftpd-2.1.0/sysutil.h.trim 2009-03-24 15:50:23.000000000 +0100 ++++ vsftpd-2.1.0/sysutil.h 2009-03-24 15:52:14.000000000 +0100 +@@ -184,6 +184,7 @@ int vsf_sysutil_wait_get_exitcode( + /* Various string functions */ + unsigned int vsf_sysutil_strlen(const char* p_text); + char* vsf_sysutil_strdup(const char* p_str); ++char* vsf_sysutil_strndup(const char* p_str, unsigned int p_len); + void vsf_sysutil_memclr(void* p_dest, unsigned int size); + void vsf_sysutil_memcpy(void* p_dest, const void* p_src, + const unsigned int size); diff --git a/vsftpd-2.1.0-userlistdelay.patch b/vsftpd-2.1.0-userlistdelay.patch new file mode 100644 index 0000000..df8a415 --- /dev/null +++ b/vsftpd-2.1.0-userlistdelay.patch @@ -0,0 +1,11 @@ +diff -pruN vsftpd-2.1.0.orig/prelogin.c vsftpd-2.1.0/prelogin.c +--- vsftpd-2.1.0.orig/prelogin.c 2009-04-12 16:00:09.000000000 +0200 ++++ vsftpd-2.1.0/prelogin.c 2009-04-12 16:13:57.000000000 +0200 +@@ -217,6 +217,7 @@ handle_user_command(struct vsf_session* + if ((located && tunable_userlist_deny) || + (!located && !tunable_userlist_deny)) + { ++ check_login_delay(); + vsf_cmdio_write(p_sess, FTP_LOGINERR, "Permission denied."); + check_login_fails(p_sess); + if (tunable_userlist_log) diff --git a/vsftpd-2.1.1-daemonize_plus.patch b/vsftpd-2.1.1-daemonize_plus.patch new file mode 100644 index 0000000..17547a1 --- /dev/null +++ b/vsftpd-2.1.1-daemonize_plus.patch @@ -0,0 +1,175 @@ +diff -up vsftpd-2.1.1/standalone.c.daemonize_plus vsftpd-2.1.1/standalone.c +--- vsftpd-2.1.1/standalone.c.daemonize_plus 2009-04-29 17:46:52.000000000 +0200 ++++ vsftpd-2.1.1/standalone.c 2009-04-29 17:46:52.000000000 +0200 +@@ -26,6 +26,8 @@ static unsigned int s_ipaddr_size; + + static void handle_sigchld(void* duff); + static void handle_sighup(void* duff); ++static void handle_sigusr1(int sig); ++static void handle_sigalrm(int sig); + static void prepare_child(int sockfd); + static unsigned int handle_ip_count(void* p_raw_addr); + static void drop_ip_count(void* p_raw_addr); +@@ -50,7 +52,13 @@ vsf_standalone_main(void) + if (forkret > 0) + { + /* Parent, just exit */ +- vsf_sysutil_exit(0); ++ vsf_sysutil_sigaction(kVSFSysUtilSigALRM, handle_sigalrm); ++ vsf_sysutil_sigaction(kVSFSysUtilSigUSR1, handle_sigusr1); ++ ++ vsf_sysutil_set_alarm(3); ++ vsf_sysutil_pause(); ++ ++ vsf_sysutil_exit(1); + } + /* Son, close standard FDs to avoid SSH hang-on-exit */ + vsf_sysutil_reopen_standard_fds(); +@@ -98,6 +106,10 @@ vsf_standalone_main(void) + { + die("could not bind listening IPv4 socket"); + } ++ else ++ { ++ vsf_sysutil_kill(vsf_sysutil_getppid(), kVSFSysUtilSigUSR1); ++ } + } + else + { +@@ -127,6 +139,10 @@ vsf_standalone_main(void) + { + die("could not bind listening IPv6 socket"); + } ++ else ++ { ++ vsf_sysutil_kill(vsf_sysutil_getppid(), kVSFSysUtilSigUSR1); ++ } + } + vsf_sysutil_close(0); + vsf_sysutil_close(1); +@@ -252,6 +268,20 @@ handle_sighup(void* duff) + vsf_parseconf_load_file(0, 0); + } + ++static void ++handle_sigalrm(int sig) ++{ ++ (void)sig; // avoid unused parameter error ++ vsf_sysutil_exit(1); ++} ++ ++static void ++handle_sigusr1(int sig) ++{ ++ (void)sig; // avoid unused parameter error ++ vsf_sysutil_exit(0); ++} ++ + static unsigned int + hash_ip(unsigned int buckets, void* p_key) + { +diff -up vsftpd-2.1.1/sysutil.c.daemonize_plus vsftpd-2.1.1/sysutil.c +--- vsftpd-2.1.1/sysutil.c.daemonize_plus 2009-02-26 02:44:29.000000000 +0100 ++++ vsftpd-2.1.1/sysutil.c 2009-04-29 17:46:52.000000000 +0200 +@@ -201,6 +201,9 @@ vsf_sysutil_translate_sig(const enum EVS + case kVSFSysUtilSigHUP: + realsig = SIGHUP; + break; ++ case kVSFSysUtilSigUSR1: ++ realsig = SIGUSR1; ++ break; + default: + bug("unknown signal in vsf_sysutil_translate_sig"); + break; +@@ -538,6 +541,12 @@ vsf_sysutil_getpid(void) + return (unsigned int) s_current_pid; + } + ++unsigned int ++vsf_sysutil_getppid(void) ++{ ++ return (unsigned int)getppid(); ++} ++ + int + vsf_sysutil_fork(void) + { +@@ -1031,6 +1040,18 @@ vsf_sysutil_strdup(const char* p_str) + return strdup(p_str); + } + ++char* ++vsf_sysutil_strndup(const char* p_str, unsigned int p_len) ++{ ++ char *new = (char *)malloc(p_len+1); ++ ++ if (new == NULL) ++ return NULL; ++ ++ new[p_len]='\0'; ++ return (char *)memcpy(new, p_str, p_len); ++} ++ + void + vsf_sysutil_memclr(void* p_dest, unsigned int size) + { +@@ -2774,3 +2795,23 @@ vsf_sysutil_set_no_fds() + die("setrlimit NOFILE"); + } + } ++ ++void ++vsf_sysutil_sigaction(const enum EVSFSysUtilSignal sig, void (*p_handlefunc)(int)) ++{ ++ int realsig = vsf_sysutil_translate_sig(sig); ++ vsf_sysutil_set_sighandler(realsig, p_handlefunc); ++} ++ ++int ++vsf_sysutil_kill(int pid, int sig) ++{ ++ int realsig = vsf_sysutil_translate_sig(sig); ++ return kill(pid, realsig); ++} ++ ++int ++vsf_sysutil_pause() ++{ ++ return pause(); ++} +diff -up vsftpd-2.1.1/sysutil.h.daemonize_plus vsftpd-2.1.1/sysutil.h +--- vsftpd-2.1.1/sysutil.h.daemonize_plus 2009-02-26 02:47:41.000000000 +0100 ++++ vsftpd-2.1.1/sysutil.h 2009-04-29 17:46:52.000000000 +0200 +@@ -29,7 +29,8 @@ enum EVSFSysUtilSignal + kVSFSysUtilSigCHLD, + kVSFSysUtilSigPIPE, + kVSFSysUtilSigURG, +- kVSFSysUtilSigHUP ++ kVSFSysUtilSigHUP, ++ kVSFSysUtilSigUSR1 + }; + enum EVSFSysUtilInterruptContext + { +@@ -164,6 +165,7 @@ void vsf_sysutil_free(void* p_ptr); + + /* Process creation/exit/process handling */ + unsigned int vsf_sysutil_getpid(void); ++unsigned int vsf_sysutil_getppid(void); + int vsf_sysutil_fork(void); + int vsf_sysutil_fork_failok(void); + void vsf_sysutil_exit(int exit_code); +@@ -180,10 +182,14 @@ int vsf_sysutil_wait_exited_normally( + const struct vsf_sysutil_wait_retval* p_waitret); + int vsf_sysutil_wait_get_exitcode( + const struct vsf_sysutil_wait_retval* p_waitret); ++void vsf_sysutil_sigaction(const enum EVSFSysUtilSignal sig, void (*p_handlefunc)(int)); ++int vsf_sysutil_kill(int pid, int sig); ++int vsf_sysutil_pause(); + + /* Various string functions */ + unsigned int vsf_sysutil_strlen(const char* p_text); + char* vsf_sysutil_strdup(const char* p_str); ++char* vsf_sysutil_strndup(const char* p_str, unsigned int p_len); + void vsf_sysutil_memclr(void* p_dest, unsigned int size); + void vsf_sysutil_memcpy(void* p_dest, const void* p_src, + const unsigned int size); diff --git a/vsftpd.spec b/vsftpd.spec index f30ead7..fbc2604 100644 --- a/vsftpd.spec +++ b/vsftpd.spec @@ -1,15 +1,16 @@ %{!?tcp_wrappers:%define tcp_wrappers 1} +%{!?pretag:%define pretag pre1} Name: vsftpd -Version: 2.1.0 -Release: 2%{?dist} +Version: 2.1.1 +Release: 0.1.%{pretag}%{?dist} Summary: Very Secure Ftp Daemon Group: System Environment/Daemons # OpenSSL link exception License: GPLv2 with exceptions URL: http://vsftpd.beasts.org/ -Source0: ftp://vsftpd.beasts.org/users/cevans/%{name}-%{version}.tar.gz +Source0: ftp://vsftpd.beasts.org/users/cevans/%{name}-%{version}%{pretag}.tar.gz Source1: vsftpd.xinetd Source2: vsftpd.pam Source3: vsftpd.ftpusers @@ -46,6 +47,9 @@ Patch7: vsftpd-2.1.0-filter.patch Patch8: vsftpd-2.0.5-greedy.patch Patch9: vsftpd-2.1.0-userlist_log.patch +Patch10: vsftpd-2.1.1-daemonize_plus.patch +Patch11: vsftpd-2.1.0-trim.patch +Patch12: vsftpd-2.1.0-userlistdelay.patch %description vsftpd is a Very Secure FTP daemon. It was written completely from @@ -67,6 +71,9 @@ cp %{SOURCE1} . %patch7 -p1 -b .filter %patch8 -p1 -b .greedy %patch9 -p1 -b .userlist_log +%patch10 -p1 -b .daemonize_plus +%patch11 -p1 -b .trim +%patch12 -p1 -b .userlistdelay %build @@ -132,6 +139,12 @@ fi %changelog +* Wed Apr 22 2009 Jiri Skala - 2.1.0-3 +- updated to latest upstream version +- improved daemonizing - init script gets correct return code if binding fails +- trim white spaces from option values +- fixed #483604 - vsftpd not honouring delay_failed_login when userlist active + * Wed Feb 25 2009 Fedora Release Engineering - 2.1.0-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild