From f543dc078806a31fdaf4879693dc575c91f0eb6d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Arkadiusz=20Mi=C5=9Bkiewicz?= Date: Mon, 16 Oct 2017 11:32:44 +0200 Subject: [PATCH] - rel 2; upstream pureftpd ignores config file if cmd line options are passed which totally broke our init script; fix that by using fedora patch that allows cmd line and config file options to be used --- ...h-options-and-config-file-on-command.patch | 68 +++++++++++++++++++ pure-ftpd.spec | 5 +- 2 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 0003-Allow-having-both-options-and-config-file-on-command.patch 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 4e04080..68c4749 100644 --- a/pure-ftpd.spec +++ b/pure-ftpd.spec @@ -9,7 +9,7 @@ %bcond_without tls # disable SSL/TLS support %bcond_without cap # disable capabilities -%define rel 1 +%define rel 2 Summary: Small, fast and secure FTP server Summary(pl.UTF-8): Mały, szybki i bezpieczny serwer FTP Name: pure-ftpd @@ -30,6 +30,8 @@ Patch0: %{name}-config.patch Patch1: %{name}-allauth.patch Patch2: %{name}-pure-pw_passwd.patch Patch3: %{name}-mysql_config.patch +# from Fedora +Patch4: 0003-Allow-having-both-options-and-config-file-on-command.patch Patch7: audit_cap.patch Patch8: %{name}-apparmor.patch @@ -108,6 +110,7 @@ Ten pakiet zawiera schemat Pure-FTPd pureftpd.schema dla openldapa. %patch0 -p0 %patch1 -p1 %patch3 -p1 +%patch4 -p1 %patch7 -p1 %patch8 -p1 -- 2.44.0