Repository navigation
fix: preserve --groupmap wildcards through daemon arg escape - #5531
Merged
Merged
Conversation
The daemon and SSH client argument builders did not forward `--usermap` or `--groupmap` to the remote server. Mappings configured on the client were silently dropped, so wildcard specs like `--groupmap=*:1234` had no effect on the receiver. Forward both options as `--key=value` arguments alongside `--iconv` and the other long-form forwards. Under the secluded-args wire format the value travels verbatim, so the `*` wildcard reaches the upstream `uidlist.c:parse_name_map()` parser intact (matching upstream's behavior when `protect_args` is active and `safe_arg()` skips shell escaping). Preserve the original specification string on `NameMapping` / `UserMapping` / `GroupMapping` via a new `spec()` accessor. Recomposing from the parsed rule list would be lossy because the rules vector does not carry the source token. Add round-trip tests covering the daemon arg builder, SSH arg builder, the secluded-args wire format, and the mapping spec accessors.
2 tasks
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
* fix: preserve --groupmap wildcards through daemon arg escape The daemon and SSH client argument builders did not forward `--usermap` or `--groupmap` to the remote server. Mappings configured on the client were silently dropped, so wildcard specs like `--groupmap=*:1234` had no effect on the receiver. Forward both options as `--key=value` arguments alongside `--iconv` and the other long-form forwards. Under the secluded-args wire format the value travels verbatim, so the `*` wildcard reaches the upstream `uidlist.c:parse_name_map()` parser intact (matching upstream's behavior when `protect_args` is active and `safe_arg()` skips shell escaping). Preserve the original specification string on `NameMapping` / `UserMapping` / `GroupMapping` via a new `spec()` accessor. Recomposing from the parsed rule list would be lossy because the rules vector does not carry the source token. Add round-trip tests covering the daemon arg builder, SSH arg builder, the secluded-args wire format, and the mapping spec accessors. * style: collapse short builder chains to satisfy rustfmt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--usermapand--groupmapas--key=valuearguments from both the SSH and daemon argument builders. They were previously dropped on the client side, so the receiver never applied the mapping.NameMapping/UserMapping/GroupMappingvia a newspec()accessor so the wildcard*reaches the upstreamuidlist.c:parse_name_map()parser intact.protect_argsis active andoptions.c:safe_arg()skips shell escaping.Test plan
crates/metadata/src/mapping/tests.rsround-trip the spec accessor with*:1234and multi-rule specs.crates/core/src/client/remote/daemon_transfer/orchestration/tests.rsverifies--groupmap=*:1234and--usermap=*:5678are emitted verbatim bybuild_full_daemon_argsand survive the secluded-args wire round-trip.crates/core/src/client/remote/invocation/tests.rsverifies the SSH arg builder forwards the wildcard spec without escaping.