Implement 550 for RNFR command #539
Open
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.
Some FTP clients expect the server to indicate whether a file exists when they send the RNFR command. If it does, they expect a 350 (which currently happens). If it doesn't, the expect a 550 ("Requested action not taken") to indicate the file isn't available.
This adds this behaviour to the RNFR command and adds tests for both behaviours. I moved some functions from pass_security.rs to common.rs where I re-use them in the new tests.
I came across this because my scanner complained that the file I'm trying to scan already exists and I noticed it was sending RNFR and got confused by the 350 reply.
I decided to use the metadata command to check if a file exists since it seemed to be the best candidate. Please let me know if there's anything I can improve about the PR.
I ran
make pr-prep, but I think the current failures are unrelated to my changes so I didn't fix them to keep the commit clean.