From 749308ee9d298aae7dc182debdd77b702a6d7e46 Mon Sep 17 00:00:00 2001 From: Ondřej Lysoněk Date: Sep 15 2017 15:48:11 +0000 Subject: Fix loading the configuration file Also drop the 'UseFtpUsers' option from default config file The option has not been imlemented for over 12 years. The /etc/ftpusers file is used by PAM irrespectively of the option. --- diff --git a/0002-fedora-specific-config-file.patch b/0002-fedora-specific-config-file.patch index 8244501..725184c 100644 --- a/0002-fedora-specific-config-file.patch +++ b/0002-fedora-specific-config-file.patch @@ -1,14 +1,14 @@ -From 7298eae83f798f572e33bce5cc5f0a43fabdf9ad Mon Sep 17 00:00:00 2001 +From 5023020a73f60d4d512f934cfb67d94d1efd921c Mon Sep 17 00:00:00 2001 From: rpm-build -Date: Wed, 12 Jul 2017 13:17:05 +0200 +Date: Thu, 14 Sep 2017 16:41:12 +0200 Subject: [PATCH] fedora specific config file --- - pure-ftpd.conf.in | 31 +++++++++++++++++-------------- - 1 file changed, 17 insertions(+), 14 deletions(-) + pure-ftpd.conf.in | 29 ++++++++++++++--------------- + 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/pure-ftpd.conf.in b/pure-ftpd.conf.in -index fbaf9b4..b02617d 100644 +index fbaf9b4..b4d6837 100644 --- a/pure-ftpd.conf.in +++ b/pure-ftpd.conf.in @@ -9,7 +9,7 @@ @@ -61,21 +61,17 @@ index fbaf9b4..b02617d 100644 -@@ -236,9 +236,12 @@ Umask 133:022 +@@ -236,8 +236,7 @@ Umask 133:022 # Minimum UID for an authenticated user to log in. -MinUID 100 +- +MinUID 1000 -+# Do not use the /etc/ftpusers file to disable accounts. We're already -+# using MinUID to block users with uid < 1000 - -+UseFtpUsers no # Allow FXP transfers for authenticated users. - -@@ -275,7 +278,7 @@ AutoRename no +@@ -275,7 +274,7 @@ AutoRename no # Prevent anonymous users from uploading new files (no = upload is allowed) @@ -84,7 +80,7 @@ index fbaf9b4..b02617d 100644 -@@ -299,21 +302,21 @@ AnonymousCantUpload no +@@ -299,21 +298,21 @@ AnonymousCantUpload no # fw.c9x.org - jedi [13/Apr/2017:19:36:39] "GET /ftp/linux.tar.bz2" 200 21809338 # This log file can then be processed by common HTTP traffic analyzers. @@ -109,7 +105,7 @@ index fbaf9b4..b02617d 100644 -@@ -344,9 +347,9 @@ AnonymousCantUpload no +@@ -344,9 +343,9 @@ AnonymousCantUpload no # If your pure-ftpd has been compiled with standalone support, you can change @@ -122,5 +118,5 @@ index fbaf9b4..b02617d 100644 -- -2.13.0 +2.9.5 diff --git a/0003-Allow-having-both-options-and-config-file-on-command.patch b/0003-Allow-having-both-options-and-config-file-on-command.patch new file mode 100644 index 0000000..7eb99b2 --- /dev/null +++ b/0003-Allow-having-both-options-and-config-file-on-command.patch @@ -0,0 +1,68 @@ +From f5617a4de54c313580fe39562f0d32e5c95f5212 Mon Sep 17 00:00:00 2001 +From: rpm-build +Date: Thu, 14 Sep 2017 01:05:53 +0200 +Subject: [PATCH] Allow having both options and config file on command line + +--- + src/ftpd.c | 2 +- + src/simpleconf.c | 23 +++++++++++++++++++++-- + 2 files changed, 22 insertions(+), 3 deletions(-) + +diff --git a/src/ftpd.c b/src/ftpd.c +index c5edac5..b13afc0 100644 +--- a/src/ftpd.c ++++ b/src/ftpd.c +@@ -5589,7 +5589,7 @@ int pureftpd_start(int argc, char *argv[], const char *home_directory_) + #endif + + #ifndef MINIMAL +- if (argc == 2 && *argv[1] != '-' && ++ if (argc >= 2 && *argv[1] != '-' && + sc_build_command_line_from_file(argv[1], NULL, simpleconf_options, + (sizeof simpleconf_options) / + (sizeof simpleconf_options[0]), +diff --git a/src/simpleconf.c b/src/simpleconf.c +index f296f54..505aee1 100644 +--- a/src/simpleconf.c ++++ b/src/simpleconf.c +@@ -674,9 +674,10 @@ sc_build_command_line_from_file(const char *file_name, + { + char **argv = NULL; + int argc = 0; ++ char **argv_tmp = NULL; ++ char *arg = NULL; ++ int i; + +- *argc_p = 0; +- *argv_p = NULL; + if ((argv = malloc(sizeof *argv)) == NULL || + (app_name = strdup(app_name)) == NULL) { + sc_argv_free(argc, argv); +@@ -689,6 +690,24 @@ sc_build_command_line_from_file(const char *file_name, + sc_argv_free(argc, argv); + return -1; + } ++ ++ for (i = 2; i < *argc_p; ++i) { ++ ++argc; ++ arg = strdup((*argv_p)[i]); ++ if (arg == NULL) { ++ return -1; ++ } ++ if ((argv_tmp = realloc(argv, (sizeof arg) * ++ ((size_t) argc + 1))) == NULL) { ++ return -1; ++ } ++ argv = argv_tmp; ++ argv[argc - 1] = arg; ++ } ++ if (*argc_p > 2) { ++ argv[argc] = NULL; ++ } ++ + *argc_p = argc; + *argv_p = argv; + +-- +2.9.5 + diff --git a/pure-ftpd.spec b/pure-ftpd.spec index 4029a2e..6dd3e26 100644 --- a/pure-ftpd.spec +++ b/pure-ftpd.spec @@ -1,6 +1,6 @@ Name: pure-ftpd Version: 1.0.46 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Lightweight, fast and secure FTP server Group: System Environment/Daemons @@ -16,6 +16,7 @@ Source6: pure-ftpd.README.SELinux Source7: pure-ftpd.pureftpd.te Patch0: 0001-modify-pam.patch Patch1: 0002-fedora-specific-config-file.patch +Patch2: 0003-Allow-having-both-options-and-config-file-on-command.patch Provides: ftpserver BuildRequires: pam-devel, libcap-devel @@ -243,6 +244,10 @@ fi %changelog +* Thu Sep 14 2017 Ondřej Lysoněk - 1.0.46-2 +- Fix loading the configuration file +- Drop unsupported UseFtpUsers option from configuration file + * Mon Aug 14 2017 Martin Sehnoutka - 1.0.46-1 - Rebase to 1.0.46