public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/proftpd] f44: Fix some issues in mod_copy (not enabled by default)
@ 2026-11-06  8:20 Paul Howarth
  0 siblings, 0 replies; only message in thread
From: Paul Howarth @ 2026-11-06  8:20 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/proftpd
            Branch : f44
            Commit : d48e51cc6d3a23ed285224130a71c519c239fd30
            Author : Paul Howarth <paul@city-fan.org>
            Date   : 2026-11-05T19:08:18+00:00
            Stats  : +230/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/proftpd/c/d48e51cc6d3a23ed285224130a71c519c239fd30?branch=f44

            Log:
            Fix some issues in mod_copy (not enabled by default)

- <Limit READ> configurations were not honored by SITE COPY as they should be
  (GH#2095)
- Fix write restriction bypass via symlink following in mod_copy (GH#2374,
  CVE-2026-119364)

---
diff --git a/proftpd-1.3.9e-gh2095.patch b/proftpd-1.3.9e-gh2095.patch
new file mode 100644
index 0000000..54debae
--- /dev/null
+++ b/proftpd-1.3.9e-gh2095.patch
@@ -0,0 +1,47 @@
+diff --git a/contrib/mod_copy.c b/contrib/mod_copy.c
+index bf725eebae..dd770c029d 100644
+--- a/contrib/mod_copy.c
++++ b/contrib/mod_copy.c
+@@ -571,7 +571,7 @@ MODRET copy_copy(cmd_rec *cmd) {
+     return PR_DECLINED(cmd);
+   }
+ 
+-  if (strncasecmp(cmd->argv[1], "COPY", 5) == 0) {
++  if (strcasecmp(cmd->argv[1], "COPY") == 0) {
+     char *cmd_name, *decoded_path, *from, *to;
+     unsigned char *authenticated;
+ 
+@@ -625,14 +625,31 @@ MODRET copy_copy(cmd_rec *cmd) {
+ 
+     to = dir_canonical_vpath(cmd->tmp_pool, decoded_path);
+ 
++    cmd_name = cmd->argv[0];
++    pr_cmd_set_name(cmd, "SITE_COPY");
++    if (!dir_check(cmd->tmp_pool, cmd, G_READ, from, NULL)) {
++      int xerrno = EPERM;
++
++      pr_cmd_set_name(cmd, cmd_name);
++      pr_log_debug(DEBUG8, "%s %s denied by <Limit> configuration",
++        (char *) cmd->argv[0], from);
++      pr_response_add_err(R_550, "%s: %s", (char *) cmd->argv[2],
++        strerror(xerrno));
++
++      pr_cmd_set_errno(cmd, xerrno);
++      errno = xerrno;
++      return PR_ERROR(cmd);
++    }
++    pr_cmd_set_name(cmd, cmd_name);
++
+     cmd_name = cmd->argv[0];
+     pr_cmd_set_name(cmd, "SITE_COPY");
+     if (!dir_check(cmd->tmp_pool, cmd, G_WRITE, to, NULL)) {
+       int xerrno = EPERM;
+ 
+       pr_cmd_set_name(cmd, cmd_name);
+-      pr_log_debug(DEBUG8, "%s denied by <Limit> configuration",
+-        (char *) cmd->argv[0]);
++      pr_log_debug(DEBUG8, "%s %s denied by <Limit> configuration",
++        (char *) cmd->argv[0], to);
+       pr_response_add_err(R_550, "%s: %s", (char *) cmd->argv[3],
+         strerror(xerrno));
+ 

diff --git a/proftpd-1.3.9e-gh2374.patch b/proftpd-1.3.9e-gh2374.patch
new file mode 100644
index 0000000..53648f5
--- /dev/null
+++ b/proftpd-1.3.9e-gh2374.patch
@@ -0,0 +1,162 @@
+commit 191e11052229004599b00f71400c4ba3f038bbac
+Author: TJ Saunders <tj@castaglia.org>
+Date:   Tue May 19 17:16:11 2026 -0700
+
+    While working on mod_copy, I added a regression test for `<Anonymous>` configurations, and noticed some logging nits, now addressed.
+
+diff --git a/contrib/mod_copy.c b/contrib/mod_copy.c
+index dd770c029..024070911 100644
+--- a/contrib/mod_copy.c
++++ b/contrib/mod_copy.c
+@@ -631,8 +631,8 @@ MODRET copy_copy(cmd_rec *cmd) {
+       int xerrno = EPERM;
+ 
+       pr_cmd_set_name(cmd, cmd_name);
+-      pr_log_debug(DEBUG8, "%s %s denied by <Limit> configuration",
+-        (char *) cmd->argv[0], from);
++      pr_log_debug(DEBUG8, "%s %s %s denied by <Limit> configuration",
++        (char *) cmd->argv[0], (char *) cmd->argv[1], from);
+       pr_response_add_err(R_550, "%s: %s", (char *) cmd->argv[2],
+         strerror(xerrno));
+ 
+@@ -648,8 +648,8 @@ MODRET copy_copy(cmd_rec *cmd) {
+       int xerrno = EPERM;
+ 
+       pr_cmd_set_name(cmd, cmd_name);
+-      pr_log_debug(DEBUG8, "%s %s denied by <Limit> configuration",
+-        (char *) cmd->argv[0], to);
++      pr_log_debug(DEBUG8, "%s %s %s denied by <Limit> configuration",
++        (char *) cmd->argv[0], (char *) cmd->argv[1], to);
+       pr_response_add_err(R_550, "%s: %s", (char *) cmd->argv[3],
+         strerror(xerrno));
+ 
+@@ -697,7 +697,7 @@ MODRET copy_cpfr(cmd_rec *cmd) {
+   }
+ 
+   if (cmd->argc < 3 ||
+-      strncasecmp(cmd->argv[1], "CPFR", 5) != 0) {
++      strcasecmp(cmd->argv[1], "CPFR") != 0) {
+     return PR_DECLINED(cmd);
+   }
+ 
+@@ -743,10 +743,9 @@ MODRET copy_cpfr(cmd_rec *cmd) {
+     int xerrno = EPERM;
+ 
+     pr_cmd_set_name(cmd, cmd_name);
+-    pr_log_debug(DEBUG8, "%s denied by <Limit> configuration",
+-      (char *) cmd->argv[0]);
+-    pr_response_add_err(R_550, "%s: %s", (char *) cmd->argv[3],
+-      strerror(xerrno));
++    pr_log_debug(DEBUG8, "%s %s %s denied by <Limit> configuration",
++      (char *) cmd->argv[0], (char *) cmd->argv[1], path);
++    pr_response_add_err(R_550, "%s: %s", path, strerror(xerrno));
+ 
+     pr_cmd_set_errno(cmd, xerrno);
+     errno = xerrno;
+@@ -806,7 +805,7 @@ MODRET copy_cpfr(cmd_rec *cmd) {
+ 
+ MODRET copy_cpto(cmd_rec *cmd) {
+   register unsigned int i;
+-  const char *from, *to = "";
++  const char *from, *to = "", *resolved_to;
+   char *cmd_name;
+   unsigned char *authenticated = NULL;
+ 
+@@ -815,7 +814,7 @@ MODRET copy_cpto(cmd_rec *cmd) {
+   }
+ 
+   if (cmd->argc < 3 ||
+-      strncasecmp(cmd->argv[1], "CPTO", 5) != 0) {
++      strcasecmp(cmd->argv[1], "CPTO") != 0) {
+     return PR_DECLINED(cmd);
+   }
+ 
+@@ -864,16 +863,16 @@ MODRET copy_cpto(cmd_rec *cmd) {
+     to = pstrcat(cmd->tmp_pool, to, *to ? " " : "", decoded_path, NULL);
+   }
+ 
+-  to = dir_canonical_vpath(cmd->tmp_pool, to);
++  resolved_to = dir_canonical_vpath(cmd->tmp_pool, to);
+ 
+   cmd_name = cmd->argv[0];
+   pr_cmd_set_name(cmd, "SITE_CPTO");
+-  if (!dir_check(cmd->tmp_pool, cmd, G_WRITE, to, NULL)) {
++  if (!dir_check(cmd->tmp_pool, cmd, G_WRITE, resolved_to, NULL)) {
+     int xerrno = EPERM;
+ 
+     pr_cmd_set_name(cmd, cmd_name);
+-    pr_log_debug(DEBUG8, "%s denied by <Limit> configuration",
+-      (char *) cmd->argv[0]);
++    pr_log_debug(DEBUG8, "%s %s %s denied by <Limit> configuration",
++      (char *) cmd->argv[0], (char *) cmd->argv[1], to);
+     pr_response_add_err(R_550, "%s: %s", to, strerror(xerrno));
+ 
+     pr_cmd_set_errno(cmd, xerrno);
+@@ -882,12 +881,12 @@ MODRET copy_cpto(cmd_rec *cmd) {
+   }
+   pr_cmd_set_name(cmd, cmd_name);
+ 
+-  if (copy_paths(cmd->tmp_pool, from, to) < 0) {
++  if (copy_paths(cmd->tmp_pool, from, resolved_to) < 0) {
+     int xerrno = errno;
+     const char *err_code = R_550;
+ 
+     pr_log_debug(DEBUG7, MOD_COPY_VERSION
+-      ": error copying '%s' to '%s': %s", from, to, strerror(xerrno));
++      ": error copying '%s' to '%s': %s", from, resolved_to, strerror(xerrno));
+ 
+     /* Check errno for EDQOUT (or the most appropriate alternative).
+      * (I hate the fact that FTP has a special response code just for
+@@ -912,8 +911,8 @@ MODRET copy_cpto(cmd_rec *cmd) {
+         break;
+     }
+ 
+-    pr_response_add_err(err_code, "%s: %s", (char *) cmd->argv[1],
+-      strerror(xerrno));
++    pr_response_add_err(err_code, "%s %s: %s", (char *) cmd->argv[0],
++      (char *) cmd->argv[1], strerror(xerrno));
+ 
+     pr_cmd_set_errno(cmd, xerrno);
+     errno = xerrno;
+From c41691f8981f98081fcb8a535c3c21b06a3f04af Mon Sep 17 00:00:00 2001
+From: TJ Saunders <tj@castaglia.org>
+Date: Sat, 17 Oct 2026 13:12:56 -0700
+Subject: [PATCH] Issue #2374: Resolve the destination path in order to handle
+ any potential symlinks, and use the resolved path for <Limit> checks.
+
+---
+ contrib/mod_copy.c | 14 ++++++++++++--
+ 1 file changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/contrib/mod_copy.c b/contrib/mod_copy.c
+index 51d62107e5..70f704f39a 100644
+--- a/contrib/mod_copy.c
++++ b/contrib/mod_copy.c
+@@ -593,7 +593,12 @@ MODRET copy_copy(cmd_rec *cmd) {
+       return PR_ERROR(cmd);
+     }
+ 
+-    to = dir_canonical_vpath(cmd->tmp_pool, decoded_path);
++    pr_fs_clear_cache2(decoded_path);
++    to = dir_realpath(cmd->tmp_pool, decoded_path);
++    if (to == NULL) {
++      /* Try using dir_best_path(), as xfer_pre_stor() does. */
++      to = dir_best_path(cmd->tmp_pool, decoded_path);
++    }
+ 
+     cmd_name = cmd->argv[0];
+     pr_cmd_set_name(cmd, "SITE_COPY");
+@@ -833,7 +838,12 @@ MODRET copy_cpto(cmd_rec *cmd) {
+     to = pstrcat(cmd->tmp_pool, to, *to ? " " : "", decoded_path, NULL);
+   }
+ 
+-  resolved_to = dir_canonical_vpath(cmd->tmp_pool, to);
++  pr_fs_clear_cache2(to);
++  resolved_to = dir_realpath(cmd->tmp_pool, to);
++  if (resolved_to == NULL) {
++    /* Try using dir_best_path(), as xfer_pre_stor() does. */
++    resolved_to = dir_best_path(cmd->tmp_pool, to);
++  }
+ 
+   cmd_name = cmd->argv[0];
+   pr_cmd_set_name(cmd, "SITE_CPTO");

diff --git a/proftpd.spec b/proftpd.spec
index 32eddc3..d9c0211 100644
--- a/proftpd.spec
+++ b/proftpd.spec
@@ -17,7 +17,7 @@
 %undefine _strict_symbol_defs_build
 
 #global prever rc4
-%global baserelease 2
+%global baserelease 3
 %global mod_procfs_version 0.3
 %global mod_proxy_version 0.9.7
 %global mod_vroot_version 0.9.12
@@ -46,6 +46,8 @@ Patch1:			proftpd-1.3.8-shellbang.patch
 Patch2:			mod_proxy-certificate.patch
 Patch3:			proftpd-1.3.4rc1-mod_vroot-test.patch
 Patch6:			https://github.com/proftpd/proftpd/commit/933abc9a.patch
+Patch7:			proftpd-1.3.9e-gh2095.patch
+Patch8:			proftpd-1.3.9e-gh2374.patch
 
 BuildRequires:		coreutils
 BuildRequires:		gcc
@@ -235,6 +237,14 @@ mv contrib/README contrib/README.contrib
 # https://github.com/proftpd/proftpd/issues/2411
 %patch -P6 -p1 -b .gh2411
 
+# <Limit READ> configurations were not honored by SITE COPY as they should be
+# https://github.com/proftpd/proftpd/issues/2095
+%patch -P7 -p1 -b .gh2095
+
+# Fix write restriction bypass via symlink following in mod_copy (CVE-2026-119364)
+# https://github.com/proftpd/proftpd/issues/2374
+%patch -P8 -p1 -b .gh2374
+
 # Tweak logrotate script for systemd compatibility (#802178)
 sed -i -e '/killall/s/test.*/systemctl try-reload-or-restart proftpd.service/' \
 	contrib/dist/rpm/proftpd.logrotate
@@ -474,6 +484,13 @@ fi
 %{_mandir}/man1/ftpwho.1*
 
 %changelog
+* Thu Nov  5 2026 Paul Howarth <paul@city-fan.org> - 1.3.9e-3
+- Fix some issues in mod_copy (not enabled by default)
+  - <Limit READ> configurations were not honored by SITE COPY as they should be
+    (GH#2095)
+  - Fix write restriction bypass via symlink following in mod_copy (GH#2374,
+    CVE-2026-119364)
+
 * Wed Oct 28 2026 Paul Howarth <paul@city-fan.org> - 1.3.9e-2
 - Fix regression in the handling of private keys formatted using the
   OpenSSH-specific private key format, and which are not passphrase-protected
@@ -500,6 +517,9 @@ fi
     address to which UDP packets are sent (GH#2384)
   - mod_ban SysV shared memory segment default permissions allow for local
     unprivileged user read/write access (GH#2388)
+  - Guard against overly-long keys overflowing buffers when the "utf8trans"
+    builtin RewriteMap type is used (CVE-2026-119146)
+  - Fix authorization bypass via mod_sftp copy-file extension (CVE-2026-119147)
 
 * Mon Aug 24 2026 Paul Howarth <paul@city-fan.org> - 1.3.9d-2
 - Fix regression in mod_sql's SQLNamedQuery (upstream bug 4515, GH#2293)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-11-06  8:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06  8:20 [rpms/proftpd] f44: Fix some issues in mod_copy (not enabled by default) Paul Howarth

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox