[Git][debian-proftpd-team/proftpd][master] Add patch for (Issue #2360).

Hilmar Preuße (@hilmar) gitlab at salsa.debian.org
Thu Nov 12 22:55:44 GMT 2026



Hilmar Preuße pushed to branch master at Debian ProFTPD Team / proftpd


Commits:
bbd86fec by Hilmar Preuße at 2026-11-12T23:55:37+01:00
Add patch for (Issue #2360).

- - - - -


3 changed files:

- debian/changelog
- + debian/patches/ceb22dcce086d9223269f9a0bfef21574cb9da60.diff
- debian/patches/series


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+proftpd-dfsg (1.3.9e~dfsg-4) UNRELEASED; urgency=medium
+
+  * Add patch for (Issue #2360).
+
+ -- Hilmar Preuße <hille42 at debian.org>  Thu, 12 Nov 2026 23:54:51 +0100
+
 proftpd-dfsg (1.3.9e~dfsg-3) unstable; urgency=high
 
   * Apply patch to disable inet_connect_ipv6_test (fails on s390x).


=====================================
debian/patches/ceb22dcce086d9223269f9a0bfef21574cb9da60.diff
=====================================
@@ -0,0 +1,156 @@
+From ceb22dcce086d9223269f9a0bfef21574cb9da60 Mon Sep 17 00:00:00 2001
+From: TJ Saunders <tj at castaglia.org>
+Date: Wed, 11 Nov 2026 18:36:49 -0800
+Subject: [PATCH] Issue #2360: Ensure that the mod_xfer module has the
+ necessary information for logging after an aborted/terminated transfer,
+ without implicit assumptions on module load ordering.
+
+---
+ contrib/mod_sftp/fxp.c |  3 +++
+ contrib/mod_sftp/scp.c |  4 ++++
+ include/proftpd.h      |  1 +
+ modules/mod_xfer.c     | 23 +++++++++++++++--------
+ src/data.c             |  1 +
+ src/session.c          |  9 ++++++---
+ 6 files changed, 30 insertions(+), 11 deletions(-)
+
+--- proftpd.orig/contrib/mod_sftp/fxp.c
++++ proftpd/contrib/mod_sftp/fxp.c
+@@ -225,6 +225,7 @@
+   struct {
+     int xfer_type;
+     int direction;
++    const char *xfer_cmd;     /* Command that started the transfer */
+     const char *filename;     /* Same as requested path */
+     const char *path;         /* Same as fxh->fh->fh_path */
+     const char *path_hidden;  /* Used for HiddenStores if applicable */
+@@ -674,6 +675,7 @@
+   session.xfer.xfer_type = fxh->xfer.xfer_type;
+   session.xfer.direction = fxh->xfer.direction;
+ 
++  session.xfer.xfer_cmd = pstrdup(session.xfer.p, fxh->xfer.xfer_cmd);
+   session.xfer.filename = pstrdup(session.xfer.p, fxh->xfer.filename);
+   session.xfer.path = pstrdup(session.xfer.p, fxh->xfer.path);
+   session.xfer.path_hidden = pstrdup(session.xfer.p, fxh->xfer.path_hidden);
+@@ -10013,6 +10015,7 @@
+   memcpy(fxh->fh_st, &st, sizeof(struct stat));
+ 
+   fxh->xfer.xfer_type = session.xfer.xfer_type;
++  fxh->xfer.xfer_cmd = pstrdup(fxh->pool, session.curr_cmd);
+   fxh->xfer.filename = pstrdup(fxh->pool, orig_path);
+   fxh->xfer.path = pstrdup(fxh->pool, fxh->fh->fh_path);
+ 
+--- proftpd.orig/contrib/mod_sftp/scp.c
++++ proftpd/contrib/mod_sftp/scp.c
+@@ -1661,6 +1661,8 @@
+       }
+     }
+ 
++    session.xfer.xfer_cmd = pstrdup(session.xfer.p, C_STOR);
++
+     if (sp->file_existed) {
+       if (pr_table_add(cmd->notes, "mod_xfer.file-modified",
+           pstrdup(cmd->pool, "true"), 0) < 0) {
+@@ -1699,6 +1701,7 @@
+       }
+     }
+ 
++    session.xfer.xfer_cmd = pstrdup(session.xfer.p, C_STOR);
+     (void) pr_cmd_dispatch_phase(cmd, POST_CMD_ERR, 0);
+     (void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0);
+   }
+@@ -2284,6 +2287,7 @@
+ 
+   if (session.xfer.p == NULL) {
+     session.xfer.p = pr_pool_create_sz(scp_pool, 64);
++    session.xfer.xfer_cmd = pstrdup(session.xfer.p, C_RETR);
+     session.xfer.path = pstrdup(session.xfer.p, sp->best_path);
+     memset(&session.xfer.start_time, 0, sizeof(session.xfer.start_time));
+     gettimeofday(&session.xfer.start_time, NULL);
+--- proftpd.orig/include/proftpd.h
++++ proftpd/include/proftpd.h
+@@ -157,6 +157,7 @@
+ 
+     int xfer_type;     /* xfer session attributes, default/append/hidden */
+     int direction;
++    const char *xfer_cmd;		/* Command that started the transfer */
+     const char *filename;		/* As shown to user */
+     const char *path;			/* As used in transfer */
+     const char *path_hidden;		/* As used in hidden stor */
+--- proftpd.orig/modules/mod_xfer.c
++++ proftpd/modules/mod_xfer.c
+@@ -46,6 +46,7 @@
+ 
+ extern module auth_module;
+ extern pid_t mpid;
++extern pr_response_t *resp_err_list;
+ 
+ /* Variables for this module */
+ static pr_fh_t *retr_fh = NULL;
+@@ -4351,17 +4352,23 @@
+   }
+ 
+   if (session.sf_flags & SF_XFER) {
+-    cmd_rec *cmd = NULL;
+-
+     pr_data_abort(0, FALSE);
++    pr_response_flush(&resp_err_list);
+ 
+-    cmd = session.curr_cmd_rec;
+-    if (cmd == NULL) {
+-      cmd = pr_cmd_alloc(session.pool, 2, session.curr_cmd, session.xfer.path);
++    /* Issue #2360 demonstrated that sometimes, due to different module
++     * load order, assumptions about session state may not always be
++     * valid.  So we double-check for our fields of interest.
++     */
++    if (session.xfer.xfer_cmd != NULL &&
++        session.xfer.path != NULL) {
++      cmd_rec *cmd = NULL;
++
++      cmd = pr_cmd_alloc(session.pool, 2, session.xfer.xfer_cmd,
++        session.xfer.path);
++      (void) pr_cmd_dispatch_phase(cmd, POST_CMD_ERR, 0);
++      (void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0);
++      destroy_pool(cmd->pool);
+     }
+-
+-    (void) pr_cmd_dispatch_phase(cmd, POST_CMD_ERR, 0);
+-    (void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0);
+   }
+ }
+ 
+--- proftpd.orig/src/data.c
++++ proftpd/src/data.c
+@@ -97,6 +97,7 @@
+   session.xfer.p = make_sub_pool(session.pool);
+   pr_pool_tag(session.xfer.p, "Data Transfer pool");
+ 
++  session.xfer.xfer_cmd = pstrdup(session.xfer.p, session.curr_cmd);
+   session.xfer.filename = pstrdup(session.xfer.p, filename);
+   session.xfer.direction = direction;
+   session.xfer.bufsize = pr_config_get_server_xfer_bufsz(direction);
+--- proftpd.orig/src/session.c
++++ proftpd/src/session.c
+@@ -69,6 +69,12 @@
+       pr_netaddr_get_sess_remote_addr());
+   }
+ 
++  /* Run all the exit handlers.  Doing this now allows for any exit
++   * event listeners to flush/dispatch any final responses out to the client,
++   * before we close the control connection.
++   */
++  pr_event_generate("core.exit", NULL);
++
+   /* These are necessary in order that cleanups associated with these pools
+    * (and their subpools) are properly run.
+    */
+@@ -82,9 +88,6 @@
+     session.c = NULL;
+   }
+ 
+-  /* Run all the exit handlers */
+-  pr_event_generate("core.exit", NULL);
+-
+   if (is_master == FALSE) {
+     log_sess_closed = TRUE;
+   }


=====================================
debian/patches/series
=====================================
@@ -16,3 +16,4 @@ odbc
 0f91a0f088312da4862d1f882cdf998e78fa3795.diff
 c4515f5bd4236a803213c9df926e4094c4b003f2.diff
 ab5c8cd35f85b75e90019a32674a1f1062268bec.diff
+ceb22dcce086d9223269f9a0bfef21574cb9da60.diff



View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd/-/commit/bbd86fecf02682960953938f79057b6221d7b8f6

-- 
View it on GitLab: https://salsa.debian.org/debian-proftpd-team/proftpd/-/commit/bbd86fecf02682960953938f79057b6221d7b8f6
You're receiving this email because of your account on salsa.debian.org. Manage all notifications: https://salsa.debian.org/-/profile/notifications | Help: https://salsa.debian.org/help




More information about the Pkg-proftpd-maintainers mailing list