Skip to content

feat: implement pre-xfer and post-xfer exec daemon directives - #2386

Merged
oferchen merged 1 commit into
masterfrom
feature/pre-post-xfer-exec-v2
Feb 21, 2026
Merged

oferchen merged 1 commit into
masterfrom
feature/pre-post-xfer-exec-v2

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

  • Add xfer_exec.rs module with XferExecContext, build_xfer_command(), run_pre_xfer_exec(), and run_post_xfer_exec() functions for executing shell commands before/after daemon transfers
  • Wire pre-xfer and post-xfer exec into the daemon transfer flow in module_access.rs, running pre-xfer after authentication but before the transfer starts, and post-xfer after transfer completion
  • Change execute_transfer() to return the transfer exit status (i32) so it can be passed to post-xfer exec via RSYNC_EXIT_STATUS

The config fields (pre_xfer_exec, post_xfer_exec), parsing, and builder methods were added in #2381. This PR adds the actual execution logic with upstream-compatible environment variables (RSYNC_MODULE_NAME, RSYNC_MODULE_PATH, RSYNC_HOST_ADDR, RSYNC_HOST_NAME, RSYNC_USER_NAME, RSYNC_REQUEST, RSYNC_EXIT_STATUS).

Commands run via sh -c (Unix) or cmd /C (Windows). Pre-xfer failures deny the transfer with an @ERROR message. Post-xfer failures are logged but do not affect the transfer exit status, matching upstream clientserver.c semantics.

Test plan

  • All 805 daemon tests pass (cargo nextest run -p daemon --all-features)
  • Clippy clean (cargo clippy -p daemon --all-targets --all-features --no-deps -- -D warnings)
  • Format check passes (cargo fmt -p daemon -- --check)
  • CI: fmt+clippy, nextest (stable), Windows (stable), macOS (stable), Linux musl (stable)

Add execution logic for the pre-xfer exec and post-xfer exec daemon
module directives. The config fields and parsing were added in #2381;
this wires up the actual command execution with upstream-compatible
environment variables (RSYNC_MODULE_NAME, RSYNC_MODULE_PATH,
RSYNC_HOST_ADDR, RSYNC_HOST_NAME, RSYNC_USER_NAME, RSYNC_REQUEST,
and RSYNC_EXIT_STATUS for post-xfer).

Commands run via sh -c (Unix) or cmd /C (Windows). Pre-xfer failures
deny the transfer with an @error message. Post-xfer failures are
logged but do not affect the transfer exit status, matching upstream
clientserver.c semantics.
@github-actions github-actions Bot added the enhancement New feature or request label Feb 21, 2026
@oferchen
oferchen merged commit 2a92c8d into master Feb 21, 2026
15 of 16 checks passed
@oferchen
oferchen deleted the feature/pre-post-xfer-exec-v2 branch February 21, 2026 15:17
oferchen added a commit that referenced this pull request May 1, 2026
Add execution logic for the pre-xfer exec and post-xfer exec daemon
module directives. The config fields and parsing were added in #2381;
this wires up the actual command execution with upstream-compatible
environment variables (RSYNC_MODULE_NAME, RSYNC_MODULE_PATH,
RSYNC_HOST_ADDR, RSYNC_HOST_NAME, RSYNC_USER_NAME, RSYNC_REQUEST,
and RSYNC_EXIT_STATUS for post-xfer).

Commands run via sh -c (Unix) or cmd /C (Windows). Pre-xfer failures
deny the transfer with an @error message. Post-xfer failures are
logged but do not affect the transfer exit status, matching upstream
clientserver.c semantics.
oferchen added a commit that referenced this pull request May 5, 2026
Add execution logic for the pre-xfer exec and post-xfer exec daemon
module directives. The config fields and parsing were added in #2381;
this wires up the actual command execution with upstream-compatible
environment variables (RSYNC_MODULE_NAME, RSYNC_MODULE_PATH,
RSYNC_HOST_ADDR, RSYNC_HOST_NAME, RSYNC_USER_NAME, RSYNC_REQUEST,
and RSYNC_EXIT_STATUS for post-xfer).

Commands run via sh -c (Unix) or cmd /C (Windows). Pre-xfer failures
deny the transfer with an @error message. Post-xfer failures are
logged but do not affect the transfer exit status, matching upstream
clientserver.c semantics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant