From eb840b0f5c9f2290766d9d18265e7815450ee0734d5d6b7cde650c62760f6b1e Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Thu, 7 Sep 2017 13:55:51 +0000 Subject: [PATCH] Add "vsftpd-mdtm-in-utc.patch" to fix interoperability issue with various ftp clients that arose when vsftpd is configured with option "use_localtime=YES". Basically, it's fine to use local time stamps in directory listings, but responding to MDTM commands with any time zone other than UTC directly violates RFC3659 and leads FTP clients to misinterpret the file's time stamp. [bsc#1024961] OBS-URL: https://build.opensuse.org/package/show/network/vsftpd?expand=0&rev=116 --- vsftpd-mdtm-in-utc.patch | 41 ++++++++++++++++++++++++++++++++++++++++ vsftpd.changes | 7 +++++++ vsftpd.spec | 4 +++- 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 vsftpd-mdtm-in-utc.patch diff --git a/vsftpd-mdtm-in-utc.patch b/vsftpd-mdtm-in-utc.patch new file mode 100644 index 0000000..4eb0c35 --- /dev/null +++ b/vsftpd-mdtm-in-utc.patch @@ -0,0 +1,41 @@ +Index: vsftpd-3.0.2/postlogin.c +=================================================================== +--- vsftpd-3.0.2.orig/postlogin.c 2017-04-06 12:40:37.413294178 +0200 ++++ vsftpd-3.0.2/postlogin.c 2017-04-06 12:40:37.610294876 +0200 +@@ -1639,7 +1639,7 @@ handle_mdtm(struct vsf_session* p_sess) + else + { + retval = vsf_sysutil_setmodtime( +- str_getbuf(&p_sess->ftp_arg_str), modtime, tunable_use_localtime); ++ str_getbuf(&p_sess->ftp_arg_str), modtime, 0); + if (retval != 0) + { + vsf_cmdio_write(p_sess, FTP_FILEFAIL, +@@ -1664,7 +1664,7 @@ handle_mdtm(struct vsf_session* p_sess) + static struct mystr s_mdtm_res_str; + str_alloc_text(&s_mdtm_res_str, + vsf_sysutil_statbuf_get_numeric_date( +- s_p_statbuf, tunable_use_localtime)); ++ s_p_statbuf, 0)); + vsf_cmdio_write_str(p_sess, FTP_MDTMOK, &s_mdtm_res_str); + } + } +Index: vsftpd-3.0.2/vsftpd.conf.5 +=================================================================== +--- vsftpd-3.0.2.orig/vsftpd.conf.5 2017-04-06 12:40:37.496294472 +0200 ++++ vsftpd-3.0.2/vsftpd.conf.5 2017-04-06 12:41:50.271557442 +0200 +@@ -556,9 +556,11 @@ may be found within the _current_ chroot + Default: NO + .TP + .B use_localtime +-If enabled, vsftpd will display directory listings with the time in your +-local time zone. The default is to display GMT. The times returned by the +-MDTM FTP command are also affected by this option. ++If enabled, vsftpd will display directory listings with the time in your local ++time zone. The default is to display GMT. Note that this setting will NOT ++affect the times returned by the MDTM FTP command in this version of the ++daemon. This behavior deviates from the upstream version, which violated ++RFC3659 and subsequently caused problems with popular FTP clients. + + Default: NO + .TP diff --git a/vsftpd.changes b/vsftpd.changes index 19534b5..60520bf 100644 --- a/vsftpd.changes +++ b/vsftpd.changes @@ -6,6 +6,13 @@ Thu Sep 7 12:24:26 UTC 2017 - tchvatal@suse.com system errors occurred that were supposed to be non-fatal. [bsc#1044292] +- Add "vsftpd-mdtm-in-utc.patch" to fix interoperability issue with + various ftp clients that arose when vsftpd is configured with + option "use_localtime=YES". Basically, it's fine to use local time + stamps in directory listings, but responding to MDTM commands with + any time zone other than UTC directly violates RFC3659 and leads + FTP clients to misinterpret the file's time stamp. [bsc#1024961] + ------------------------------------------------------------------- Wed Jun 14 11:42:26 UTC 2017 - tchvatal@suse.com diff --git a/vsftpd.spec b/vsftpd.spec index 0ce8bc7..38d22f4 100644 --- a/vsftpd.spec +++ b/vsftpd.spec @@ -72,7 +72,8 @@ Patch24: vsftpd-3.0.2-wnohang.patch Patch25: vsftpd-3.0.2-fix-chown-uploads.patch #FIX-FIX-OPENSUSE: bsc#1042673 Patch26: vsftpd-3.0.3-build-with-openssl-1.1.patch -Patch27: vsftpd-die-with-session.patch +Patch27: vsftpd-mdtm-in-utc.patch +Patch28: vsftpd-die-with-session.patch BuildRequires: libcap-devel BuildRequires: libopenssl-devel BuildRequires: pam-devel @@ -128,6 +129,7 @@ tests. %patch25 -p1 %patch26 -p1 %patch27 -p1 +%patch28 -p1 %build %define seccomp_opts -D_GNU_SOURCE -DUSE_SECCOMP